Skip to content

Commit b657167

Browse files
committed
Fix tests
1 parent 0ca5504 commit b657167

1 file changed

Lines changed: 17 additions & 22 deletions

File tree

src/infra/core/tests/tests/test_compact_service_impl.rs

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ async fn test_dataset_compact_watermark_only_blocks() {
231231
None,
232232
None,
233233
CommitOpts {
234-
system_time: Some(harness.current_date_tame),
234+
system_time: Some(harness.current_date_time),
235235
..CommitOpts::default()
236236
},
237237
)
@@ -268,7 +268,7 @@ async fn test_dataset_compact_watermark_only_blocks() {
268268
None,
269269
None,
270270
CommitOpts {
271-
system_time: Some(harness.current_date_tame),
271+
system_time: Some(harness.current_date_time),
272272
..CommitOpts::default()
273273
},
274274
)
@@ -696,24 +696,18 @@ async fn test_dataset_compact_derive_error() {
696696
let created = harness
697697
.create_dataset(
698698
MetadataFactory::dataset_snapshot()
699-
.name("derive-foo")
699+
.name("derive.foo")
700700
.kind(DatasetKind::Derivative)
701701
.push_event(MetadataFactory::set_data_schema().build())
702702
.build(),
703703
)
704704
.await;
705705

706-
let dataset_handle = harness
707-
.dataset_repo
708-
.resolve_dataset_ref(&created.dataset_handle.as_local_ref())
709-
.await
710-
.unwrap();
711-
712706
assert_matches!(
713707
harness
714708
.compact_svc
715709
.compact_dataset(
716-
&dataset_handle,
710+
&created.dataset_handle,
717711
MAX_SLICE_SIZE,
718712
MAX_SLICE_RECORDS,
719713
Some(Arc::new(NullCompactionMultiListener {}))
@@ -841,40 +835,40 @@ async fn test_large_dataset_compact() {
841835
/////////////////////////////////////////////////////////////////////////////////////////
842836

843837
struct CompactTestHarness {
838+
_temp_dir: tempfile::TempDir,
844839
dataset_repo: Arc<dyn DatasetRepository>,
845840
compact_svc: Arc<dyn CompactService>,
846841
push_ingest_svc: Arc<dyn PushIngestService>,
847842
verification_svc: Arc<dyn VerificationService>,
848-
current_date_tame: DateTime<Utc>,
843+
current_date_time: DateTime<Utc>,
849844
ctx: SessionContext,
850845
}
851846

852847
impl CompactTestHarness {
853848
fn new() -> Self {
854-
Self::new_local_with_authorizer(kamu_core::auth::AlwaysHappyDatasetActionAuthorizer::new())
849+
Self::new_local()
855850
}
856851

857-
fn new_local_with_authorizer<TDatasetAuthorizer: auth::DatasetActionAuthorizer + 'static>(
858-
dataset_action_authorizer: TDatasetAuthorizer,
859-
) -> Self {
852+
fn new_local() -> Self {
860853
let temp_dir = tempfile::tempdir().unwrap();
861854
let run_info_dir = temp_dir.path().join("run");
855+
let datasets_dir = temp_dir.path().join("datasets");
862856
std::fs::create_dir(&run_info_dir).unwrap();
863-
let current_date_tame = Utc.with_ymd_and_hms(2050, 1, 1, 12, 0, 0).unwrap();
857+
std::fs::create_dir(&datasets_dir).unwrap();
858+
let current_date_time = Utc.with_ymd_and_hms(2050, 1, 1, 12, 0, 0).unwrap();
864859

865860
let catalog = dill::CatalogBuilder::new()
866861
.add::<EventBus>()
867862
.add::<DependencyGraphServiceInMemory>()
868863
.add_value(CurrentAccountSubject::new_test())
869-
.add_value(dataset_action_authorizer)
870-
.bind::<dyn auth::DatasetActionAuthorizer, TDatasetAuthorizer>()
871864
.add_builder(
872865
DatasetRepositoryLocalFs::builder()
873-
.with_root(temp_dir.path().join("datasets"))
866+
.with_root(datasets_dir)
874867
.with_multi_tenant(false),
875868
)
876869
.bind::<dyn DatasetRepository, DatasetRepositoryLocalFs>()
877-
.add_value(SystemTimeSourceStub::new_set(current_date_tame))
870+
.add::<auth::AlwaysHappyDatasetActionAuthorizer>()
871+
.add_value(SystemTimeSourceStub::new_set(current_date_time))
878872
.bind::<dyn SystemTimeSource, SystemTimeSourceStub>()
879873
.add::<EngineProvisionerNull>()
880874
.add_builder(CompactServiceImpl::builder().with_run_info_dir(run_info_dir.clone()))
@@ -899,11 +893,12 @@ impl CompactTestHarness {
899893
let verification_svc = catalog.get_one::<dyn VerificationService>().unwrap();
900894

901895
Self {
896+
_temp_dir: temp_dir,
902897
dataset_repo,
903898
compact_svc,
904899
push_ingest_svc,
905900
verification_svc,
906-
current_date_tame,
901+
current_date_time,
907902
ctx: SessionContext::new_with_config(SessionConfig::new().with_target_partitions(1)),
908903
}
909904
}
@@ -1018,7 +1013,7 @@ impl CompactTestHarness {
10181013
event.into(),
10191014
CommitOpts {
10201015
block_ref: &BlockRef::Head,
1021-
system_time: Some(self.current_date_tame),
1016+
system_time: Some(self.current_date_time),
10221017
prev_block_hash: Some(Some(head)),
10231018
check_object_refs: false,
10241019
update_block_ref: true,

0 commit comments

Comments
 (0)