From f2f34b31b3b049adb0d51beb60551186a744aa4d Mon Sep 17 00:00:00 2001 From: Stephan Merker Date: Wed, 9 Sep 2026 09:33:52 +0200 Subject: [PATCH] fix(s3/integration): wait for bucket visibility after ensure-storage-exists In newer AWS regions (eusc-de-east-1) a freshly created bucket may not be visible from a brand-new client connection immediately, even after the CLI's own BucketExistsWaiter returned success. The bare HeadBucket call in AssertOnStorageExists was intermittently returning 404 for that reason. Replace it with a BucketExistsWaiter (60s timeout) so the verification polls until the bucket is accessible from the test's own connection. Similar fix as in #148 --- s3/integration/assertions.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/s3/integration/assertions.go b/s3/integration/assertions.go index 967fd1d0..3b07c64b 100644 --- a/s3/integration/assertions.go +++ b/s3/integration/assertions.go @@ -291,10 +291,14 @@ func AssertOnStorageExists(s3CLIPath string, cfg *config.S3Cli) { Expect(s3CLISession.ExitCode()).To(BeZero()) // Verify the bucket now exists using the client created earlier. - _, headBucketErr := verificationClient.HeadBucket(context.TODO(), &s3.HeadBucketInput{ + // Use a waiter rather than a bare HeadBucket call: in slower/newer regions (e.g. eusc-de-east-1) + // bucket creation may not yet be visible from a fresh client connection even after the CLI's + // own BucketExistsWaiter returned success. + bucketWaiter := s3.NewBucketExistsWaiter(verificationClient) + waitErr := bucketWaiter.Wait(context.TODO(), &s3.HeadBucketInput{ Bucket: aws.String(cfgCopy.BucketName), - }) - Expect(headBucketErr).ToNot(HaveOccurred(), "Bucket should have been created by 'ensure-storage-exists'") + }, 60*time.Second) + Expect(waitErr).ToNot(HaveOccurred(), "Bucket should have been created by 'ensure-storage-exists'") // --- Scenario 2: Bucket already exists, command should still succeed (idempotency) --- s3CLISession, err = RunS3CLI(s3CLIPath, configPath, "s3", "ensure-storage-exists")