Skip to content

Commit

Permalink
test(middleware-sdk-s3): add waiter for s3 express e2e test (#6051)
Browse files Browse the repository at this point in the history
  • Loading branch information
siddsriv committed May 2, 2024
1 parent 190768a commit 003de3f
Showing 1 changed file with 11 additions and 4 deletions.
@@ -1,4 +1,4 @@
import { GetObjectCommand, PutObjectCommand, S3 } from "@aws-sdk/client-s3";
import { GetObjectCommand, PutObjectCommand, S3, waitUntilBucketExists } from "@aws-sdk/client-s3";
import { STS } from "@aws-sdk/client-sts";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import http from "http";
Expand Down Expand Up @@ -51,6 +51,10 @@ describe("s3 express CRUD test suite", () => {
},
},
});

// Wait for the bucket to exist
await waitUntilBucketExists({ client: s3, maxWaitTime: 120 }, { Bucket: bucketName });

createRecorder = JSON.parse(JSON.stringify(recorder.calls));
reset();

Expand Down Expand Up @@ -103,14 +107,17 @@ describe("s3 express CRUD test suite", () => {
"CreateBucketCommand (normal)": {
[bucketName]: 1,
},
"HeadBucketCommand (s3 express)": {
[bucketName]: 1,
},
"CreateSessionCommand (normal)": {
[bucketName]: 1,
},
});
});

it("can read/write/delete from a bucket", () => {
expect(readWriteDeleteRecorder).toEqual({
"CreateSessionCommand (normal)": {
[bucketName]: 1,
},
"PutObjectCommand (s3 express)": {
[bucketName]: SCALE,
},
Expand Down

0 comments on commit 003de3f

Please sign in to comment.