Skip to content

Commit 003de3f

Browse files
authored
test(middleware-sdk-s3): add waiter for s3 express e2e test (#6051)
1 parent 190768a commit 003de3f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/middleware-sdk-s3/src/s3-express/middleware-s3-express.e2e.spec.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GetObjectCommand, PutObjectCommand, S3 } from "@aws-sdk/client-s3";
1+
import { GetObjectCommand, PutObjectCommand, S3, waitUntilBucketExists } from "@aws-sdk/client-s3";
22
import { STS } from "@aws-sdk/client-sts";
33
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
44
import http from "http";
@@ -51,6 +51,10 @@ describe("s3 express CRUD test suite", () => {
5151
},
5252
},
5353
});
54+
55+
// Wait for the bucket to exist
56+
await waitUntilBucketExists({ client: s3, maxWaitTime: 120 }, { Bucket: bucketName });
57+
5458
createRecorder = JSON.parse(JSON.stringify(recorder.calls));
5559
reset();
5660

@@ -103,14 +107,17 @@ describe("s3 express CRUD test suite", () => {
103107
"CreateBucketCommand (normal)": {
104108
[bucketName]: 1,
105109
},
110+
"HeadBucketCommand (s3 express)": {
111+
[bucketName]: 1,
112+
},
113+
"CreateSessionCommand (normal)": {
114+
[bucketName]: 1,
115+
},
106116
});
107117
});
108118

109119
it("can read/write/delete from a bucket", () => {
110120
expect(readWriteDeleteRecorder).toEqual({
111-
"CreateSessionCommand (normal)": {
112-
[bucketName]: 1,
113-
},
114121
"PutObjectCommand (s3 express)": {
115122
[bucketName]: SCALE,
116123
},

0 commit comments

Comments
 (0)