From 0b4b377e6cd63e1fd164e1fbc7e2885a9104c14a Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 4 Dec 2026 17:52:05 +0000 Subject: [PATCH] Tests make the bucket once per process; the app job prints RustFS's log when it fails #217 didn't end the baselines flake: run 47389263799 (#222) still got NoSuchBucket on first uploads, after HEAD bucket had answered. Every failure was in the burst of concurrent creates as the one test binary starts, so the fixture now creates the bucket once per process (a tokio OnceCell), and a failed app job prints the store's log. --- .github/workflows/ci.yml | 3 +++ app/Cargo.toml | 2 +- app/src/testing.rs | 19 ++++++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5754a372..e9316441 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,6 +117,9 @@ jobs: - run: cargo test --locked -p visualci-app env: VISUALCI_EMAIL_SNAPSHOTS: ${{ github.workspace }}/tmp/email-snapshots + # The blob store's own account of a failed run (a bucket that went missing, a restart): RustFS logs to stdout. + - if: failure() + run: docker logs s3 2>&1 | tail -n 300 - uses: actions/upload-artifact@v4 with: name: email-snapshots diff --git a/app/Cargo.toml b/app/Cargo.toml index b9a2b636..def98c6a 100644 --- a/app/Cargo.toml +++ b/app/Cargo.toml @@ -68,7 +68,7 @@ serde_json = "1" # Names the field at fault when a visualci.yml doesn't parse (build_settings::parse_config) serde_path_to_error = "0.1" sha2 = "0.10" -tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal", "time"] } +tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal", "sync", "time"] } image = { version = "0.25", default-features = false, features = ["png", "jpeg", "webp"] } reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } rusty-s3 = "0.12" diff --git a/app/src/testing.rs b/app/src/testing.rs index 56b09165..b992c574 100644 --- a/app/src/testing.rs +++ b/app/src/testing.rs @@ -85,12 +85,21 @@ pub mod fixtures { /// # Errors /// When the store (`VISUALCI_APP_TEST_S3_ENDPOINT`, else RustFS on port 59000 as in CI) isn't reachable. pub async fn blob_store() -> laravel::Result { + // Made once per test process, not by every test: the tests in one binary start together, and a bucket many of + // them created at once on a fresh RustFS went missing under their first uploads (NoSuchBucket; #217, run + // 47389263799). + static BUCKET: tokio::sync::OnceCell<()> = tokio::sync::OnceCell::const_new(); let store = crate::storage::BlobStore::current().await?; - store.ensure_bucket().await.map_err(|e| { - laravel::Error::msg(format!( - "the blob store isn't reachable (VISUALCI_APP_TEST_S3_ENDPOINT, else RustFS on 127.0.0.1:59000 as in CI): {e}" - )) - })?; + BUCKET + .get_or_try_init(|| async { + store.ensure_bucket().await.map_err(|e| { + laravel::Error::msg(format!( + "the blob store isn't reachable (VISUALCI_APP_TEST_S3_ENDPOINT, else RustFS on 127.0.0.1:59000 as \ + in CI): {e}" + )) + }) + }) + .await?; Ok(store) }