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.
This commit is contained in:
Johanna Larsson
2026-09-24 13:09:23 +00:00
committed by Tangled
parent 0c5eda6117
commit 4eb59e4f6c
79 changed files with 345 additions and 384 deletions
+7 -7
View File
@@ -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]]
@@ -1,6 +1,4 @@
mod common;
mod helpers;
use common::*;
use crate::common::*;
use reqwest::StatusCode;
use serde_json::{Value, json};
@@ -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};
@@ -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]
@@ -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")
@@ -1,6 +1,4 @@
mod common;
use common::*;
use crate::common::*;
use reqwest::StatusCode;
use serde_json::{Value, json};
@@ -1,6 +1,4 @@
mod common;
use common::*;
use crate::common::*;
use reqwest::StatusCode;
use serde_json::{Value, json};
@@ -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;
@@ -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]
@@ -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)
@@ -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;
@@ -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};
@@ -1,7 +1,5 @@
mod common;
mod helpers;
use chrono::Utc;
use common::*;
use crate::common::*;
use reqwest::StatusCode;
use serde_json::{Value, json};
@@ -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!(
@@ -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))
@@ -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};
@@ -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;
@@ -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;
@@ -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};
@@ -1,7 +1,5 @@
mod common;
use chrono::Utc;
use common::*;
use crate::common::*;
use reqwest::StatusCode;
use serde_json::{Value, json};
@@ -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!(
@@ -1,5 +1,4 @@
mod common;
use common::*;
use crate::common::*;
use iroh_car::CarHeader;
use reqwest::StatusCode;
use serde_json::json;
@@ -1,5 +1,4 @@
mod common;
use common::*;
use crate::common::*;
use reqwest::StatusCode;
use serde_json::{Value, json};
@@ -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;
@@ -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;
@@ -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};
@@ -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;
@@ -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};
@@ -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};
+85
View File
@@ -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;
@@ -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};
@@ -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<Cid, Bytes> {
blocks
}
fn op_to_verified(op: &firehose::ParsedRepoOp) -> Result<VerifiedWriteOp, String> {
fn op_to_verified(op: &crate::firehose::ParsedRepoOp) -> Result<VerifiedWriteOp, String> {
let key = SmolStr::new(&op.path);
match op.action {
RepoAction::Create => {
@@ -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};
@@ -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;
@@ -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;
@@ -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)
@@ -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};
@@ -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};
@@ -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)
@@ -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};
@@ -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};
@@ -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::{
@@ -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!({
@@ -1,5 +1,4 @@
mod common;
use common::*;
use crate::common::*;
use reqwest::StatusCode;
use serde_json::json;
use tranquil_types::Did;
@@ -1,5 +1,4 @@
mod common;
use common::{base_url, client};
use crate::common::{base_url, client};
use reqwest::StatusCode;
use serde_json::json;
@@ -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;
@@ -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};
@@ -1,5 +1,4 @@
mod common;
use common::*;
use crate::common::*;
use reqwest::{StatusCode, header};
use serde_json::Value;
@@ -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};
@@ -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 =
@@ -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<dyn Cache> {
fn cache_for(nodes: &[crate::common::ServerInstance], idx: usize) -> Arc<dyn Cache> {
nodes[idx]
.cache
.clone()
.unwrap_or_else(|| panic!("node {idx} should have a cache"))
}
fn rl_for(nodes: &[common::ServerInstance], idx: usize) -> Arc<dyn DistributedRateLimiter> {
fn rl_for(nodes: &[crate::common::ServerInstance], idx: usize) -> Arc<dyn DistributedRateLimiter> {
nodes[idx]
.distributed_rate_limiter
.clone()
@@ -41,10 +39,10 @@ fn rl_for(nodes: &[common::ServerInstance], idx: usize) -> Arc<dyn DistributedRa
#[tokio::test]
async fn cluster_formation() {
let nodes = common::cluster().await;
let nodes = crate::common::cluster().await;
assert!(nodes.len() >= 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;
@@ -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();
@@ -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};
@@ -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};
@@ -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",
@@ -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};
@@ -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<PostgresRepositories> {
}
async fn create_pg_repos() -> Arc<PostgresRepositories> {
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;
@@ -1,5 +1,4 @@
mod common;
use common::*;
use crate::common::*;
use reqwest::StatusCode;
use reqwest::header;
use serde_json::Value;
@@ -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;
@@ -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;
@@ -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};
@@ -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;
@@ -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"]
@@ -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};
+13 -12
View File
@@ -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