Skip to content

Commit 889767c

Browse files
authored
test(client-s3): increase bucket name randomness (#7468)
1 parent e8b9fd8 commit 889767c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

clients/client-s3/test/e2e/s3-bucket-features.e2e.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { S3, waitUntilBucketExists, waitUntilBucketNotExists } from "@aws-sdk/client-s3";
22
import { type GetCallerIdentityCommandOutput, STS } from "@aws-sdk/client-sts";
3-
import { afterAll, beforeAll, describe, expect, it } from "vitest";
43
import { HttpRequest } from "@smithy/types";
4+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
55

66
describe("@aws-sdk/client-s3 - Working with Buckets", () => {
77
const s3 = new S3({
@@ -20,9 +20,14 @@ describe("@aws-sdk/client-s3 - Working with Buckets", () => {
2020
});
2121

2222
function getBucketName(id: string, region = "us-west-2") {
23-
const alphabet = "abcdefghijklmnopqrstuvwxyz";
24-
const randId = Array.from({ length: 6 }, () => alphabet[(Math.random() * alphabet.length) | 0]).join("");
25-
return `${callerID.Account}-${randId}-${id}-${region}-${(Date.now() / 1000) | 0}`;
23+
const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
24+
const randId = Array.from({ length: 19 }, () => alphabet[(Math.random() * alphabet.length) | 0]).join("");
25+
26+
console.log({
27+
Bucket: `${callerID.Account}-${randId}-${id}-${region}`,
28+
});
29+
30+
return `${callerID.Account}-${randId}-${id}-${region}`;
2631
}
2732

2833
let Bucket: string;

0 commit comments

Comments
 (0)