@@ -15,10 +15,15 @@ describe("S3 Global Client Test", () => {
15
15
let callerID = null as unknown as GetCallerIdentityCommandOutput ;
16
16
let bucketNames = [ ] as string [ ] ;
17
17
18
+ // random element limited to 2 letters to avoid concurrent IO, and
19
+ // to limit bucket count to 676 if there is failure to delete them.
20
+ const alphabet = "abcdefghijklmnopqrstuvwxyz" ;
21
+ const randId = alphabet [ ( Math . random ( ) * alphabet . length ) | 0 ] + alphabet [ ( Math . random ( ) * alphabet . length ) | 0 ] ;
22
+
18
23
beforeAll ( async ( ) => {
19
- jest . setTimeout ( 500000 ) ;
24
+ jest . setTimeout ( 60000 ) ;
20
25
callerID = await stsClient . getCallerIdentity ( { } ) ;
21
- bucketNames = regionConfigs . map ( ( config ) => `${ callerID . Account } -redirect-${ config . region } ` ) ;
26
+ bucketNames = regionConfigs . map ( ( config ) => `${ callerID . Account } -${ randId } - redirect-${ config . region } ` ) ;
22
27
await Promise . all ( bucketNames . map ( ( bucketName , index ) => deleteBucket ( s3Clients [ index ] , bucketName ) ) ) ;
23
28
await Promise . all ( bucketNames . map ( ( bucketName , index ) => s3Clients [ index ] . createBucket ( { Bucket : bucketName } ) ) ) ;
24
29
} ) ;
@@ -35,7 +40,7 @@ describe("S3 Global Client Test", () => {
35
40
await s3Client . putObject ( { Bucket : bucketName , Key : objKey , Body : testValue } ) ;
36
41
}
37
42
}
38
- } , 50000 ) ;
43
+ } , 60000 ) ;
39
44
40
45
it ( "Should be able to get objects following region redirect" , async ( ) => {
41
46
// Fetch and assert objects
@@ -47,7 +52,7 @@ describe("S3 Global Client Test", () => {
47
52
expect ( data ) . toEqual ( testValue ) ;
48
53
}
49
54
}
50
- } , 50000 ) ;
55
+ } , 60000 ) ;
51
56
52
57
it ( "Should delete objects following region redirect" , async ( ) => {
53
58
for ( const bucketName of bucketNames ) {
@@ -56,7 +61,7 @@ describe("S3 Global Client Test", () => {
56
61
await s3Client . deleteObject ( { Bucket : bucketName , Key : objKey } ) ;
57
62
}
58
63
}
59
- } , 50000 ) ;
64
+ } , 60000 ) ;
60
65
} ) ;
61
66
62
67
async function deleteBucket ( s3 : S3 , bucketName : string ) {
0 commit comments