@@ -23,29 +23,41 @@ describe("@aws-sdk/lib-storage", () => {
23
23
let dataString : string ;
24
24
let Bucket : string ;
25
25
let region : string ;
26
+ let resourcesAvailable = false ;
26
27
27
28
beforeAll ( async ( ) => {
28
- const integTestResourcesEnv = await getIntegTestResources ( ) ;
29
- Object . assign ( process . env , integTestResourcesEnv ) ;
30
-
31
- region = process ?. env ?. AWS_SMOKE_TEST_REGION as string ;
32
- Bucket = process ?. env ?. AWS_SMOKE_TEST_BUCKET as string ;
33
-
34
- Key = `` ;
35
- data = randomBytes ( 20_240_000 ) ;
36
- dataString = data . toString ( ) ;
37
-
38
- // @ts -expect-error: Types of property 'requestChecksumCalculation' are incompatible
39
- client = new S3 ( {
40
- region,
41
- requestChecksumCalculation,
42
- } ) ;
43
- Key = `multi-part-file-${ requestChecksumCalculation } -${ ChecksumAlgorithm } -${ Date . now ( ) } ` ;
44
- } ) ;
29
+ try {
30
+ const integTestResourcesEnv = await getIntegTestResources ( ) ;
31
+ Object . assign ( process . env , integTestResourcesEnv ) ;
32
+
33
+ region = process ?. env ?. AWS_SMOKE_TEST_REGION as string ;
34
+ Bucket = process ?. env ?. AWS_SMOKE_TEST_BUCKET as string ;
35
+
36
+ Key = `` ;
37
+ data = randomBytes ( 20_240_000 ) ;
38
+ dataString = data . toString ( ) ;
39
+
40
+ // @ts -expect-error: Types of property 'requestChecksumCalculation' are incompatible
41
+ client = new S3 ( {
42
+ region,
43
+ requestChecksumCalculation,
44
+ } ) ;
45
+ Key = `multi-part-file-${ requestChecksumCalculation } -${ ChecksumAlgorithm } -${ Date . now ( ) } ` ;
46
+ resourcesAvailable = true ;
47
+ } catch ( error ) {
48
+ console . warn ( "Failed to set up test resources:" , error ) ;
49
+ }
50
+ } , 45_000 ) ;
45
51
46
52
afterAll ( async ( ) => {
47
- await client . deleteObject ( { Bucket, Key } ) ;
48
- } ) ;
53
+ if ( client && Bucket && Key ) {
54
+ try {
55
+ await client . deleteObject ( { Bucket, Key } ) ;
56
+ } catch ( error ) {
57
+ console . warn ( "Failed to clean up test object:" , error ) ;
58
+ }
59
+ }
60
+ } , 10_000 ) ;
49
61
50
62
it ( "should upload in parts for input type bytes" , async ( ) => {
51
63
const s3Upload = new Upload ( {
0 commit comments