@@ -7,80 +7,76 @@ import { integTest, withDefaultFixture } from '../../../lib';
7
7
8
8
jest . setTimeout ( 2 * 60 * 60_000 ) ; // Includes the time to acquire locks, worst-case single-threaded runtime
9
9
10
- const MAJOR_VERSIONS = [ '2' , 'v3-latest' ] ;
10
+ integTest (
11
+ `cdk-assets smoke test` ,
12
+ withDefaultFixture ( async ( fixture ) => {
13
+ await fixture . shell ( [ 'npm' , 'init' , '-y' ] ) ;
14
+ await fixture . shell ( [ 'npm' , 'install' , `cdk-assets@latest` ] ) ;
11
15
12
- MAJOR_VERSIONS . forEach ( MV => {
13
- integTest (
14
- `cdk-assets@${ MV } smoke test` ,
15
- withDefaultFixture ( async ( fixture ) => {
16
- await fixture . shell ( [ 'npm' , 'init' , '-y' ] ) ;
17
- await fixture . shell ( [ 'npm' , 'install' , `cdk-assets@${ MV } ` ] ) ;
16
+ const account = await fixture . aws . account ( ) ;
17
+ const region = fixture . aws . region ;
18
+ const bucketName = `cdk-hnb659fds-assets-${ account } -${ region } ` ;
19
+ const repositoryName = `cdk-hnb659fds-container-assets-${ account } -${ region } ` ;
18
20
19
- const account = await fixture . aws . account ( ) ;
20
- const region = fixture . aws . region ;
21
- const bucketName = `cdk-hnb659fds-assets-${ account } -${ region } ` ;
22
- const repositoryName = `cdk-hnb659fds-container-assets-${ account } -${ region } ` ;
21
+ const imageDir = 'imagedir' ;
22
+ await fs . mkdir ( path . join ( fixture . integTestDir , imageDir ) , { recursive : true } ) ;
23
23
24
- const imageDir = 'imagedir' ;
25
- await fs . mkdir ( path . join ( fixture . integTestDir , imageDir ) , { recursive : true } ) ;
24
+ // Write an asset file and a data file for the Docker image
25
+ const assetFile = 'testfile.txt' ;
26
+ for ( const toCreate of [ assetFile , `${ imageDir } /datafile.txt` ] ) {
27
+ await fs . writeFile ( path . join ( fixture . integTestDir , toCreate ) , 'some asset file' ) ;
28
+ }
26
29
27
- // Write an asset file and a data file for the Docker image
28
- const assetFile = 'testfile.txt' ;
29
- for ( const toCreate of [ assetFile , `${ imageDir } /datafile.txt` ] ) {
30
- await fs . writeFile ( path . join ( fixture . integTestDir , toCreate ) , 'some asset file' ) ;
31
- }
32
-
33
- // Write a Dockerfile for the image build with a data file in it
34
- await fs . writeFile ( path . join ( fixture . integTestDir , imageDir , 'Dockerfile' ) , [
35
- 'FROM scratch' ,
36
- 'ADD datafile.txt datafile.txt' ,
37
- ] . join ( '\n' ) ) ;
30
+ // Write a Dockerfile for the image build with a data file in it
31
+ await fs . writeFile ( path . join ( fixture . integTestDir , imageDir , 'Dockerfile' ) , [
32
+ 'FROM scratch' ,
33
+ 'ADD datafile.txt datafile.txt' ,
34
+ ] . join ( '\n' ) ) ;
38
35
39
- // Write an asset JSON file to publish to the bootstrapped environment
40
- const assetsJson = {
41
- version : "38.0.1" ,
42
- files : {
43
- testfile : {
44
- source : {
45
- path : assetFile ,
46
- packaging : 'file' ,
47
- } ,
48
- destinations : {
49
- current : {
50
- region,
51
- assumeRoleArn : `arn:\${AWS::Partition}:iam::${ account } :role/cdk-hnb659fds-file-publishing-role-${ account } -${ region } ` ,
52
- bucketName,
53
- objectKey : `test-file-${ Date . now ( ) } .json` ,
54
- }
36
+ // Write an asset JSON file to publish to the bootstrapped environment
37
+ const assetsJson = {
38
+ version : "38.0.1" ,
39
+ files : {
40
+ testfile : {
41
+ source : {
42
+ path : assetFile ,
43
+ packaging : 'file' ,
44
+ } ,
45
+ destinations : {
46
+ current : {
47
+ region,
48
+ assumeRoleArn : `arn:\${AWS::Partition}:iam::${ account } :role/cdk-hnb659fds-file-publishing-role-${ account } -${ region } ` ,
49
+ bucketName,
50
+ objectKey : `test-file-${ Date . now ( ) } .json` ,
55
51
}
56
52
}
57
- } ,
58
- dockerImages : {
59
- testimage : {
60
- source : {
61
- directory : imageDir ,
62
- } ,
63
- destinations : {
64
- current : {
65
- region ,
66
- assumeRoleArn : `arn:\${AWS::Partition}:iam:: ${ account } :role/cdk-hnb659fds-image-publishing-role- ${ account } - ${ region } ` ,
67
- repositoryName ,
68
- imageTag : `test-image` , // Not fresh on every run because we'll run out of tags too easily
69
- } ,
53
+ }
54
+ } ,
55
+ dockerImages : {
56
+ testimage : {
57
+ source : {
58
+ directory : imageDir ,
59
+ } ,
60
+ destinations : {
61
+ current : {
62
+ region,
63
+ assumeRoleArn : `arn:\${AWS::Partition}:iam:: ${ account } :role/cdk-hnb659fds-image-publishing-role- ${ account } - ${ region } ` ,
64
+ repositoryName ,
65
+ imageTag : `test-image` , // Not fresh on every run because we'll run out of tags too easily
70
66
} ,
71
67
} ,
72
- }
73
- } ;
74
-
75
- await fs . writeFile ( path . join ( fixture . integTestDir , 'assets.json' ) , JSON . stringify ( assetsJson , undefined , 2 ) ) ;
76
- await fixture . shell ( [ 'npx' , 'cdk-assets' , '--path' , 'assets.json' , '--verbose' , 'publish' ] , {
77
- modEnv : {
78
- ...fixture . cdkShellEnv ( ) ,
79
- // This is necessary for cdk-assets v2, if the credentials are supplied via
80
- // config file (which they are on the CodeBuild canaries).
81
- AWS_SDK_LOAD_CONFIG : '1' ,
82
68
} ,
83
- } ) ;
84
- } ) ,
85
- ) ;
86
- } ) ;
69
+ }
70
+ } ;
71
+
72
+ await fs . writeFile ( path . join ( fixture . integTestDir , 'assets.json' ) , JSON . stringify ( assetsJson , undefined , 2 ) ) ;
73
+ await fixture . shell ( [ 'npx' , 'cdk-assets' , '--path' , 'assets.json' , '--verbose' , 'publish' ] , {
74
+ modEnv : {
75
+ ...fixture . cdkShellEnv ( ) ,
76
+ // This is necessary for cdk-assets v2, if the credentials are supplied via
77
+ // config file (which they are on the CodeBuild canaries).
78
+ AWS_SDK_LOAD_CONFIG : '1' ,
79
+ } ,
80
+ } ) ;
81
+ } ) ,
82
+ ) ;
0 commit comments