@@ -548,42 +548,6 @@ mod tests {
548
548
use restate_types:: identifiers:: { PartitionId , PartitionKey , SnapshotId } ;
549
549
use restate_types:: logs:: { Lsn , SequenceNumber } ;
550
550
551
- #[ tokio:: test]
552
- async fn test_repository_local ( ) -> anyhow:: Result < ( ) > {
553
- tracing_subscriber:: registry ( )
554
- . with ( fmt:: layer ( ) )
555
- . with ( EnvFilter :: from_default_env ( ) )
556
- . init ( ) ;
557
-
558
- let snapshot_source = TempDir :: new ( ) ?;
559
- let source_dir = snapshot_source. path ( ) . to_path_buf ( ) ;
560
-
561
- let mut data = tokio:: fs:: File :: create ( source_dir. join ( "data.sst" ) ) . await ?;
562
- data. write_all ( b"snapshot-data" ) . await ?;
563
-
564
- let snapshot = mock_snapshot_metadata (
565
- "/data.sst" . to_owned ( ) ,
566
- source_dir. to_string_lossy ( ) . to_string ( ) ,
567
- ) ;
568
-
569
- let snapshots_destination = TempDir :: new ( ) ?;
570
- let opts = SnapshotsOptions {
571
- destination : Some (
572
- Url :: from_file_path ( snapshots_destination. path ( ) )
573
- . unwrap ( )
574
- . to_string ( ) ,
575
- ) ,
576
- ..SnapshotsOptions :: default ( )
577
- } ;
578
- let repository = SnapshotRepository :: create_if_configured ( & opts)
579
- . await ?
580
- . unwrap ( ) ;
581
-
582
- repository. put ( & snapshot, source_dir) . await ?;
583
-
584
- Ok ( ( ) )
585
- }
586
-
587
551
#[ tokio:: test]
588
552
async fn test_overwrite_unparsable_latest ( ) -> anyhow:: Result < ( ) > {
589
553
tracing_subscriber:: registry ( )
@@ -629,9 +593,9 @@ mod tests {
629
593
}
630
594
631
595
#[ tokio:: test]
632
- async fn test_update_existing_snapshot_local_filesystem ( ) -> anyhow:: Result < ( ) > {
596
+ async fn test_put_snapshot_local_filesystem ( ) -> anyhow:: Result < ( ) > {
633
597
let snapshots_destination = TempDir :: new ( ) ?;
634
- test_update_existing_snapshot_with_newer (
598
+ test_put_snapshot (
635
599
Url :: from_file_path ( snapshots_destination. path ( ) )
636
600
. unwrap ( )
637
601
. to_string ( ) ,
@@ -641,15 +605,14 @@ mod tests {
641
605
642
606
/// For this test to run, set RESTATE_S3_INTEGRATION_TEST_BUCKET_NAME to a writable S3 bucket name
643
607
#[ tokio:: test]
644
- async fn test_update_existing_snapshot_s3 ( ) -> anyhow:: Result < ( ) > {
608
+ async fn test_put_snapshot_s3 ( ) -> anyhow:: Result < ( ) > {
645
609
let Ok ( bucket_name) = std:: env:: var ( "RESTATE_S3_INTEGRATION_TEST_BUCKET_NAME" ) else {
646
610
return Ok ( ( ) ) ;
647
611
} ;
648
- test_update_existing_snapshot_with_newer ( format ! ( "s3://{bucket_name}/integration-test" ) )
649
- . await
612
+ test_put_snapshot ( format ! ( "s3://{bucket_name}/integration-test" ) ) . await
650
613
}
651
614
652
- async fn test_update_existing_snapshot_with_newer ( destination : String ) -> anyhow:: Result < ( ) > {
615
+ async fn test_put_snapshot ( destination : String ) -> anyhow:: Result < ( ) > {
653
616
tracing_subscriber:: registry ( )
654
617
. with ( fmt:: layer ( ) )
655
618
. with ( EnvFilter :: from_default_env ( ) )
@@ -658,6 +621,19 @@ mod tests {
658
621
let snapshot_source = TempDir :: new ( ) ?;
659
622
let source_dir = snapshot_source. path ( ) . to_path_buf ( ) ;
660
623
624
+ let destination_url = Url :: parse ( destination. as_str ( ) ) ?;
625
+ let path = destination_url. path ( ) . to_string ( ) ;
626
+ let object_store = super :: create_object_store_client ( destination_url) . await ?;
627
+
628
+ let latest = object_store
629
+ . get ( & Path :: from ( format ! (
630
+ "{}/{}/latest.json" ,
631
+ path,
632
+ PartitionId :: MIN ,
633
+ ) ) )
634
+ . await ;
635
+ assert ! ( matches!( latest, Err ( object_store:: Error :: NotFound { .. } ) ) ) ;
636
+
661
637
let mut data = tokio:: fs:: File :: create ( source_dir. join ( "data.sst" ) ) . await ?;
662
638
data. write_all ( b"snapshot-data" ) . await ?;
663
639
@@ -672,16 +648,10 @@ mod tests {
672
648
) ;
673
649
674
650
let opts = SnapshotsOptions {
675
- destination : Some ( destination. clone ( ) ) ,
651
+ destination : Some ( destination) ,
676
652
..SnapshotsOptions :: default ( )
677
653
} ;
678
654
679
- eprintln ! ( "Destination: {}" , destination) ;
680
-
681
- let destination = Url :: parse ( destination. as_str ( ) ) ?;
682
- let path = destination. path ( ) . to_string ( ) ;
683
- let object_store = super :: create_object_store_client ( destination) . await ?;
684
-
685
655
let repository = SnapshotRepository :: create_if_configured ( & opts)
686
656
. await ?
687
657
. unwrap ( ) ;
0 commit comments