diff --git a/src/api/router/snapshot_content_tests.rs b/src/api/router/snapshot_content_tests.rs index aa8f92bc..906752ff 100644 --- a/src/api/router/snapshot_content_tests.rs +++ b/src/api/router/snapshot_content_tests.rs @@ -679,7 +679,7 @@ impl Fixture { config.mst2.auth_token = Some(TOKEN.to_string()); let backend = build_object_storage(&config.object_storage).await.unwrap(); let counts = Arc::new(ReadCounts::default()); - let (mut storage, schema) = if rebuildable { + let (mut storage, schema) = if rebuildable || !generic_history { let (database, schema) = test_db_config(temp.path()).await; config.database = database; let assembly = async { diff --git a/src/jupiter/service/native_publication_push_tests.rs b/src/jupiter/service/native_publication_push_tests.rs index ce3febbb..eb746d1c 100644 --- a/src/jupiter/service/native_publication_push_tests.rs +++ b/src/jupiter/service/native_publication_push_tests.rs @@ -8,14 +8,36 @@ use crate::jupiter::utils::converter::FromMegaModel; const NATIVE_INSTANCE: &str = "6ab219b0-4275-45ba-9d7b-7b0b633018cd"; -async fn native_fixture() -> (tempfile::TempDir, crate::jupiter::storage::Storage, git_internal::internal::object::commit::Commit, String) { +async fn native_fixture() -> ( + tempfile::TempDir, + crate::jupiter::storage::Storage, + git_internal::internal::object::commit::Commit, + String, +) { let temp = tempfile::tempdir().unwrap(); let mut config = crate::config::testing::isolated_config(temp.path().join("config")); config.monorepo.push_policy = PushPolicy::Trunk; config.mst2.enabled = true; config.mst2.publication_enabled = true; config.mst2.instance_uuid = Some(NATIVE_INSTANCE.to_owned()); - let storage = crate::jupiter::tests::test_storage_with_config(temp.path(), config).await; + let (database, schema) = crate::jupiter::tests::test_db_config(temp.path()).await; + config.database = database; + let mut connection = crate::jupiter::storage::init::database_connection(&config.database) + .await + .unwrap(); + connection.set_metric_callback(move |_| { + let _held_by_the_connection = &schema; + }); + let mut storage = crate::jupiter::storage::Storage::new_with_connection( + Arc::new(config), + Arc::new(connection), + crate::jupiter::storage::object_storage::mock_object_storage(), + ) + .await + .unwrap(); + storage.push_queue_service = storage + .push_queue_service + .with_timeouts(Duration::from_secs(30), Duration::from_millis(20)); let storage = crate::jupiter::tests::with_test_vault(storage, temp.path()).await; let name = format!("native-{}", uuid::Uuid::new_v4().simple()); use git_internal::internal::object::{ diff --git a/src/jupiter/storage/view_ops_tests.rs b/src/jupiter/storage/view_ops_tests.rs index e0cfa446..bc691179 100644 --- a/src/jupiter/storage/view_ops_tests.rs +++ b/src/jupiter/storage/view_ops_tests.rs @@ -15,7 +15,6 @@ use crate::{ ceres::view::filter::parse_for_registration, config::testing::isolated_config, jupiter::{ - migration::apply_migrations, service::{ view_metrics::ViewMetrics, view_projection_service::{CatchUpOutcome, ViewProjectionService}, @@ -23,6 +22,7 @@ use crate::{ storage::{ Storage, git_db_storage::fu18_support::single_connection, + init::database_connection, object_storage::mock_object_storage, view_root_chain::RootChainOutcome, view_storage::ViewLockMode, @@ -31,7 +31,7 @@ use crate::{ seed_unrelated_root_history, }, }, - tests::test_db_connection, + tests::{TestSchemaGuard, test_db_config}, }, }; @@ -58,6 +58,7 @@ struct OpsFixture { filter_a: i64, filter_b: i64, filter_a_id: String, + _schema: TestSchemaGuard, } fn fixed_time() -> chrono::NaiveDateTime { @@ -222,9 +223,10 @@ async fn insert_warming_filter( async fn ops_fixture() -> OpsFixture { let temp = tempfile::tempdir().unwrap(); - let db = test_db_connection(temp.path()).await; - apply_migrations(&db, true).await.unwrap(); - let config = isolated_config(temp.path().join("config")); + let (database, schema) = test_db_config(temp.path()).await; + let mut config = isolated_config(temp.path().join("config")); + config.database = database; + let db = database_connection(&config.database).await.unwrap(); let storage = Storage::new_with_connection( Arc::new(config), Arc::new(db.clone()), @@ -406,6 +408,7 @@ async fn ops_fixture() -> OpsFixture { filter_a: filter_a.id, filter_b: filter_b.id, filter_a_id: filter_a.filter_id, + _schema: schema, } }