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) }