Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/router/snapshot_content_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
26 changes: 24 additions & 2 deletions src/jupiter/service/native_publication_push_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
13 changes: 8 additions & 5 deletions src/jupiter/storage/view_ops_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ 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},
},
storage::{
Storage,
git_db_storage::fu18_support::single_connection,
init::database_connection,
object_storage::mock_object_storage,
view_root_chain::RootChainOutcome,
view_storage::ViewLockMode,
Expand All @@ -31,7 +31,7 @@ use crate::{
seed_unrelated_root_history,
},
},
tests::test_db_connection,
tests::{TestSchemaGuard, test_db_config},
},
};

Expand All @@ -58,6 +58,7 @@ struct OpsFixture {
filter_a: i64,
filter_b: i64,
filter_a_id: String,
_schema: TestSchemaGuard,
}

fn fixed_time() -> chrono::NaiveDateTime {
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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,
}
}

Expand Down
Loading