From 4eb59e4f6cb4d9f2fdb4c222c3e88e9b685014d0 Mon Sep 17 00:00:00 2001 From: Johanna Larsson Date: Thu, 24 Sep 2026 07:42:25 +0100 Subject: [PATCH] Creating a mega test binary Overall `just test` runs about 10-20s faster on this branch than current main, for me, with around 170s instead of around 180-190s. But the cool thing is the compile time. Making a simple edit to any file involved and running `just test` on main takes about 60s to recompile the test binaries. On this branch it takes less than 15s. This is done by replacing a ton of separate test binaries with a single megabinary. Only test files that looked safe have been included, avoiding ones that do stuff like setting env. --- .config/nextest.toml | 14 +-- .../tests/{ => it}/account_lifecycle.rs | 4 +- .../tests/{ => it}/account_notifications.rs | 3 +- crates/tranquil-pds/tests/{ => it}/actor.rs | 3 +- .../tests/{ => it}/admin_email.rs | 54 ++++++------ .../tests/{ => it}/admin_invite.rs | 4 +- .../tests/{ => it}/admin_moderation.rs | 4 +- .../tests/{ => it}/admin_search.rs | 6 +- .../tests/{ => it}/admin_stats.rs | 3 +- .../tests/{ => it}/apple_sso_unit.rs | 0 .../tests/{ => it}/auth_extractor.rs | 9 +- .../tests/{ => it}/banned_words.rs | 6 +- .../{ => it}/car_export_detects_corruption.rs | 0 .../tests/{ => it}/change_password.rs | 6 +- .../tests/{ => it}/commit_signing.rs | 0 .../tests/{ => it}/delete_account.rs | 4 +- crates/tranquil-pds/tests/{ => it}/did_web.rs | 13 ++- .../tranquil-pds/tests/{ => it}/dpop_unit.rs | 0 .../tests/{ => it}/email_update.rs | 67 +++++++-------- .../tests/{ => it}/feed_proxy_aud.rs | 4 +- .../tests/{ => it}/firehose_inline_blocks.rs | 10 +-- .../tests/{ => it}/firehose_validation.rs | 4 +- .../tests/{ => it}/gc_after_delete.rs | 6 +- .../tests/{ => it}/gc_compaction_restart.rs | 4 +- .../tranquil-pds/tests/{ => it}/identity.rs | 7 +- .../tests/{ => it}/image_processing.rs | 0 .../tests/{ => it}/import_verification.rs | 3 +- crates/tranquil-pds/tests/{ => it}/invite.rs | 3 +- .../tests/{ => it}/invite_registration.rs | 3 +- .../tests/{ => it}/jwt_security.rs | 3 +- .../tranquil-pds/tests/{ => it}/legacy_2fa.rs | 4 +- .../tests/{ => it}/lifecycle_record.rs | 6 +- .../tests/{ => it}/lifecycle_session.rs | 6 +- .../tests/{ => it}/lifecycle_social.rs | 6 +- crates/tranquil-pds/tests/it/main.rs | 85 +++++++++++++++++++ .../tranquil-pds/tests/{ => it}/moderation.rs | 6 +- .../tests/{ => it}/mst_diff_equivalence.rs | 0 .../tests/{ => it}/mst_firehose_e2e.rs | 9 +- .../tests/{ => it}/mst_inductive_firehose.rs | 7 +- .../tests/{ => it}/mst_integrity.rs | 10 +-- .../tests/{ => it}/mst_property_fuzz.rs | 7 +- .../tests/{ => it}/mst_repair_audit.rs | 0 .../tests/{ => it}/mst_repair_durability.rs | 0 .../tests/{ => it}/mst_structural_repair.rs | 0 .../tests/{ => it}/notifications.rs | 13 ++- crates/tranquil-pds/tests/{ => it}/oauth.rs | 6 +- .../tests/{ => it}/oauth_lifecycle.rs | 7 +- .../tests/{ => it}/oauth_permission_sets.rs | 17 ++-- .../tests/{ => it}/oauth_scopes.rs | 7 +- .../tests/{ => it}/oauth_security.rs | 6 +- .../tests/{ => it}/oauth_token_eviction.rs | 7 +- .../tests/{ => it}/password_reset.rs | 46 +++++----- .../tests/{ => it}/plc_operations.rs | 3 +- .../tests/{ => it}/plc_validation.rs | 0 .../tranquil-pds/tests/{ => it}/rate_limit.rs | 3 +- .../tests/{ => it}/record_validation.rs | 0 .../tests/{ => it}/repair_leaf_loss.rs | 7 +- .../tranquil-pds/tests/{ => it}/repo_batch.rs | 3 +- .../tranquil-pds/tests/{ => it}/repo_blob.rs | 3 +- .../tests/{ => it}/repo_conformance.rs | 6 +- .../tests/{ => it}/repo_lifecycle.rs | 11 +-- .../tests/{ => it}/ripple_cluster.rs | 54 ++++++------ .../tests/{ => it}/scope_edge_cases.rs | 0 .../tests/{ => it}/security_fixes.rs | 3 +- crates/tranquil-pds/tests/{ => it}/server.rs | 6 +- .../tests/{ => it}/session_management.rs | 6 +- .../tests/{ => it}/shutdown_unit.rs | 0 .../tests/{ => it}/signing_key.rs | 46 +++++----- crates/tranquil-pds/tests/{ => it}/sso.rs | 4 +- .../tests/{ => it}/store_parity.rs | 11 +-- .../tranquil-pds/tests/{ => it}/sync_blob.rs | 3 +- .../tests/{ => it}/sync_conformance.rs | 7 +- .../tests/{ => it}/sync_deprecated.rs | 6 +- .../tranquil-pds/tests/{ => it}/sync_repo.rs | 6 +- .../{ => it}/user_blocks_reachability.rs | 6 +- .../tests/{ => it}/validation_edge_cases.rs | 0 .../tests/{ => it}/verify_live_commit.rs | 1 - .../tests/{ => it}/whole_story.rs | 7 +- justfile | 25 +++--- 79 files changed, 345 insertions(+), 384 deletions(-) rename crates/tranquil-pds/tests/{ => it}/account_lifecycle.rs (99%) rename crates/tranquil-pds/tests/{ => it}/account_notifications.rs (98%) rename crates/tranquil-pds/tests/{ => it}/actor.rs (99%) rename crates/tranquil-pds/tests/{ => it}/admin_email.rs (76%) rename crates/tranquil-pds/tests/{ => it}/admin_invite.rs (99%) rename crates/tranquil-pds/tests/{ => it}/admin_moderation.rs (99%) rename crates/tranquil-pds/tests/{ => it}/admin_search.rs (99%) rename crates/tranquil-pds/tests/{ => it}/admin_stats.rs (93%) rename crates/tranquil-pds/tests/{ => it}/apple_sso_unit.rs (100%) rename crates/tranquil-pds/tests/{ => it}/auth_extractor.rs (99%) rename crates/tranquil-pds/tests/{ => it}/banned_words.rs (99%) rename crates/tranquil-pds/tests/{ => it}/car_export_detects_corruption.rs (100%) rename crates/tranquil-pds/tests/{ => it}/change_password.rs (99%) rename crates/tranquil-pds/tests/{ => it}/commit_signing.rs (100%) rename crates/tranquil-pds/tests/{ => it}/delete_account.rs (99%) rename crates/tranquil-pds/tests/{ => it}/did_web.rs (98%) rename crates/tranquil-pds/tests/{ => it}/dpop_unit.rs (100%) rename crates/tranquil-pds/tests/{ => it}/email_update.rs (91%) rename crates/tranquil-pds/tests/{ => it}/feed_proxy_aud.rs (99%) rename crates/tranquil-pds/tests/{ => it}/firehose_inline_blocks.rs (99%) rename crates/tranquil-pds/tests/{ => it}/firehose_validation.rs (99%) rename crates/tranquil-pds/tests/{ => it}/gc_after_delete.rs (99%) rename crates/tranquil-pds/tests/{ => it}/gc_compaction_restart.rs (99%) rename crates/tranquil-pds/tests/{ => it}/identity.rs (99%) rename crates/tranquil-pds/tests/{ => it}/image_processing.rs (100%) rename crates/tranquil-pds/tests/{ => it}/import_verification.rs (99%) rename crates/tranquil-pds/tests/{ => it}/invite.rs (99%) rename crates/tranquil-pds/tests/{ => it}/invite_registration.rs (99%) rename crates/tranquil-pds/tests/{ => it}/jwt_security.rs (99%) rename crates/tranquil-pds/tests/{ => it}/legacy_2fa.rs (99%) rename crates/tranquil-pds/tests/{ => it}/lifecycle_record.rs (99%) rename crates/tranquil-pds/tests/{ => it}/lifecycle_session.rs (99%) rename crates/tranquil-pds/tests/{ => it}/lifecycle_social.rs (99%) create mode 100644 crates/tranquil-pds/tests/it/main.rs rename crates/tranquil-pds/tests/{ => it}/moderation.rs (99%) rename crates/tranquil-pds/tests/{ => it}/mst_diff_equivalence.rs (100%) rename crates/tranquil-pds/tests/{ => it}/mst_firehose_e2e.rs (98%) rename crates/tranquil-pds/tests/{ => it}/mst_inductive_firehose.rs (99%) rename crates/tranquil-pds/tests/{ => it}/mst_integrity.rs (98%) rename crates/tranquil-pds/tests/{ => it}/mst_property_fuzz.rs (99%) rename crates/tranquil-pds/tests/{ => it}/mst_repair_audit.rs (100%) rename crates/tranquil-pds/tests/{ => it}/mst_repair_durability.rs (100%) rename crates/tranquil-pds/tests/{ => it}/mst_structural_repair.rs (100%) rename crates/tranquil-pds/tests/{ => it}/notifications.rs (80%) rename crates/tranquil-pds/tests/{ => it}/oauth.rs (99%) rename crates/tranquil-pds/tests/{ => it}/oauth_lifecycle.rs (99%) rename crates/tranquil-pds/tests/{ => it}/oauth_permission_sets.rs (99%) rename crates/tranquil-pds/tests/{ => it}/oauth_scopes.rs (99%) rename crates/tranquil-pds/tests/{ => it}/oauth_security.rs (99%) rename crates/tranquil-pds/tests/{ => it}/oauth_token_eviction.rs (98%) rename crates/tranquil-pds/tests/{ => it}/password_reset.rs (91%) rename crates/tranquil-pds/tests/{ => it}/plc_operations.rs (99%) rename crates/tranquil-pds/tests/{ => it}/plc_validation.rs (100%) rename crates/tranquil-pds/tests/{ => it}/rate_limit.rs (99%) rename crates/tranquil-pds/tests/{ => it}/record_validation.rs (100%) rename crates/tranquil-pds/tests/{ => it}/repair_leaf_loss.rs (98%) rename crates/tranquil-pds/tests/{ => it}/repo_batch.rs (99%) rename crates/tranquil-pds/tests/{ => it}/repo_blob.rs (99%) rename crates/tranquil-pds/tests/{ => it}/repo_conformance.rs (99%) rename crates/tranquil-pds/tests/{ => it}/repo_lifecycle.rs (99%) rename crates/tranquil-pds/tests/{ => it}/ripple_cluster.rs (95%) rename crates/tranquil-pds/tests/{ => it}/scope_edge_cases.rs (100%) rename crates/tranquil-pds/tests/{ => it}/security_fixes.rs (98%) rename crates/tranquil-pds/tests/{ => it}/server.rs (99%) rename crates/tranquil-pds/tests/{ => it}/session_management.rs (99%) rename crates/tranquil-pds/tests/{ => it}/shutdown_unit.rs (100%) rename crates/tranquil-pds/tests/{ => it}/signing_key.rs (90%) rename crates/tranquil-pds/tests/{ => it}/sso.rs (99%) rename crates/tranquil-pds/tests/{ => it}/store_parity.rs (99%) rename crates/tranquil-pds/tests/{ => it}/sync_blob.rs (99%) rename crates/tranquil-pds/tests/{ => it}/sync_conformance.rs (99%) rename crates/tranquil-pds/tests/{ => it}/sync_deprecated.rs (99%) rename crates/tranquil-pds/tests/{ => it}/sync_repo.rs (99%) rename crates/tranquil-pds/tests/{ => it}/user_blocks_reachability.rs (99%) rename crates/tranquil-pds/tests/{ => it}/validation_edge_cases.rs (100%) rename crates/tranquil-pds/tests/{ => it}/verify_live_commit.rs (99%) rename crates/tranquil-pds/tests/{ => it}/whole_story.rs (99%) diff --git a/.config/nextest.toml b/.config/nextest.toml index c280457..bd1fba2 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -53,7 +53,7 @@ heavy-load-tests = { max-threads = 4 } io-heavy-sim = { max-threads = 2 } [[profile.default.overrides]] -filter = "binary(ripple_cluster)" +filter = "binary(it) and test(/^ripple_cluster::/)" test-group = "serial-env-tests" [[profile.default.overrides]] @@ -61,7 +61,7 @@ filter = "package(tranquil-signal) and test(/^tests::/)" test-group = "serial-env-tests" [[profile.default.overrides]] -filter = "binary(whole_story)" +filter = "binary(it) and test(/^whole_story::/)" test-group = "heavy-load-tests" [[profile.default.overrides]] @@ -69,7 +69,7 @@ filter = "test(/two_node_stress_concurrent_load/)" test-group = "heavy-load-tests" [[profile.default.overrides]] -filter = "binary(repo_lifecycle)" +filter = "binary(it) and test(/^repo_lifecycle::/)" test-group = "heavy-load-tests" [[profile.default.overrides]] @@ -91,7 +91,7 @@ filter = "binary(gauntlet_smoke)" slow-timeout = { period = "300s", terminate-after = 8 } [[profile.default.overrides]] -filter = "binary(compaction_restart) | binary(mst_refcount_integrity) | binary(gc_compaction_restart)" +filter = "binary(compaction_restart) | binary(mst_refcount_integrity) | binary(it) and test(/^gc_compaction_restart::/)" slow-timeout = { period = "120s", terminate-after = 4 } [[profile.default.overrides]] @@ -105,7 +105,7 @@ slow-timeout = { period = "300s", terminate-after = 4 } test-group = "io-heavy-sim" [[profile.ci.overrides]] -filter = "binary(ripple_cluster)" +filter = "binary(it) and test(/^ripple_cluster::/)" test-group = "serial-env-tests" [[profile.ci.overrides]] @@ -113,7 +113,7 @@ filter = "package(tranquil-signal) and test(/^tests::/)" test-group = "serial-env-tests" [[profile.ci.overrides]] -filter = "binary(whole_story)" +filter = "binary(it) and test(/^whole_story::/)" test-group = "heavy-load-tests" [[profile.ci.overrides]] @@ -121,7 +121,7 @@ filter = "test(/two_node_stress_concurrent_load/)" test-group = "heavy-load-tests" [[profile.ci.overrides]] -filter = "binary(repo_lifecycle)" +filter = "binary(it) and test(/^repo_lifecycle::/)" test-group = "heavy-load-tests" [[profile.ci.overrides]] diff --git a/crates/tranquil-pds/tests/account_lifecycle.rs b/crates/tranquil-pds/tests/it/account_lifecycle.rs similarity index 99% rename from crates/tranquil-pds/tests/account_lifecycle.rs rename to crates/tranquil-pds/tests/it/account_lifecycle.rs index 4d3b261..796fb83 100644 --- a/crates/tranquil-pds/tests/account_lifecycle.rs +++ b/crates/tranquil-pds/tests/it/account_lifecycle.rs @@ -1,6 +1,4 @@ -mod common; -mod helpers; -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/account_notifications.rs b/crates/tranquil-pds/tests/it/account_notifications.rs similarity index 98% rename from crates/tranquil-pds/tests/account_notifications.rs rename to crates/tranquil-pds/tests/it/account_notifications.rs index 27f4370..4abf9fc 100644 --- a/crates/tranquil-pds/tests/account_notifications.rs +++ b/crates/tranquil-pds/tests/it/account_notifications.rs @@ -1,5 +1,4 @@ -mod common; -use common::{base_url, client, create_account_and_login, get_test_repos, user_id_of}; +use crate::common::{base_url, client, create_account_and_login, get_test_repos, user_id_of}; use serde_json::{Value, json}; use tranquil_db_traits::{CommsChannel, CommsType}; use tranquil_types::{Did, Recipient}; diff --git a/crates/tranquil-pds/tests/actor.rs b/crates/tranquil-pds/tests/it/actor.rs similarity index 99% rename from crates/tranquil-pds/tests/actor.rs rename to crates/tranquil-pds/tests/it/actor.rs index a54e654..62dd8ad 100644 --- a/crates/tranquil-pds/tests/actor.rs +++ b/crates/tranquil-pds/tests/it/actor.rs @@ -1,5 +1,4 @@ -mod common; -use common::{base_url, client, create_account_and_login}; +use crate::common::{base_url, client, create_account_and_login}; use serde_json::{Value, json}; #[tokio::test] diff --git a/crates/tranquil-pds/tests/admin_email.rs b/crates/tranquil-pds/tests/it/admin_email.rs similarity index 76% rename from crates/tranquil-pds/tests/admin_email.rs rename to crates/tranquil-pds/tests/it/admin_email.rs index 0541cf5..b0c9d71 100644 --- a/crates/tranquil-pds/tests/admin_email.rs +++ b/crates/tranquil-pds/tests/it/admin_email.rs @@ -1,5 +1,3 @@ -mod common; - use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_db_traits::CommsType; @@ -7,10 +5,10 @@ use tranquil_types::Did; #[tokio::test] async fn test_send_email_success() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; - let (access_jwt, did) = common::create_admin_account_and_login(&client).await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; + let (access_jwt, did) = crate::common::create_admin_account_and_login(&client).await; let res = client .post(format!("{}/xrpc/com.atproto.admin.sendEmail", base_url)) .bearer_auth(&access_jwt) @@ -26,7 +24,7 @@ async fn test_send_email_success() { assert_eq!(res.status(), StatusCode::OK); let body: Value = res.json().await.expect("Invalid JSON"); assert_eq!(body["sent"], true); - let user_id = common::user_id_of(repos, &Did::new(did).unwrap()).await; + let user_id = crate::common::user_id_of(repos, &Did::new(did).unwrap()).await; let comms = repos .infra .get_latest_comms_for_user(user_id, CommsType::AdminEmail, 1) @@ -43,10 +41,10 @@ async fn test_send_email_success() { #[tokio::test] async fn test_send_email_default_subject() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; - let (access_jwt, did) = common::create_admin_account_and_login(&client).await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; + let (access_jwt, did) = crate::common::create_admin_account_and_login(&client).await; let res = client .post(format!("{}/xrpc/com.atproto.admin.sendEmail", base_url)) .bearer_auth(&access_jwt) @@ -61,7 +59,7 @@ async fn test_send_email_default_subject() { assert_eq!(res.status(), StatusCode::OK); let body: Value = res.json().await.expect("Invalid JSON"); assert_eq!(body["sent"], true); - let user_id = common::user_id_of(repos, &Did::new(did).unwrap()).await; + let user_id = crate::common::user_id_of(repos, &Did::new(did).unwrap()).await; let comms = repos .infra .get_latest_comms_for_user(user_id, CommsType::AdminEmail, 10) @@ -83,9 +81,9 @@ async fn test_send_email_default_subject() { #[tokio::test] async fn test_send_email_recipient_not_found() { - let client = common::client(); - let base_url = common::base_url().await; - let (access_jwt, _) = common::create_admin_account_and_login(&client).await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let (access_jwt, _) = crate::common::create_admin_account_and_login(&client).await; let res = client .post(format!("{}/xrpc/com.atproto.admin.sendEmail", base_url)) .bearer_auth(&access_jwt) @@ -104,9 +102,9 @@ async fn test_send_email_recipient_not_found() { #[tokio::test] async fn test_send_email_missing_content() { - let client = common::client(); - let base_url = common::base_url().await; - let (access_jwt, did) = common::create_admin_account_and_login(&client).await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let (access_jwt, did) = crate::common::create_admin_account_and_login(&client).await; let res = client .post(format!("{}/xrpc/com.atproto.admin.sendEmail", base_url)) .bearer_auth(&access_jwt) @@ -125,9 +123,9 @@ async fn test_send_email_missing_content() { #[tokio::test] async fn test_send_email_missing_recipient() { - let client = common::client(); - let base_url = common::base_url().await; - let (access_jwt, _) = common::create_admin_account_and_login(&client).await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let (access_jwt, _) = crate::common::create_admin_account_and_login(&client).await; let res = client .post(format!("{}/xrpc/com.atproto.admin.sendEmail", base_url)) .bearer_auth(&access_jwt) @@ -144,8 +142,8 @@ async fn test_send_email_missing_recipient() { #[tokio::test] async fn test_send_email_requires_auth() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!("{}/xrpc/com.atproto.admin.sendEmail", base_url)) .json(&json!({ @@ -161,11 +159,11 @@ async fn test_send_email_requires_auth() { #[tokio::test] async fn test_send_email_rejects_garbage_stored_email() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; - let (access_jwt, did) = common::create_admin_account_and_login(&client).await; - let user_id = common::user_id_of(repos, &Did::new(did.clone()).unwrap()).await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; + let (access_jwt, did) = crate::common::create_admin_account_and_login(&client).await; + let user_id = crate::common::user_id_of(repos, &Did::new(did.clone()).unwrap()).await; repos .user .update_email(user_id, "not-an-email") diff --git a/crates/tranquil-pds/tests/admin_invite.rs b/crates/tranquil-pds/tests/it/admin_invite.rs similarity index 99% rename from crates/tranquil-pds/tests/admin_invite.rs rename to crates/tranquil-pds/tests/it/admin_invite.rs index ca66858..1b95eeb 100644 --- a/crates/tranquil-pds/tests/admin_invite.rs +++ b/crates/tranquil-pds/tests/it/admin_invite.rs @@ -1,6 +1,4 @@ -mod common; - -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/admin_moderation.rs b/crates/tranquil-pds/tests/it/admin_moderation.rs similarity index 99% rename from crates/tranquil-pds/tests/admin_moderation.rs rename to crates/tranquil-pds/tests/it/admin_moderation.rs index ec29cb1..f4d9430 100644 --- a/crates/tranquil-pds/tests/admin_moderation.rs +++ b/crates/tranquil-pds/tests/it/admin_moderation.rs @@ -1,6 +1,4 @@ -mod common; - -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/admin_search.rs b/crates/tranquil-pds/tests/it/admin_search.rs similarity index 99% rename from crates/tranquil-pds/tests/admin_search.rs rename to crates/tranquil-pds/tests/it/admin_search.rs index f2172b7..ec8a881 100644 --- a/crates/tranquil-pds/tests/admin_search.rs +++ b/crates/tranquil-pds/tests/it/admin_search.rs @@ -1,7 +1,5 @@ -mod common; -mod helpers; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::Value; diff --git a/crates/tranquil-pds/tests/admin_stats.rs b/crates/tranquil-pds/tests/it/admin_stats.rs similarity index 93% rename from crates/tranquil-pds/tests/admin_stats.rs rename to crates/tranquil-pds/tests/it/admin_stats.rs index 7f06e7e..62bbd24 100644 --- a/crates/tranquil-pds/tests/admin_stats.rs +++ b/crates/tranquil-pds/tests/it/admin_stats.rs @@ -1,5 +1,4 @@ -mod common; -use common::{base_url, client, create_admin_account_and_login}; +use crate::common::{base_url, client, create_admin_account_and_login}; use serde_json::Value; #[tokio::test] diff --git a/crates/tranquil-pds/tests/apple_sso_unit.rs b/crates/tranquil-pds/tests/it/apple_sso_unit.rs similarity index 100% rename from crates/tranquil-pds/tests/apple_sso_unit.rs rename to crates/tranquil-pds/tests/it/apple_sso_unit.rs diff --git a/crates/tranquil-pds/tests/auth_extractor.rs b/crates/tranquil-pds/tests/it/auth_extractor.rs similarity index 99% rename from crates/tranquil-pds/tests/auth_extractor.rs rename to crates/tranquil-pds/tests/it/auth_extractor.rs index a8c6ce2..ab25172 100644 --- a/crates/tranquil-pds/tests/auth_extractor.rs +++ b/crates/tranquil-pds/tests/it/auth_extractor.rs @@ -1,10 +1,7 @@ -mod common; -mod helpers; - use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; use chrono::Utc; -use common::{base_url, client, create_account_and_login, pds_endpoint}; -use helpers::verify_new_account; +use crate::common::{base_url, client, create_account_and_login, pds_endpoint}; +use crate::helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; use sha2::{Digest, Sha256}; @@ -215,7 +212,7 @@ async fn test_oauth_admin_extractor_allows_oauth_tokens() { let did = account["did"].as_str().unwrap().to_string(); verify_new_account(&http_client, &did).await; - let repos = common::get_test_repos().await; + let repos = crate::common::get_test_repos().await; repos .user .set_admin_status(&tranquil_types::Did::new(did.clone()).unwrap(), true) diff --git a/crates/tranquil-pds/tests/banned_words.rs b/crates/tranquil-pds/tests/it/banned_words.rs similarity index 99% rename from crates/tranquil-pds/tests/banned_words.rs rename to crates/tranquil-pds/tests/it/banned_words.rs index 4783d2e..3325e18 100644 --- a/crates/tranquil-pds/tests/banned_words.rs +++ b/crates/tranquil-pds/tests/it/banned_words.rs @@ -13,10 +13,8 @@ * - we maintain this code precisely because we believe everyone deserves an experience on the web that is free from this kinda language */ -mod common; -mod helpers; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::json; diff --git a/crates/tranquil-pds/tests/car_export_detects_corruption.rs b/crates/tranquil-pds/tests/it/car_export_detects_corruption.rs similarity index 100% rename from crates/tranquil-pds/tests/car_export_detects_corruption.rs rename to crates/tranquil-pds/tests/it/car_export_detects_corruption.rs diff --git a/crates/tranquil-pds/tests/change_password.rs b/crates/tranquil-pds/tests/it/change_password.rs similarity index 99% rename from crates/tranquil-pds/tests/change_password.rs rename to crates/tranquil-pds/tests/it/change_password.rs index 54f7c44..9915457 100644 --- a/crates/tranquil-pds/tests/change_password.rs +++ b/crates/tranquil-pds/tests/it/change_password.rs @@ -1,7 +1,5 @@ -mod common; -mod helpers; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/commit_signing.rs b/crates/tranquil-pds/tests/it/commit_signing.rs similarity index 100% rename from crates/tranquil-pds/tests/commit_signing.rs rename to crates/tranquil-pds/tests/it/commit_signing.rs diff --git a/crates/tranquil-pds/tests/delete_account.rs b/crates/tranquil-pds/tests/it/delete_account.rs similarity index 99% rename from crates/tranquil-pds/tests/delete_account.rs rename to crates/tranquil-pds/tests/it/delete_account.rs index 0f105d7..d378e88 100644 --- a/crates/tranquil-pds/tests/delete_account.rs +++ b/crates/tranquil-pds/tests/it/delete_account.rs @@ -1,7 +1,5 @@ -mod common; -mod helpers; use chrono::Utc; -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/did_web.rs b/crates/tranquil-pds/tests/it/did_web.rs similarity index 98% rename from crates/tranquil-pds/tests/did_web.rs rename to crates/tranquil-pds/tests/it/did_web.rs index 03edad2..3902619 100644 --- a/crates/tranquil-pds/tests/did_web.rs +++ b/crates/tranquil-pds/tests/it/did_web.rs @@ -1,7 +1,6 @@ -mod common; use base64::Engine; use base64::engine::general_purpose::URL_SAFE_NO_PAD; -use common::*; +use crate::common::*; use k256::ecdsa::{SigningKey, signature::Signer}; use reqwest::StatusCode; use serde_json::{Value, json}; @@ -100,7 +99,7 @@ async fn test_external_did_web_no_local_doc() { let mock_addr = mock_uri.trim_start_matches("http://"); let did = format!("did:web:{}", mock_addr.replace(":", "%3A")); let handle = format!("xw{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); - let pds_endpoint = common::pds_endpoint(); + let pds_endpoint = crate::common::pds_endpoint(); let reserve_res = client .post(format!( @@ -203,7 +202,7 @@ async fn assert_reserved_key_placement_rejected( let mock_addr = mock_uri.trim_start_matches("http://"); let did = format!("did:web:{}", mock_addr.replace(":", "%3A")); let handle = format!("wm{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); - let pds_endpoint = common::pds_endpoint(); + let pds_endpoint = crate::common::pds_endpoint(); let signing_key = reserve_signing_key(&client, base, &did).await; let signing_multibase = signing_key @@ -525,8 +524,8 @@ async fn test_did_web_byod_flow() { unique_id ); let handle = format!("by{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); - let pds_endpoint = common::pds_endpoint(); - let pds_hostname = common::pds_hostname(); + let pds_endpoint = crate::common::pds_endpoint(); + let pds_hostname = crate::common::pds_hostname(); let pds_did = format!("did:web:{}", pds_hostname); let temp_key = SigningKey::random(&mut rand::thread_rng()); @@ -579,7 +578,7 @@ async fn test_did_web_byod_flow() { "BYOD accounts should require verification" ); - let access_jwt = common::verify_new_account(&client, returned_did).await; + let access_jwt = crate::common::verify_new_account(&client, returned_did).await; let res = client .get(format!( diff --git a/crates/tranquil-pds/tests/dpop_unit.rs b/crates/tranquil-pds/tests/it/dpop_unit.rs similarity index 100% rename from crates/tranquil-pds/tests/dpop_unit.rs rename to crates/tranquil-pds/tests/it/dpop_unit.rs diff --git a/crates/tranquil-pds/tests/email_update.rs b/crates/tranquil-pds/tests/it/email_update.rs similarity index 91% rename from crates/tranquil-pds/tests/email_update.rs rename to crates/tranquil-pds/tests/it/email_update.rs index f154178..a0d685a 100644 --- a/crates/tranquil-pds/tests/email_update.rs +++ b/crates/tranquil-pds/tests/it/email_update.rs @@ -1,11 +1,10 @@ -mod common; use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_db_traits::CommsType; use tranquil_types::Did; async fn get_email_update_token(did: &str) -> String { - let repos = common::get_test_repos().await; + let repos = crate::common::get_test_repos().await; let parsed_did = Did::new(did.to_string()).unwrap(); let user = repos .user @@ -60,14 +59,14 @@ async fn create_verified_account( assert_eq!(res.status(), StatusCode::OK); let body: Value = res.json().await.expect("Invalid JSON"); let did = body["did"].as_str().expect("No did").to_string(); - let jwt = common::verify_new_account(client, &did).await; + let jwt = crate::common::verify_new_account(client, &did).await; (jwt, did) } #[tokio::test] async fn test_request_email_update_returns_token_required() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let handle = format!("er{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@nel.pet", handle); let (access_jwt, _) = create_verified_account(&client, base_url, &handle, &email).await; @@ -88,9 +87,9 @@ async fn test_request_email_update_returns_token_required() { #[tokio::test] async fn test_update_email_flow_success() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle = format!("eu{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@nel.pet", handle); let (access_jwt, did) = create_verified_account(&client, base_url, &handle, &email).await; @@ -136,8 +135,8 @@ async fn test_update_email_flow_success() { #[tokio::test] async fn test_update_email_requires_token_when_verified() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let handle = format!("ed{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@nel.pet", handle); let (access_jwt, _) = create_verified_account(&client, base_url, &handle, &email).await; @@ -157,8 +156,8 @@ async fn test_update_email_requires_token_when_verified() { #[tokio::test] async fn test_update_email_same_email_noop() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let handle = format!("es{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@nel.pet", handle); let (access_jwt, _) = create_verified_account(&client, base_url, &handle, &email).await; @@ -179,8 +178,8 @@ async fn test_update_email_same_email_noop() { #[tokio::test] async fn test_update_email_invalid_token() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let handle = format!("eb{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@nel.pet", handle); let (access_jwt, _) = create_verified_account(&client, base_url, &handle, &email).await; @@ -214,8 +213,8 @@ async fn test_update_email_invalid_token() { #[tokio::test] async fn test_update_email_no_auth() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!("{}/xrpc/com.atproto.server.updateEmail", base_url)) @@ -230,8 +229,8 @@ async fn test_update_email_no_auth() { #[tokio::test] async fn test_update_email_invalid_format() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let handle = format!("ef{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@nel.pet", handle); let (access_jwt, _) = create_verified_account(&client, base_url, &handle, &email).await; @@ -248,9 +247,9 @@ async fn test_update_email_invalid_format() { #[tokio::test] async fn test_confirm_email_confirms_existing_email() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle = format!("ec{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@nel.pet", handle); @@ -323,9 +322,9 @@ async fn test_confirm_email_confirms_existing_email() { #[tokio::test] async fn test_confirm_email_rejects_wrong_email() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle = format!("ew{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@jola.dev", handle); @@ -391,8 +390,8 @@ async fn test_confirm_email_rejects_wrong_email() { #[tokio::test] async fn test_confirm_email_invalid_token() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let handle = format!("ei{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@jola.dev", handle); @@ -433,9 +432,9 @@ async fn test_confirm_email_invalid_token() { #[tokio::test] async fn test_unverified_account_can_update_email_without_token() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle = format!("ev{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@nel.pet", handle); @@ -503,9 +502,9 @@ async fn test_unverified_account_can_update_email_without_token() { #[tokio::test] async fn test_update_email_to_same_as_another_user_allowed() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle1 = format!("d1{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email1 = format!("{}@jola.dev", handle1); @@ -557,8 +556,8 @@ async fn test_update_email_to_same_as_another_user_allowed() { #[tokio::test] async fn test_check_email_in_use_distinguishes_empty_from_invalid() { - let client = common::client(); - let base = common::base_url().await; + let client = crate::common::client(); + let base = crate::common::base_url().await; let resp = client .post(format!("{}/xrpc/_account.checkEmailInUse", base)) diff --git a/crates/tranquil-pds/tests/feed_proxy_aud.rs b/crates/tranquil-pds/tests/it/feed_proxy_aud.rs similarity index 99% rename from crates/tranquil-pds/tests/feed_proxy_aud.rs rename to crates/tranquil-pds/tests/it/feed_proxy_aud.rs index c699dfc..4482ad0 100644 --- a/crates/tranquil-pds/tests/feed_proxy_aud.rs +++ b/crates/tranquil-pds/tests/it/feed_proxy_aud.rs @@ -1,8 +1,6 @@ -mod common; - use base64::Engine; use base64::engine::general_purpose::URL_SAFE_NO_PAD; -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; use std::sync::{Arc, Mutex}; diff --git a/crates/tranquil-pds/tests/firehose_inline_blocks.rs b/crates/tranquil-pds/tests/it/firehose_inline_blocks.rs similarity index 99% rename from crates/tranquil-pds/tests/firehose_inline_blocks.rs rename to crates/tranquil-pds/tests/it/firehose_inline_blocks.rs index 6df81a4..2539386 100644 --- a/crates/tranquil-pds/tests/firehose_inline_blocks.rs +++ b/crates/tranquil-pds/tests/it/firehose_inline_blocks.rs @@ -1,11 +1,7 @@ -mod common; -mod firehose; -mod helpers; - use cid::Cid; -use common::*; -use firehose::FirehoseConsumer; -use helpers::build_car_with_signature; +use crate::common::*; +use crate::firehose::FirehoseConsumer; +use crate::helpers::build_car_with_signature; use iroh_car::CarReader; use k256::ecdsa::SigningKey; use multihash::Multihash; diff --git a/crates/tranquil-pds/tests/firehose_validation.rs b/crates/tranquil-pds/tests/it/firehose_validation.rs similarity index 99% rename from crates/tranquil-pds/tests/firehose_validation.rs rename to crates/tranquil-pds/tests/it/firehose_validation.rs index 7160c3c..858a122 100644 --- a/crates/tranquil-pds/tests/firehose_validation.rs +++ b/crates/tranquil-pds/tests/it/firehose_validation.rs @@ -1,7 +1,5 @@ -mod common; - use cid::Cid; -use common::*; +use crate::common::*; use futures::{SinkExt, stream::StreamExt}; use iroh_car::CarReader; use reqwest::StatusCode; diff --git a/crates/tranquil-pds/tests/gc_after_delete.rs b/crates/tranquil-pds/tests/it/gc_after_delete.rs similarity index 99% rename from crates/tranquil-pds/tests/gc_after_delete.rs rename to crates/tranquil-pds/tests/it/gc_after_delete.rs index 790d472..b7eb08e 100644 --- a/crates/tranquil-pds/tests/gc_after_delete.rs +++ b/crates/tranquil-pds/tests/it/gc_after_delete.rs @@ -1,8 +1,6 @@ -mod common; -mod helpers; use chrono::Utc; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_types::{Did, Nsid, Rkey}; diff --git a/crates/tranquil-pds/tests/gc_compaction_restart.rs b/crates/tranquil-pds/tests/it/gc_compaction_restart.rs similarity index 99% rename from crates/tranquil-pds/tests/gc_compaction_restart.rs rename to crates/tranquil-pds/tests/it/gc_compaction_restart.rs index 5199535..f4e85d7 100644 --- a/crates/tranquil-pds/tests/gc_compaction_restart.rs +++ b/crates/tranquil-pds/tests/it/gc_compaction_restart.rs @@ -1,7 +1,5 @@ -mod common; - use chrono::Utc; -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/identity.rs b/crates/tranquil-pds/tests/it/identity.rs similarity index 99% rename from crates/tranquil-pds/tests/identity.rs rename to crates/tranquil-pds/tests/it/identity.rs index 6e22eb3..e05652c 100644 --- a/crates/tranquil-pds/tests/identity.rs +++ b/crates/tranquil-pds/tests/it/identity.rs @@ -1,5 +1,4 @@ -mod common; -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; use wiremock::matchers::{method, path}; @@ -98,7 +97,7 @@ async fn test_create_did_web_account_and_resolve() { let did = format!("did:web:{}", mock_addr.replace(":", "%3A")); let handle = format!("wu{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let base = base_url().await; - let pds_endpoint = common::pds_endpoint(); + let pds_endpoint = crate::common::pds_endpoint(); let reserve_res = client .post(format!( @@ -220,7 +219,7 @@ async fn test_did_web_lifecycle() { let handle = format!("lc{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let did = format!("did:web:{}:u:{}", mock_addr.replace(":", "%3A"), handle); let email = format!("{}@test.com", handle); - let pds_endpoint = common::pds_endpoint(); + let pds_endpoint = crate::common::pds_endpoint(); let reserve_res = client .post(format!( diff --git a/crates/tranquil-pds/tests/image_processing.rs b/crates/tranquil-pds/tests/it/image_processing.rs similarity index 100% rename from crates/tranquil-pds/tests/image_processing.rs rename to crates/tranquil-pds/tests/it/image_processing.rs diff --git a/crates/tranquil-pds/tests/import_verification.rs b/crates/tranquil-pds/tests/it/import_verification.rs similarity index 99% rename from crates/tranquil-pds/tests/import_verification.rs rename to crates/tranquil-pds/tests/it/import_verification.rs index 19775dc..afd51b9 100644 --- a/crates/tranquil-pds/tests/import_verification.rs +++ b/crates/tranquil-pds/tests/it/import_verification.rs @@ -1,5 +1,4 @@ -mod common; -use common::*; +use crate::common::*; use iroh_car::CarHeader; use reqwest::StatusCode; use serde_json::json; diff --git a/crates/tranquil-pds/tests/invite.rs b/crates/tranquil-pds/tests/it/invite.rs similarity index 99% rename from crates/tranquil-pds/tests/invite.rs rename to crates/tranquil-pds/tests/it/invite.rs index 63d528c..c1cfc1a 100644 --- a/crates/tranquil-pds/tests/invite.rs +++ b/crates/tranquil-pds/tests/it/invite.rs @@ -1,5 +1,4 @@ -mod common; -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/invite_registration.rs b/crates/tranquil-pds/tests/it/invite_registration.rs similarity index 99% rename from crates/tranquil-pds/tests/invite_registration.rs rename to crates/tranquil-pds/tests/it/invite_registration.rs index 14fe597..3728b5c 100644 --- a/crates/tranquil-pds/tests/invite_registration.rs +++ b/crates/tranquil-pds/tests/it/invite_registration.rs @@ -1,5 +1,4 @@ -mod common; -use common::*; +use crate::common::*; use reqwest::{Client, StatusCode}; use serde_json::{Value, json}; use tranquil_pds::api::error::ApiError; diff --git a/crates/tranquil-pds/tests/jwt_security.rs b/crates/tranquil-pds/tests/it/jwt_security.rs similarity index 99% rename from crates/tranquil-pds/tests/jwt_security.rs rename to crates/tranquil-pds/tests/it/jwt_security.rs index 9decaeb..a353442 100644 --- a/crates/tranquil-pds/tests/jwt_security.rs +++ b/crates/tranquil-pds/tests/it/jwt_security.rs @@ -1,8 +1,7 @@ #![allow(unused_imports)] -mod common; +use crate::common::{base_url, client, create_account_and_login, get_test_repos}; use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; use chrono::{Duration, Utc}; -use common::{base_url, client, create_account_and_login, get_test_repos}; use k256::SecretKey; use k256::ecdsa::{Signature, SigningKey, signature::Signer}; use rand::rngs::OsRng; diff --git a/crates/tranquil-pds/tests/legacy_2fa.rs b/crates/tranquil-pds/tests/it/legacy_2fa.rs similarity index 99% rename from crates/tranquil-pds/tests/legacy_2fa.rs rename to crates/tranquil-pds/tests/it/legacy_2fa.rs index 1be5ad6..a3d4863 100644 --- a/crates/tranquil-pds/tests/legacy_2fa.rs +++ b/crates/tranquil-pds/tests/it/legacy_2fa.rs @@ -1,6 +1,4 @@ -mod common; - -use common::{base_url, client, create_account_and_login, get_test_repos, user_id_of}; +use crate::common::{base_url, client, create_account_and_login, get_test_repos, user_id_of}; use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_db_traits::{CommsChannel, CommsType}; diff --git a/crates/tranquil-pds/tests/lifecycle_record.rs b/crates/tranquil-pds/tests/it/lifecycle_record.rs similarity index 99% rename from crates/tranquil-pds/tests/lifecycle_record.rs rename to crates/tranquil-pds/tests/it/lifecycle_record.rs index b74310d..425e2b0 100644 --- a/crates/tranquil-pds/tests/lifecycle_record.rs +++ b/crates/tranquil-pds/tests/it/lifecycle_record.rs @@ -1,8 +1,6 @@ -mod common; -mod helpers; use chrono::Utc; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::{StatusCode, header}; use serde_json::{Value, json}; use std::time::Duration; diff --git a/crates/tranquil-pds/tests/lifecycle_session.rs b/crates/tranquil-pds/tests/it/lifecycle_session.rs similarity index 99% rename from crates/tranquil-pds/tests/lifecycle_session.rs rename to crates/tranquil-pds/tests/it/lifecycle_session.rs index ec46c7e..377cdfc 100644 --- a/crates/tranquil-pds/tests/lifecycle_session.rs +++ b/crates/tranquil-pds/tests/it/lifecycle_session.rs @@ -1,8 +1,6 @@ -mod common; -mod helpers; use chrono::Utc; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/lifecycle_social.rs b/crates/tranquil-pds/tests/it/lifecycle_social.rs similarity index 99% rename from crates/tranquil-pds/tests/lifecycle_social.rs rename to crates/tranquil-pds/tests/it/lifecycle_social.rs index 6e6381b..e5f495d 100644 --- a/crates/tranquil-pds/tests/lifecycle_social.rs +++ b/crates/tranquil-pds/tests/it/lifecycle_social.rs @@ -1,8 +1,6 @@ -mod common; -mod helpers; use chrono::Utc; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/it/main.rs b/crates/tranquil-pds/tests/it/main.rs new file mode 100644 index 0000000..ddc6b20 --- /dev/null +++ b/crates/tranquil-pds/tests/it/main.rs @@ -0,0 +1,85 @@ +#[path = "../common/mod.rs"] +mod common; +#[path = "../firehose/mod.rs"] +mod firehose; +#[path = "../helpers/mod.rs"] +mod helpers; +#[path = "../mst_verify/mod.rs"] +mod mst_verify; + +mod account_lifecycle; +mod account_notifications; +mod actor; +mod admin_email; +mod admin_invite; +mod admin_moderation; +mod admin_search; +mod admin_stats; +mod apple_sso_unit; +mod auth_extractor; +mod banned_words; +mod car_export_detects_corruption; +mod change_password; +mod commit_signing; +mod delete_account; +mod did_web; +mod dpop_unit; +mod email_update; +mod feed_proxy_aud; +mod firehose_inline_blocks; +mod firehose_validation; +mod gc_after_delete; +mod gc_compaction_restart; +mod identity; +mod image_processing; +mod import_verification; +mod invite; +mod invite_registration; +mod jwt_security; +mod legacy_2fa; +mod lifecycle_record; +mod lifecycle_session; +mod lifecycle_social; +mod moderation; +mod mst_diff_equivalence; +mod mst_firehose_e2e; +mod mst_inductive_firehose; +mod mst_integrity; +mod mst_property_fuzz; +mod mst_repair_audit; +mod mst_repair_durability; +mod mst_structural_repair; +mod notifications; +mod oauth; +mod oauth_lifecycle; +mod oauth_permission_sets; +mod oauth_scopes; +mod oauth_security; +mod oauth_token_eviction; +mod password_reset; +mod plc_operations; +mod plc_validation; +mod rate_limit; +mod record_validation; +mod repair_leaf_loss; +mod repo_batch; +mod repo_blob; +mod repo_conformance; +mod repo_lifecycle; +mod ripple_cluster; +mod scope_edge_cases; +mod security_fixes; +mod server; +mod session_management; +mod shutdown_unit; +mod signing_key; +mod sso; +mod store_parity; +mod sync_blob; +mod sync_conformance; +mod sync_deprecated; +mod sync_repo; +mod user_blocks_reachability; +mod validation_edge_cases; +mod verify_live_commit; +mod whole_story; diff --git a/crates/tranquil-pds/tests/moderation.rs b/crates/tranquil-pds/tests/it/moderation.rs similarity index 99% rename from crates/tranquil-pds/tests/moderation.rs rename to crates/tranquil-pds/tests/it/moderation.rs index 9d50f35..62958e2 100644 --- a/crates/tranquil-pds/tests/moderation.rs +++ b/crates/tranquil-pds/tests/it/moderation.rs @@ -1,7 +1,5 @@ -mod common; -mod helpers; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/mst_diff_equivalence.rs b/crates/tranquil-pds/tests/it/mst_diff_equivalence.rs similarity index 100% rename from crates/tranquil-pds/tests/mst_diff_equivalence.rs rename to crates/tranquil-pds/tests/it/mst_diff_equivalence.rs diff --git a/crates/tranquil-pds/tests/mst_firehose_e2e.rs b/crates/tranquil-pds/tests/it/mst_firehose_e2e.rs similarity index 98% rename from crates/tranquil-pds/tests/mst_firehose_e2e.rs rename to crates/tranquil-pds/tests/it/mst_firehose_e2e.rs index 467dd19..5e746b1 100644 --- a/crates/tranquil-pds/tests/mst_firehose_e2e.rs +++ b/crates/tranquil-pds/tests/it/mst_firehose_e2e.rs @@ -1,6 +1,3 @@ -mod common; -mod firehose; - use std::collections::BTreeMap; use std::io::Cursor; use std::str::FromStr; @@ -9,8 +6,8 @@ use std::time::Duration; use bytes::Bytes; use cid::Cid; -use common::*; -use firehose::{FirehoseConsumer, ParsedCommitFrame}; +use crate::common::*; +use crate::firehose::{FirehoseConsumer, ParsedCommitFrame}; use iroh_car::CarReader; use jacquard_common::smol_str::SmolStr; use jacquard_repo::commit::Commit; @@ -31,7 +28,7 @@ async fn car_to_blocks(car_bytes: &[u8]) -> BTreeMap { blocks } -fn op_to_verified(op: &firehose::ParsedRepoOp) -> Result { +fn op_to_verified(op: &crate::firehose::ParsedRepoOp) -> Result { let key = SmolStr::new(&op.path); match op.action { RepoAction::Create => { diff --git a/crates/tranquil-pds/tests/mst_inductive_firehose.rs b/crates/tranquil-pds/tests/it/mst_inductive_firehose.rs similarity index 99% rename from crates/tranquil-pds/tests/mst_inductive_firehose.rs rename to crates/tranquil-pds/tests/it/mst_inductive_firehose.rs index b88dfa4..b93b520 100644 --- a/crates/tranquil-pds/tests/mst_inductive_firehose.rs +++ b/crates/tranquil-pds/tests/it/mst_inductive_firehose.rs @@ -1,17 +1,14 @@ -mod common; -mod mst_verify; - use std::collections::BTreeMap; use std::str::FromStr; use std::sync::Arc; use cid::Cid; -use common::*; +use crate::common::*; use jacquard_common::smol_str::SmolStr; use jacquard_repo::commit::Commit; use jacquard_repo::mst::{Mst, VerifiedWriteOp}; use jacquard_repo::storage::{BlockStore, MemoryBlockStore}; -use mst_verify::{extract_event_blocks, inline_to_store}; +use crate::mst_verify::{extract_event_blocks, inline_to_store}; use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_db_traits::{RepoEventType, SequenceNumber, SequencedEvent}; diff --git a/crates/tranquil-pds/tests/mst_integrity.rs b/crates/tranquil-pds/tests/it/mst_integrity.rs similarity index 98% rename from crates/tranquil-pds/tests/mst_integrity.rs rename to crates/tranquil-pds/tests/it/mst_integrity.rs index 171da9e..d956dd5 100644 --- a/crates/tranquil-pds/tests/mst_integrity.rs +++ b/crates/tranquil-pds/tests/it/mst_integrity.rs @@ -1,7 +1,3 @@ -mod common; -mod firehose; -mod helpers; - use std::collections::BTreeMap; use std::io::Cursor; use std::sync::Arc; @@ -9,9 +5,9 @@ use std::time::Duration; use bytes::Bytes; use cid::Cid; -use common::*; -use firehose::FirehoseConsumer; -use helpers::build_car_with_signature; +use crate::common::*; +use crate::firehose::FirehoseConsumer; +use crate::helpers::build_car_with_signature; use iroh_car::CarReader; use jacquard_repo::commit::Commit; use jacquard_repo::mst::Mst; diff --git a/crates/tranquil-pds/tests/mst_property_fuzz.rs b/crates/tranquil-pds/tests/it/mst_property_fuzz.rs similarity index 99% rename from crates/tranquil-pds/tests/mst_property_fuzz.rs rename to crates/tranquil-pds/tests/it/mst_property_fuzz.rs index 0ba9f9f..05285b8 100644 --- a/crates/tranquil-pds/tests/mst_property_fuzz.rs +++ b/crates/tranquil-pds/tests/it/mst_property_fuzz.rs @@ -1,16 +1,13 @@ -mod common; -mod mst_verify; - use std::collections::HashMap; use std::str::FromStr; use cid::Cid; -use common::*; +use crate::common::*; use jacquard_common::smol_str::SmolStr; use jacquard_repo::commit::Commit; use jacquard_repo::mst::{Mst, VerifiedWriteOp}; use jacquard_repo::storage::BlockStore; -use mst_verify::{extract_event_blocks, inline_to_store}; +use crate::mst_verify::{extract_event_blocks, inline_to_store}; use rand::rngs::StdRng; use rand::{Rng, SeedableRng}; use reqwest::StatusCode; diff --git a/crates/tranquil-pds/tests/mst_repair_audit.rs b/crates/tranquil-pds/tests/it/mst_repair_audit.rs similarity index 100% rename from crates/tranquil-pds/tests/mst_repair_audit.rs rename to crates/tranquil-pds/tests/it/mst_repair_audit.rs diff --git a/crates/tranquil-pds/tests/mst_repair_durability.rs b/crates/tranquil-pds/tests/it/mst_repair_durability.rs similarity index 100% rename from crates/tranquil-pds/tests/mst_repair_durability.rs rename to crates/tranquil-pds/tests/it/mst_repair_durability.rs diff --git a/crates/tranquil-pds/tests/mst_structural_repair.rs b/crates/tranquil-pds/tests/it/mst_structural_repair.rs similarity index 100% rename from crates/tranquil-pds/tests/mst_structural_repair.rs rename to crates/tranquil-pds/tests/it/mst_structural_repair.rs diff --git a/crates/tranquil-pds/tests/notifications.rs b/crates/tranquil-pds/tests/it/notifications.rs similarity index 80% rename from crates/tranquil-pds/tests/notifications.rs rename to crates/tranquil-pds/tests/it/notifications.rs index 3a18b79..405b5ce 100644 --- a/crates/tranquil-pds/tests/notifications.rs +++ b/crates/tranquil-pds/tests/it/notifications.rs @@ -1,12 +1,11 @@ -mod common; use tranquil_db_traits::{CommsChannel, CommsStatus, CommsType}; use tranquil_types::{Did, Recipient}; #[tokio::test] async fn test_enqueue_comms() { - let repos = common::get_test_repos().await; - let (_, did) = common::create_account_and_login(&common::client()).await; - let user_id = common::user_id_of(repos, &Did::new(did).unwrap()).await; + let repos = crate::common::get_test_repos().await; + let (_, did) = crate::common::create_account_and_login(&crate::common::client()).await; + let user_id = crate::common::user_id_of(repos, &Did::new(did).unwrap()).await; repos .infra .enqueue_comms( @@ -36,9 +35,9 @@ async fn test_enqueue_comms() { #[tokio::test] async fn test_comms_queue_status_index() { - let repos = common::get_test_repos().await; - let (_, did) = common::create_account_and_login(&common::client()).await; - let user_id = common::user_id_of(repos, &Did::new(did).unwrap()).await; + let repos = crate::common::get_test_repos().await; + let (_, did) = crate::common::create_account_and_login(&crate::common::client()).await; + let user_id = crate::common::user_id_of(repos, &Did::new(did).unwrap()).await; let initial_count = repos .infra .count_comms_by_type(user_id, CommsType::PasswordReset) diff --git a/crates/tranquil-pds/tests/oauth.rs b/crates/tranquil-pds/tests/it/oauth.rs similarity index 99% rename from crates/tranquil-pds/tests/oauth.rs rename to crates/tranquil-pds/tests/it/oauth.rs index 8c179d3..7160c16 100644 --- a/crates/tranquil-pds/tests/oauth.rs +++ b/crates/tranquil-pds/tests/it/oauth.rs @@ -1,8 +1,6 @@ -mod common; -mod helpers; use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; -use common::{base_url, client, get_test_repos}; -use helpers::verify_new_account; +use crate::common::{base_url, client, get_test_repos}; +use crate::helpers::verify_new_account; use reqwest::{StatusCode, redirect}; use serde_json::{Value, json}; use sha2::{Digest, Sha256}; diff --git a/crates/tranquil-pds/tests/oauth_lifecycle.rs b/crates/tranquil-pds/tests/it/oauth_lifecycle.rs similarity index 99% rename from crates/tranquil-pds/tests/oauth_lifecycle.rs rename to crates/tranquil-pds/tests/it/oauth_lifecycle.rs index 4f10ad5..820d854 100644 --- a/crates/tranquil-pds/tests/oauth_lifecycle.rs +++ b/crates/tranquil-pds/tests/it/oauth_lifecycle.rs @@ -1,10 +1,7 @@ -mod common; -mod helpers; - use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; use chrono::Utc; -use common::{base_url, client}; -use helpers::verify_new_account; +use crate::common::{base_url, client}; +use crate::helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; use sha2::{Digest, Sha256}; diff --git a/crates/tranquil-pds/tests/oauth_permission_sets.rs b/crates/tranquil-pds/tests/it/oauth_permission_sets.rs similarity index 99% rename from crates/tranquil-pds/tests/oauth_permission_sets.rs rename to crates/tranquil-pds/tests/it/oauth_permission_sets.rs index 168f470..4c82f69 100644 --- a/crates/tranquil-pds/tests/oauth_permission_sets.rs +++ b/crates/tranquil-pds/tests/it/oauth_permission_sets.rs @@ -1,10 +1,7 @@ -mod common; -mod helpers; - use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; use chrono::Utc; -use common::{base_url, client, create_account_and_login}; -use helpers::verify_new_account; +use crate::common::{base_url, client, create_account_and_login}; +use crate::helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; use sha2::{Digest, Sha256}; @@ -59,7 +56,7 @@ async fn setup_mock_client_metadata(redirect_uri: &str) -> MockServer { } async fn seed_permission_set(nsid: &str, granular_scope: &str) { - let state = common::get_test_app_state().await; + let state = crate::common::get_test_app_state().await; let key = tranquil_pds::cache_keys::permission_set_key( &tranquil_types::Nsid::new(nsid).unwrap(), None, @@ -597,7 +594,7 @@ async fn test_grant_row_keeps_include_jwt_carries_expanded() { ); let token_id = token_id_from_jwt(&session.access_token); - let token_data = common::get_test_repos() + let token_data = crate::common::get_test_repos() .await .oauth .get_token_by_id(&token_id) @@ -916,7 +913,7 @@ async fn test_consent_post_errors_when_set_unresolvable() { "Consent GET should succeed" ); - let state = common::get_test_app_state().await; + let state = crate::common::get_test_app_state().await; let key = tranquil_pds::cache_keys::permission_set_key( &tranquil_types::Nsid::new(UNRESOLVABLE_NSID).unwrap(), None, @@ -1211,7 +1208,7 @@ async fn test_consent_remember_persists_set_preference() { let did: tranquil_types::Did = delegated_did.parse().expect("valid did"); let client_id_typed = tranquil_types::ClientId::new(client_id.clone()); - let stored_prefs = common::get_test_repos() + let stored_prefs = crate::common::get_test_repos() .await .oauth .get_scope_preferences(&did, &client_id_typed) @@ -1595,7 +1592,7 @@ async fn test_consent_post_drops_unpresented_scope() { let access_token = token_body["access_token"].as_str().unwrap().to_string(); let token_id = token_id_from_jwt(&access_token); - let token_data = common::get_test_repos() + let token_data = crate::common::get_test_repos() .await .oauth .get_token_by_id(&token_id) diff --git a/crates/tranquil-pds/tests/oauth_scopes.rs b/crates/tranquil-pds/tests/it/oauth_scopes.rs similarity index 99% rename from crates/tranquil-pds/tests/oauth_scopes.rs rename to crates/tranquil-pds/tests/it/oauth_scopes.rs index 179ed3a..0dc4b38 100644 --- a/crates/tranquil-pds/tests/oauth_scopes.rs +++ b/crates/tranquil-pds/tests/it/oauth_scopes.rs @@ -1,10 +1,7 @@ -mod common; -mod helpers; - use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; use chrono::Utc; -use common::{base_url, client, get_test_repos}; -use helpers::verify_new_account; +use crate::common::{base_url, client, get_test_repos}; +use crate::helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; use sha2::{Digest, Sha256}; diff --git a/crates/tranquil-pds/tests/oauth_security.rs b/crates/tranquil-pds/tests/it/oauth_security.rs similarity index 99% rename from crates/tranquil-pds/tests/oauth_security.rs rename to crates/tranquil-pds/tests/it/oauth_security.rs index 5ef4201..9d5773d 100644 --- a/crates/tranquil-pds/tests/oauth_security.rs +++ b/crates/tranquil-pds/tests/it/oauth_security.rs @@ -1,10 +1,8 @@ #![allow(unused_imports)] -mod common; -mod helpers; +use crate::common::{base_url, client, create_account_and_login}; +use crate::helpers::verify_new_account; use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; use chrono::Utc; -use common::{base_url, client, create_account_and_login}; -use helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; use sha2::{Digest, Sha256}; diff --git a/crates/tranquil-pds/tests/oauth_token_eviction.rs b/crates/tranquil-pds/tests/it/oauth_token_eviction.rs similarity index 98% rename from crates/tranquil-pds/tests/oauth_token_eviction.rs rename to crates/tranquil-pds/tests/it/oauth_token_eviction.rs index 78c47e9..e460106 100644 --- a/crates/tranquil-pds/tests/oauth_token_eviction.rs +++ b/crates/tranquil-pds/tests/it/oauth_token_eviction.rs @@ -1,10 +1,7 @@ -mod common; -mod helpers; - use chrono::{DateTime, Duration, Utc}; -use common::{base_url, client, get_test_repos}; +use crate::common::{base_url, client, get_test_repos}; use futures::StreamExt; -use helpers::verify_new_account; +use crate::helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_oauth::{ diff --git a/crates/tranquil-pds/tests/password_reset.rs b/crates/tranquil-pds/tests/it/password_reset.rs similarity index 91% rename from crates/tranquil-pds/tests/password_reset.rs rename to crates/tranquil-pds/tests/it/password_reset.rs index 82d9ee4..b705ab1 100644 --- a/crates/tranquil-pds/tests/password_reset.rs +++ b/crates/tranquil-pds/tests/it/password_reset.rs @@ -1,15 +1,13 @@ -mod common; -mod helpers; -use helpers::verify_new_account; +use crate::helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_db_traits::CommsType; #[tokio::test] async fn test_request_password_reset_creates_code() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle = format!("pr{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@example.com", handle); let payload = json!({ @@ -55,8 +53,8 @@ async fn test_request_password_reset_creates_code() { #[tokio::test] async fn test_request_password_reset_unknown_email_returns_ok() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.requestPasswordReset", @@ -71,9 +69,9 @@ async fn test_request_password_reset_unknown_email_returns_ok() { #[tokio::test] async fn test_reset_password_with_valid_token() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle = format!("pr2{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@example.com", handle); let old_password = "Oldpass123!"; @@ -167,8 +165,8 @@ async fn test_reset_password_with_valid_token() { #[tokio::test] async fn test_reset_password_with_invalid_token() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.resetPassword", @@ -188,9 +186,9 @@ async fn test_reset_password_with_invalid_token() { #[tokio::test] async fn test_reset_password_with_expired_token() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle = format!("pr3{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@example.com", handle); let payload = json!({ @@ -249,9 +247,9 @@ async fn test_reset_password_with_expired_token() { #[tokio::test] async fn test_reset_password_invalidates_sessions() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let handle = format!("pr4{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@example.com", handle); let payload = json!({ @@ -320,8 +318,8 @@ async fn test_reset_password_invalidates_sessions() { #[tokio::test] async fn test_request_password_reset_empty_email() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.requestPasswordReset", @@ -338,9 +336,9 @@ async fn test_request_password_reset_empty_email() { #[tokio::test] async fn test_reset_password_creates_notification() { - let repos = common::get_test_repos().await; - let client = common::client(); - let base_url = common::base_url().await; + let repos = crate::common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let handle = format!("pr5{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let email = format!("{}@example.com", handle); let payload = json!({ diff --git a/crates/tranquil-pds/tests/plc_operations.rs b/crates/tranquil-pds/tests/it/plc_operations.rs similarity index 99% rename from crates/tranquil-pds/tests/plc_operations.rs rename to crates/tranquil-pds/tests/it/plc_operations.rs index e62908c..c893e54 100644 --- a/crates/tranquil-pds/tests/plc_operations.rs +++ b/crates/tranquil-pds/tests/it/plc_operations.rs @@ -1,5 +1,4 @@ -mod common; -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::json; use tranquil_types::Did; diff --git a/crates/tranquil-pds/tests/plc_validation.rs b/crates/tranquil-pds/tests/it/plc_validation.rs similarity index 100% rename from crates/tranquil-pds/tests/plc_validation.rs rename to crates/tranquil-pds/tests/it/plc_validation.rs diff --git a/crates/tranquil-pds/tests/rate_limit.rs b/crates/tranquil-pds/tests/it/rate_limit.rs similarity index 99% rename from crates/tranquil-pds/tests/rate_limit.rs rename to crates/tranquil-pds/tests/it/rate_limit.rs index a3ace16..e105bdf 100644 --- a/crates/tranquil-pds/tests/rate_limit.rs +++ b/crates/tranquil-pds/tests/it/rate_limit.rs @@ -1,5 +1,4 @@ -mod common; -use common::{base_url, client}; +use crate::common::{base_url, client}; use reqwest::StatusCode; use serde_json::json; diff --git a/crates/tranquil-pds/tests/record_validation.rs b/crates/tranquil-pds/tests/it/record_validation.rs similarity index 100% rename from crates/tranquil-pds/tests/record_validation.rs rename to crates/tranquil-pds/tests/it/record_validation.rs diff --git a/crates/tranquil-pds/tests/repair_leaf_loss.rs b/crates/tranquil-pds/tests/it/repair_leaf_loss.rs similarity index 98% rename from crates/tranquil-pds/tests/repair_leaf_loss.rs rename to crates/tranquil-pds/tests/it/repair_leaf_loss.rs index 493e86f..915570d 100644 --- a/crates/tranquil-pds/tests/repair_leaf_loss.rs +++ b/crates/tranquil-pds/tests/it/repair_leaf_loss.rs @@ -1,9 +1,6 @@ -mod common; -mod helpers; - use cid::Cid; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use jacquard_repo::commit::Commit; use jacquard_repo::storage::BlockStore; use serde_json::json; diff --git a/crates/tranquil-pds/tests/repo_batch.rs b/crates/tranquil-pds/tests/it/repo_batch.rs similarity index 99% rename from crates/tranquil-pds/tests/repo_batch.rs rename to crates/tranquil-pds/tests/it/repo_batch.rs index b003a2c..9a36eda 100644 --- a/crates/tranquil-pds/tests/repo_batch.rs +++ b/crates/tranquil-pds/tests/it/repo_batch.rs @@ -1,6 +1,5 @@ -mod common; use chrono::Utc; -use common::*; +use crate::common::*; use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_db_traits::{Backlink, BacklinkPath}; diff --git a/crates/tranquil-pds/tests/repo_blob.rs b/crates/tranquil-pds/tests/it/repo_blob.rs similarity index 99% rename from crates/tranquil-pds/tests/repo_blob.rs rename to crates/tranquil-pds/tests/it/repo_blob.rs index fdbe5e0..16b080d 100644 --- a/crates/tranquil-pds/tests/repo_blob.rs +++ b/crates/tranquil-pds/tests/it/repo_blob.rs @@ -1,5 +1,4 @@ -mod common; -use common::*; +use crate::common::*; use reqwest::{StatusCode, header}; use serde_json::Value; diff --git a/crates/tranquil-pds/tests/repo_conformance.rs b/crates/tranquil-pds/tests/it/repo_conformance.rs similarity index 99% rename from crates/tranquil-pds/tests/repo_conformance.rs rename to crates/tranquil-pds/tests/it/repo_conformance.rs index 9a05e56..84472c5 100644 --- a/crates/tranquil-pds/tests/repo_conformance.rs +++ b/crates/tranquil-pds/tests/it/repo_conformance.rs @@ -1,8 +1,6 @@ -mod common; -mod helpers; use chrono::Utc; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/repo_lifecycle.rs b/crates/tranquil-pds/tests/it/repo_lifecycle.rs similarity index 99% rename from crates/tranquil-pds/tests/repo_lifecycle.rs rename to crates/tranquil-pds/tests/it/repo_lifecycle.rs index 899e40b..a0ec7b4 100644 --- a/crates/tranquil-pds/tests/repo_lifecycle.rs +++ b/crates/tranquil-pds/tests/it/repo_lifecycle.rs @@ -1,9 +1,6 @@ -mod common; -mod firehose; - +use crate::common::*; +use crate::firehose::{FirehoseConsumer, ParsedCommitFrame}; use cid::Cid; -use common::*; -use firehose::{FirehoseConsumer, ParsedCommitFrame}; use iroh_car::CarReader; use jacquard_repo::commit::Commit; use reqwest::StatusCode; @@ -12,8 +9,6 @@ use std::io::Cursor; use std::str::FromStr; use tranquil_scopes::RepoAction; -mod helpers; - async fn create_post_record(client: &reqwest::Client, token: &str, did: &str, text: &str) -> Value { let payload = json!({ "repo": did, @@ -384,7 +379,7 @@ async fn test_firehose_commit_signature_verification() { let client = client(); let (token, did) = create_account_and_login(&client).await; - let key_bytes = helpers::get_user_signing_key(&did) + let key_bytes = crate::helpers::get_user_signing_key(&did) .await .expect("Failed to get signing key"); let signing_key = diff --git a/crates/tranquil-pds/tests/ripple_cluster.rs b/crates/tranquil-pds/tests/it/ripple_cluster.rs similarity index 95% rename from crates/tranquil-pds/tests/ripple_cluster.rs rename to crates/tranquil-pds/tests/it/ripple_cluster.rs index aabc991..5280020 100644 --- a/crates/tranquil-pds/tests/ripple_cluster.rs +++ b/crates/tranquil-pds/tests/it/ripple_cluster.rs @@ -1,5 +1,3 @@ -mod common; - use reqwest::StatusCode; use serde_json::json; use std::sync::Arc; @@ -25,14 +23,14 @@ where } } -fn cache_for(nodes: &[common::ServerInstance], idx: usize) -> Arc { +fn cache_for(nodes: &[crate::common::ServerInstance], idx: usize) -> Arc { nodes[idx] .cache .clone() .unwrap_or_else(|| panic!("node {idx} should have a cache")) } -fn rl_for(nodes: &[common::ServerInstance], idx: usize) -> Arc { +fn rl_for(nodes: &[crate::common::ServerInstance], idx: usize) -> Arc { nodes[idx] .distributed_rate_limiter .clone() @@ -41,10 +39,10 @@ fn rl_for(nodes: &[common::ServerInstance], idx: usize) -> Arc= 3, "expected at least 3 cluster nodes"); - let client = common::client(); + let client = crate::common::client(); let results: Vec<_> = futures::future::join_all(nodes.iter().map(|node| { let client = client.clone(); let url = node.url.clone(); @@ -71,8 +69,8 @@ async fn cluster_formation() { #[tokio::test] async fn cluster_any_node_access() { - let nodes = common::cluster().await; - let client = common::client(); + let nodes = crate::common::cluster().await; + let client = crate::common::client(); let handle = format!("u{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let payload = serde_json::json!({ @@ -97,7 +95,7 @@ async fn cluster_any_node_access() { .expect("no accessJwt") .to_string(); - let repos = common::get_test_repos().await; + let repos = crate::common::get_test_repos().await; let user = repos .user .get_by_did(&tranquil_types::Did::new(did.clone()).unwrap()) @@ -176,7 +174,7 @@ async fn cluster_any_node_access() { #[tokio::test] async fn cache_convergence() { - let nodes = common::cluster().await; + let nodes = crate::common::cluster().await; let cache_a = nodes[0].cache.as_ref().expect("node 0 should have a cache"); let cache_b = nodes[1].cache.as_ref().expect("node 1 should have a cache"); @@ -218,7 +216,7 @@ async fn cache_convergence() { #[tokio::test] async fn rate_limit_convergence() { - let nodes = common::cluster().await; + let nodes = crate::common::cluster().await; let rl_a = nodes[0] .distributed_rate_limiter @@ -274,7 +272,7 @@ async fn rate_limit_convergence() { #[tokio::test] async fn delete_convergence() { - let nodes = common::cluster().await; + let nodes = crate::common::cluster().await; let cache_0 = cache_for(nodes, 0); let cache_1 = cache_for(nodes, 1); @@ -308,7 +306,7 @@ async fn delete_convergence() { #[tokio::test] async fn three_node_transitive_convergence() { - let nodes = common::cluster().await; + let nodes = crate::common::cluster().await; let cache_0 = cache_for(nodes, 0); let cache_2 = cache_for(nodes, 2); @@ -331,7 +329,7 @@ async fn three_node_transitive_convergence() { #[tokio::test] async fn cluster_overwrite_conflict_resolution() { - let nodes = common::cluster().await; + let nodes = crate::common::cluster().await; let cache_0 = cache_for(nodes, 0); let cache_1 = cache_for(nodes, 1); let cache_2 = cache_for(nodes, 2); @@ -374,7 +372,7 @@ async fn cluster_overwrite_conflict_resolution() { #[tokio::test] async fn cluster_bulk_key_convergence() { - let nodes = common::cluster().await; + let nodes = crate::common::cluster().await; let cache_0 = cache_for(nodes, 0); let cache_1 = cache_for(nodes, 1); let cache_2 = cache_for(nodes, 2); @@ -433,7 +431,7 @@ async fn cluster_bulk_key_convergence() { #[tokio::test] async fn cluster_concurrent_multi_node_writes() { - let nodes = common::cluster().await; + let nodes = crate::common::cluster().await; let cache_0 = cache_for(nodes, 0); let cache_1 = cache_for(nodes, 1); let cache_2 = cache_for(nodes, 2); @@ -542,7 +540,7 @@ async fn cluster_concurrent_multi_node_writes() { #[tokio::test] async fn cluster_rate_limit_multi_node_convergence() { - let nodes = common::cluster().await; + let nodes = crate::common::cluster().await; let rl_0 = rl_for(nodes, 0); let rl_1 = rl_for(nodes, 1); let rl_2 = rl_for(nodes, 2); @@ -632,7 +630,7 @@ fn create_account_on_node<'a>( .expect("no accessJwt") .to_string(); - let repos = common::get_test_repos().await; + let repos = crate::common::get_test_repos().await; let user = repos .user .get_by_did(&tranquil_types::Did::new(did.clone()).unwrap()) @@ -690,8 +688,8 @@ fn create_account_on_node<'a>( #[tokio::test] async fn cross_node_rate_limit_via_login() { - let nodes = common::cluster().await; - let client = common::client(); + let nodes = crate::common::cluster().await; + let client = crate::common::client(); let now_ms = u64::try_from( std::time::SystemTime::now() @@ -772,8 +770,8 @@ async fn cross_node_rate_limit_via_login() { #[tokio::test] async fn cross_node_handle_resolution_from_cache() { - let nodes = common::cluster().await; - let client = common::client(); + let nodes = crate::common::cluster().await; + let client = crate::common::client(); let cache_0 = cache_for(nodes, 0); let fake_handle = format!("cached-{}.test", uuid::Uuid::new_v4().simple()); @@ -825,8 +823,8 @@ async fn cross_node_handle_resolution_from_cache() { #[tokio::test] async fn cross_node_cache_delete_observable_via_http() { - let nodes = common::cluster().await; - let client = common::client(); + let nodes = crate::common::cluster().await; + let client = crate::common::client(); let cache_0 = cache_for(nodes, 0); let cache_1 = cache_for(nodes, 1); @@ -892,8 +890,8 @@ async fn cross_node_cache_delete_observable_via_http() { #[tokio::test] async fn cross_node_email_update_status() { - let nodes = common::cluster().await; - let client = common::client(); + let nodes = crate::common::cluster().await; + let client = crate::common::client(); let cache_0 = cache_for(nodes, 0); let cache_1 = cache_for(nodes, 1); @@ -967,8 +965,8 @@ async fn cross_node_email_update_status() { #[tokio::test] async fn cross_node_session_revocation() { - let nodes = common::cluster().await; - let client = common::client(); + let nodes = crate::common::cluster().await; + let client = crate::common::client(); let (token, _did) = create_account_on_node(&client, &nodes[0].url).await; diff --git a/crates/tranquil-pds/tests/scope_edge_cases.rs b/crates/tranquil-pds/tests/it/scope_edge_cases.rs similarity index 100% rename from crates/tranquil-pds/tests/scope_edge_cases.rs rename to crates/tranquil-pds/tests/it/scope_edge_cases.rs diff --git a/crates/tranquil-pds/tests/security_fixes.rs b/crates/tranquil-pds/tests/it/security_fixes.rs similarity index 98% rename from crates/tranquil-pds/tests/security_fixes.rs rename to crates/tranquil-pds/tests/it/security_fixes.rs index 618c654..aa24f38 100644 --- a/crates/tranquil-pds/tests/security_fixes.rs +++ b/crates/tranquil-pds/tests/it/security_fixes.rs @@ -1,4 +1,3 @@ -mod common; use tranquil_pds::comms::{SendError, is_valid_phone_number}; use tranquil_pds::image::{ImageError, ImageProcessor}; @@ -84,7 +83,7 @@ fn test_send_error_display() { #[tokio::test] async fn test_signup_queue_authentication() { - use common::{base_url, client, create_account_and_login}; + use crate::common::{base_url, client, create_account_and_login}; let base = base_url().await; let http_client = client(); diff --git a/crates/tranquil-pds/tests/server.rs b/crates/tranquil-pds/tests/it/server.rs similarity index 99% rename from crates/tranquil-pds/tests/server.rs rename to crates/tranquil-pds/tests/it/server.rs index 4951705..09fbe14 100644 --- a/crates/tranquil-pds/tests/server.rs +++ b/crates/tranquil-pds/tests/it/server.rs @@ -1,7 +1,5 @@ -mod common; -mod helpers; -use common::*; -use helpers::verify_new_account; +use crate::common::*; +use crate::helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/session_management.rs b/crates/tranquil-pds/tests/it/session_management.rs similarity index 99% rename from crates/tranquil-pds/tests/session_management.rs rename to crates/tranquil-pds/tests/it/session_management.rs index 85cb647..8496136 100644 --- a/crates/tranquil-pds/tests/session_management.rs +++ b/crates/tranquil-pds/tests/it/session_management.rs @@ -1,7 +1,5 @@ -mod common; -mod helpers; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/shutdown_unit.rs b/crates/tranquil-pds/tests/it/shutdown_unit.rs similarity index 100% rename from crates/tranquil-pds/tests/shutdown_unit.rs rename to crates/tranquil-pds/tests/it/shutdown_unit.rs diff --git a/crates/tranquil-pds/tests/signing_key.rs b/crates/tranquil-pds/tests/it/signing_key.rs similarity index 90% rename from crates/tranquil-pds/tests/signing_key.rs rename to crates/tranquil-pds/tests/it/signing_key.rs index e87cd21..06c0eb0 100644 --- a/crates/tranquil-pds/tests/signing_key.rs +++ b/crates/tranquil-pds/tests/it/signing_key.rs @@ -1,13 +1,11 @@ -mod common; -mod helpers; -use helpers::verify_new_account; +use crate::helpers::verify_new_account; use reqwest::StatusCode; use serde_json::{Value, json}; #[tokio::test] async fn test_reserve_signing_key_without_did() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.reserveSigningKey", @@ -29,9 +27,9 @@ async fn test_reserve_signing_key_without_did() { #[tokio::test] async fn test_reserve_signing_key_with_did() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let target_did = "did:plc:test123456"; let res = client .post(format!( @@ -60,9 +58,9 @@ async fn test_reserve_signing_key_with_did() { #[tokio::test] async fn test_reserve_signing_key_stores_private_key() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.reserveSigningKey", @@ -100,8 +98,8 @@ async fn test_reserve_signing_key_stores_private_key() { #[tokio::test] async fn test_reserve_signing_key_unique_keys() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res1 = client .post(format!( "{}/xrpc/com.atproto.server.reserveSigningKey", @@ -131,8 +129,8 @@ async fn test_reserve_signing_key_unique_keys() { #[tokio::test] async fn test_reserve_signing_key_is_public() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.reserveSigningKey", @@ -151,9 +149,9 @@ async fn test_reserve_signing_key_is_public() { #[tokio::test] async fn test_create_account_with_reserved_signing_key() { - let client = common::client(); - let base_url = common::base_url().await; - let repos = common::get_test_repos().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; + let repos = crate::common::get_test_repos().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.reserveSigningKey", @@ -203,8 +201,8 @@ async fn test_create_account_with_reserved_signing_key() { #[tokio::test] async fn test_create_account_with_invalid_signing_key() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let handle = format!("bk{}", &uuid::Uuid::new_v4().simple().to_string()[..12]); let res = client .post(format!( @@ -227,8 +225,8 @@ async fn test_create_account_with_invalid_signing_key() { #[tokio::test] async fn test_create_account_cannot_reuse_signing_key() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.reserveSigningKey", @@ -280,8 +278,8 @@ async fn test_create_account_cannot_reuse_signing_key() { #[tokio::test] async fn test_reserved_key_tokens_work() { - let client = common::client(); - let base_url = common::base_url().await; + let client = crate::common::client(); + let base_url = crate::common::base_url().await; let res = client .post(format!( "{}/xrpc/com.atproto.server.reserveSigningKey", diff --git a/crates/tranquil-pds/tests/sso.rs b/crates/tranquil-pds/tests/it/sso.rs similarity index 99% rename from crates/tranquil-pds/tests/sso.rs rename to crates/tranquil-pds/tests/it/sso.rs index 9437778..8844b49 100644 --- a/crates/tranquil-pds/tests/sso.rs +++ b/crates/tranquil-pds/tests/it/sso.rs @@ -1,6 +1,4 @@ -mod common; - -use common::{base_url, client, create_account_and_login, get_test_repos}; +use crate::common::{base_url, client, create_account_and_login, get_test_repos}; use reqwest::StatusCode; use serde_json::{Value, json}; use tranquil_db_traits::{CommsChannel, CommsType, SsoAction, SsoProviderType}; diff --git a/crates/tranquil-pds/tests/store_parity.rs b/crates/tranquil-pds/tests/it/store_parity.rs similarity index 99% rename from crates/tranquil-pds/tests/store_parity.rs rename to crates/tranquil-pds/tests/it/store_parity.rs index d27f153..0a90fb5 100644 --- a/crates/tranquil-pds/tests/store_parity.rs +++ b/crates/tranquil-pds/tests/it/store_parity.rs @@ -1,6 +1,3 @@ -mod common; -mod helpers; - use std::sync::Arc; use tranquil_db::PostgresRepositories; use tranquil_db_traits::{Backlink, BacklinkPath, CommsChannel, CommsType}; @@ -85,7 +82,7 @@ async fn create_store_repos() -> Arc { } async fn create_pg_repos() -> Arc { - let db_url = common::get_db_connection_string().await; + let db_url = crate::common::get_db_connection_string().await; let pool = sqlx::postgres::PgPoolOptions::new() .max_connections(5) .connect(&db_url) @@ -117,7 +114,7 @@ fn test_handle(suffix: &str) -> Handle { } fn test_cid(seed: u8) -> CidLink { - CidLink::from_cid(&helpers::make_cid(&[seed])) + CidLink::from_cid(&crate::helpers::make_cid(&[seed])) } fn test_nsid(name: &str) -> Nsid { @@ -139,7 +136,7 @@ fn test_at_uri(did: &Did, collection: &Nsid, rkey: &Rkey) -> AtUri { } async fn seed_user(repos: &PostgresRepositories, did: &Did, handle: &Handle) -> Uuid { - let commit_cid = CidLink::from_cid(&helpers::make_cid(did.as_str().as_bytes())); + let commit_cid = CidLink::from_cid(&crate::helpers::make_cid(did.as_str().as_bytes())); let input = tranquil_db_traits::CreatePasswordAccountInput { handle: handle.clone(), email: None, @@ -1780,7 +1777,7 @@ async fn parity_prune_events_older_than() { let baseline = f.pg.repo.get_max_seq().await.unwrap(); f.pg.repo.insert_commit_event(&event).await.unwrap(); f.store.repo.insert_commit_event(&event).await.unwrap(); - let pg_seq = common::sequenced_event_for_did(&f.pg, baseline, &did) + let pg_seq = crate::common::sequenced_event_for_did(&f.pg, baseline, &did) .await .seq; diff --git a/crates/tranquil-pds/tests/sync_blob.rs b/crates/tranquil-pds/tests/it/sync_blob.rs similarity index 99% rename from crates/tranquil-pds/tests/sync_blob.rs rename to crates/tranquil-pds/tests/it/sync_blob.rs index 5c1b9d5..1c1eb5b 100644 --- a/crates/tranquil-pds/tests/sync_blob.rs +++ b/crates/tranquil-pds/tests/it/sync_blob.rs @@ -1,5 +1,4 @@ -mod common; -use common::*; +use crate::common::*; use reqwest::StatusCode; use reqwest::header; use serde_json::Value; diff --git a/crates/tranquil-pds/tests/sync_conformance.rs b/crates/tranquil-pds/tests/it/sync_conformance.rs similarity index 99% rename from crates/tranquil-pds/tests/sync_conformance.rs rename to crates/tranquil-pds/tests/it/sync_conformance.rs index 1db281f..0e437e3 100644 --- a/crates/tranquil-pds/tests/sync_conformance.rs +++ b/crates/tranquil-pds/tests/it/sync_conformance.rs @@ -1,8 +1,5 @@ -mod common; -mod helpers; - -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::Value; diff --git a/crates/tranquil-pds/tests/sync_deprecated.rs b/crates/tranquil-pds/tests/it/sync_deprecated.rs similarity index 99% rename from crates/tranquil-pds/tests/sync_deprecated.rs rename to crates/tranquil-pds/tests/it/sync_deprecated.rs index b58473f..9a6fe42 100644 --- a/crates/tranquil-pds/tests/sync_deprecated.rs +++ b/crates/tranquil-pds/tests/it/sync_deprecated.rs @@ -1,7 +1,5 @@ -mod common; -mod helpers; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::Value; diff --git a/crates/tranquil-pds/tests/sync_repo.rs b/crates/tranquil-pds/tests/it/sync_repo.rs similarity index 99% rename from crates/tranquil-pds/tests/sync_repo.rs rename to crates/tranquil-pds/tests/it/sync_repo.rs index 24ddc7f..b455bfb 100644 --- a/crates/tranquil-pds/tests/sync_repo.rs +++ b/crates/tranquil-pds/tests/it/sync_repo.rs @@ -1,7 +1,5 @@ -mod common; -mod helpers; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use reqwest::header; use serde_json::{Value, json}; diff --git a/crates/tranquil-pds/tests/user_blocks_reachability.rs b/crates/tranquil-pds/tests/it/user_blocks_reachability.rs similarity index 99% rename from crates/tranquil-pds/tests/user_blocks_reachability.rs rename to crates/tranquil-pds/tests/it/user_blocks_reachability.rs index 28175e4..e5bf4f3 100644 --- a/crates/tranquil-pds/tests/user_blocks_reachability.rs +++ b/crates/tranquil-pds/tests/it/user_blocks_reachability.rs @@ -1,8 +1,6 @@ -mod common; -mod helpers; use chrono::Utc; -use common::*; -use helpers::*; +use crate::common::*; +use crate::helpers::*; use reqwest::StatusCode; use serde_json::json; use std::sync::LazyLock; diff --git a/crates/tranquil-pds/tests/validation_edge_cases.rs b/crates/tranquil-pds/tests/it/validation_edge_cases.rs similarity index 100% rename from crates/tranquil-pds/tests/validation_edge_cases.rs rename to crates/tranquil-pds/tests/it/validation_edge_cases.rs diff --git a/crates/tranquil-pds/tests/verify_live_commit.rs b/crates/tranquil-pds/tests/it/verify_live_commit.rs similarity index 99% rename from crates/tranquil-pds/tests/verify_live_commit.rs rename to crates/tranquil-pds/tests/it/verify_live_commit.rs index 9df7965..8e0282f 100644 --- a/crates/tranquil-pds/tests/verify_live_commit.rs +++ b/crates/tranquil-pds/tests/it/verify_live_commit.rs @@ -1,7 +1,6 @@ use bytes::Bytes; use cid::Cid; use std::collections::HashMap; -mod common; #[tokio::test] #[ignore = "depends on external live server state; run manually with --ignored"] diff --git a/crates/tranquil-pds/tests/whole_story.rs b/crates/tranquil-pds/tests/it/whole_story.rs similarity index 99% rename from crates/tranquil-pds/tests/whole_story.rs rename to crates/tranquil-pds/tests/it/whole_story.rs index 58964d2..2ea9b60 100644 --- a/crates/tranquil-pds/tests/whole_story.rs +++ b/crates/tranquil-pds/tests/it/whole_story.rs @@ -1,10 +1,7 @@ -mod common; -mod helpers; - use chrono::Utc; -use common::*; +use crate::common::*; use futures::{StreamExt, future::join_all}; -use helpers::*; +use crate::helpers::*; use k256::ecdsa::SigningKey; use reqwest::{StatusCode, header}; use serde_json::{Value, json}; diff --git a/justfile b/justfile index 970e036..9d7d7af 100644 --- a/justfile +++ b/justfile @@ -96,42 +96,43 @@ test-store-asan: cargo +nightly nextest run -p tranquil-store --features tranquil-store/test-harness --target x86_64-unknown-linux-gnu test-unit: - SQLX_OFFLINE=true cargo test --test dpop_unit --test validation_edge_cases --test scope_edge_cases + SQLX_OFFLINE=true cargo test --test it -- dpop_unit:: validation_edge_cases:: scope_edge_cases:: -store_test := "SQLX_OFFLINE=true TRANQUIL_TEST_BACKEND=store TRANQUIL_PDS_ALLOW_INSECURE_SECRETS=1 DISABLE_RATE_LIMITING=1 TRANQUIL_LEXICON_OFFLINE=1 SKIP_IMPORT_VERIFICATION=true cargo nextest run --workspace --exclude tranquil-store --features tranquil-store/skip-fsync -E 'not binary(store_parity) and not (package(tranquil-signal) and test(/^tests::/))'" +store_run := "SQLX_OFFLINE=true TRANQUIL_TEST_BACKEND=store TRANQUIL_PDS_ALLOW_INSECURE_SECRETS=1 DISABLE_RATE_LIMITING=1 TRANQUIL_LEXICON_OFFLINE=1 SKIP_IMPORT_VERIFICATION=true cargo nextest run --workspace --exclude tranquil-store --features tranquil-store/skip-fsync" +store_test := store_run + " -E 'not (binary(it) and test(/^store_parity::/)) and not (package(tranquil-signal) and test(/^tests::/))'" test-auth: - {{store_test}} --test oauth --test oauth_lifecycle --test oauth_scopes --test oauth_security --test jwt_security --test session_management --test change_password --test password_reset + {{store_run}} --test it -E 'test(/^(oauth|oauth_lifecycle|oauth_scopes|oauth_security|jwt_security|session_management|change_password|password_reset)::/)' test-admin: - {{store_test}} --test admin_email --test admin_invite --test admin_moderation --test admin_search --test admin_stats + {{store_run}} --test it -E 'test(/^(admin_email|admin_invite|admin_moderation|admin_search|admin_stats)::/)' test-sync: - {{store_test}} --test sync_repo --test sync_blob --test sync_conformance --test sync_deprecated --test firehose_validation + {{store_run}} --test it -E 'test(/^(sync_repo|sync_blob|sync_conformance|sync_deprecated|firehose_validation)::/)' test-repo: - {{store_test}} --test repo_batch --test repo_blob --test record_validation --test lifecycle_record + {{store_run}} --test it -E 'test(/^(repo_batch|repo_blob|record_validation|lifecycle_record)::/)' test-identity: - {{store_test}} --test identity --test did_web --test plc_migration --test plc_operations --test plc_validation + {{store_run}} --test it --test plc_migration -E 'binary(plc_migration) | test(/^(identity|did_web|plc_operations|plc_validation)::/)' test-account: - {{store_test}} --test lifecycle_session --test delete_account --test invite --test email_update --test account_notifications + {{store_run}} --test it -E 'test(/^(lifecycle_session|delete_account|invite|email_update|account_notifications)::/)' test-security: - {{store_test}} --test security_fixes --test banned_words --test rate_limit --test moderation + {{store_run}} --test it -E 'test(/^(security_fixes|banned_words|rate_limit|moderation)::/)' test-import: - {{store_test}} --test import_verification --test import_with_verification + {{store_run}} --test it --test import_with_verification -E 'binary(import_with_verification) | test(/^import_verification::/)' test-misc: - {{store_test}} --test actor --test commit_signing --test image_processing --test lifecycle_social --test notifications --test server --test signing_key --test verify_live_commit + {{store_run}} --test it -E 'test(/^(actor|commit_signing|image_processing|lifecycle_social|notifications|server|signing_key|verify_live_commit)::/)' test *args: {{store_test}} {{args}} test-one name: - {{store_test}} --test {{name}} + {{store_run}} --test it -E 'test(/^{{name}}::/)' test-full *args: @just services-up