@aws-cdk-testing/cli-integ 2.173.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +9 -0
- package/LICENSE +2 -1
- package/bin/query-github.js +3 -3
- package/bin/query-github.ts +56 -0
- package/bin/run-suite.js +3 -3
- package/bin/run-suite.ts +140 -0
- package/bin/stage-distribution.js +3 -2
- package/bin/stage-distribution.ts +267 -0
- package/bin/test-root.ts +3 -0
- package/lib/aws.js +9 -6
- package/lib/aws.ts +263 -0
- package/lib/corking.ts +33 -0
- package/lib/eventually.js +3 -3
- package/lib/eventually.ts +42 -0
- package/lib/files.js +3 -2
- package/lib/files.ts +80 -0
- package/lib/github.js +6 -5
- package/lib/github.ts +43 -0
- package/lib/index.ts +13 -0
- package/lib/integ-test.ts +81 -0
- package/lib/lists.ts +9 -0
- package/lib/memoize.ts +14 -0
- package/lib/npm.ts +41 -0
- package/lib/package-sources/release-source.js +3 -2
- package/lib/package-sources/release-source.ts +81 -0
- package/lib/package-sources/repo-source.ts +111 -0
- package/lib/package-sources/repo-tools/npm.js +5 -4
- package/lib/package-sources/repo-tools/npm.ts +48 -0
- package/lib/package-sources/source.ts +35 -0
- package/lib/package-sources/subprocess.ts +15 -0
- package/lib/resource-pool.js +2 -2
- package/lib/resource-pool.ts +140 -0
- package/lib/resources.ts +4 -0
- package/lib/shell.js +8 -5
- package/lib/shell.ts +168 -0
- package/lib/staging/codeartifact.js +11 -8
- package/lib/staging/codeartifact.ts +387 -0
- package/lib/staging/maven.js +5 -3
- package/lib/staging/maven.ts +95 -0
- package/lib/staging/npm.ts +62 -0
- package/lib/staging/nuget.ts +75 -0
- package/lib/staging/parallel-shell.js +2 -2
- package/lib/staging/parallel-shell.ts +51 -0
- package/lib/staging/pypi.ts +50 -0
- package/lib/staging/usage-dir.ts +99 -0
- package/lib/with-aws.js +3 -2
- package/lib/with-aws.ts +67 -0
- package/lib/with-cdk-app.js +23 -14
- package/lib/with-cdk-app.ts +742 -0
- package/lib/with-cli-lib.ts +134 -0
- package/lib/with-packages.ts +15 -0
- package/lib/with-sam.js +7 -4
- package/lib/with-sam.ts +288 -0
- package/lib/with-temporary-directory.ts +35 -0
- package/lib/with-timeout.ts +33 -0
- package/lib/xpmutex.js +2 -2
- package/lib/xpmutex.ts +218 -0
- package/package.json +84 -62
- package/resources/cloud-assemblies/0.36.0/cdk.out +1 -0
- package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/cdk.out +1 -0
- package/resources/cloud-assemblies/1.10.0-request-azs/cdk.out +1 -0
- package/tests/cli-integ-tests/bootstrapping.integtest.js +22 -13
- package/tests/cli-integ-tests/bootstrapping.integtest.ts +493 -0
- package/tests/cli-integ-tests/cli-lib.integtest.js +3 -2
- package/tests/cli-integ-tests/cli-lib.integtest.ts +90 -0
- package/tests/cli-integ-tests/cli.integtest.js +76 -49
- package/tests/cli-integ-tests/cli.integtest.ts +2874 -0
- package/tests/cli-integ-tests/garbage-collection.integtest.js +2 -2
- package/tests/cli-integ-tests/garbage-collection.integtest.ts +392 -0
- package/tests/init-csharp/init-csharp.integtest.ts +15 -0
- package/tests/init-fsharp/init-fsharp.integtest.ts +15 -0
- package/tests/init-go/init-go.integtest.ts +23 -0
- package/tests/init-java/init-java.integtest.ts +14 -0
- package/tests/init-javascript/init-javascript.integtest.ts +59 -0
- package/tests/init-python/init-python.integtest.ts +20 -0
- package/tests/init-typescript-app/init-typescript-app.integtest.ts +66 -0
- package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +13 -0
- package/tests/tool-integrations/amplify.integtest.ts +43 -0
- package/tests/tool-integrations/with-tool-context.ts +14 -0
- package/tests/uberpackage/uberpackage.integtest.ts +11 -0
- package/resources/cdk-apps/cfn-include-app/.gitignore +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs-extra';
|
|
3
|
+
import { integTest, withTemporaryDirectory, ShellHelper, withPackages } from '../../lib';
|
|
4
|
+
|
|
5
|
+
['app', 'sample-app'].forEach(template => {
|
|
6
|
+
integTest(`init javascript ${template}`, withTemporaryDirectory(withPackages(async (context) => {
|
|
7
|
+
const shell = ShellHelper.fromContext(context);
|
|
8
|
+
await context.packages.makeCliAvailable();
|
|
9
|
+
|
|
10
|
+
await shell.shell(['cdk', 'init', '-l', 'javascript', template]);
|
|
11
|
+
await shell.shell(['npm', 'prune']);
|
|
12
|
+
await shell.shell(['npm', 'ls']); // this will fail if we have unmet peer dependencies
|
|
13
|
+
await shell.shell(['npm', 'run', 'test']);
|
|
14
|
+
|
|
15
|
+
await shell.shell(['cdk', 'synth']);
|
|
16
|
+
})));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
integTest('Test importing CDK from ESM', withTemporaryDirectory(withPackages(async (context) => {
|
|
20
|
+
// Use 'cdk init -l=javascript' to get set up, but use a different file
|
|
21
|
+
const shell = ShellHelper.fromContext(context);
|
|
22
|
+
await context.packages.makeCliAvailable();
|
|
23
|
+
|
|
24
|
+
await shell.shell(['cdk', 'init', '-l', 'javascript', 'app']);
|
|
25
|
+
|
|
26
|
+
// Rewrite some files
|
|
27
|
+
await fs.writeFile(path.join(context.integTestDir, 'new-entrypoint.mjs'), `
|
|
28
|
+
// Test multiple styles of imports
|
|
29
|
+
import { Stack, aws_sns as sns } from 'aws-cdk-lib';
|
|
30
|
+
import { SqsSubscription } from 'aws-cdk-lib/aws-sns-subscriptions';
|
|
31
|
+
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
32
|
+
import * as cdk from 'aws-cdk-lib';
|
|
33
|
+
|
|
34
|
+
class TestjsStack extends Stack {
|
|
35
|
+
constructor(scope, id, props) {
|
|
36
|
+
super(scope, id, props);
|
|
37
|
+
|
|
38
|
+
const queue = new sqs.Queue(this, 'TestjsQueue', {
|
|
39
|
+
visibilityTimeout: cdk.Duration.seconds(300)
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const topic = new sns.Topic(this, 'TestjsTopic');
|
|
43
|
+
|
|
44
|
+
topic.addSubscription(new SqsSubscription(queue));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const app = new cdk.App();
|
|
49
|
+
new TestjsStack(app, 'TestjsStack');
|
|
50
|
+
`, { encoding: 'utf-8' });
|
|
51
|
+
|
|
52
|
+
// Rewrite 'cdk.json' to use new entrypoint
|
|
53
|
+
const cdkJson = await fs.readJson(path.join(context.integTestDir, 'cdk.json'));
|
|
54
|
+
cdkJson.app = 'node new-entrypoint.mjs';
|
|
55
|
+
await fs.writeJson(path.join(context.integTestDir, 'cdk.json'), cdkJson);
|
|
56
|
+
|
|
57
|
+
await shell.shell(['cdk', 'synth']);
|
|
58
|
+
|
|
59
|
+
})));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { integTest, withTemporaryDirectory, ShellHelper, withPackages } from '../../lib';
|
|
3
|
+
|
|
4
|
+
['app', 'sample-app'].forEach(template => {
|
|
5
|
+
integTest(`init python ${template}`, withTemporaryDirectory(withPackages(async (context) => {
|
|
6
|
+
context.packages.assertJsiiPackagesAvailable();
|
|
7
|
+
|
|
8
|
+
const shell = ShellHelper.fromContext(context);
|
|
9
|
+
await context.packages.makeCliAvailable();
|
|
10
|
+
|
|
11
|
+
await shell.shell(['cdk', 'init', '-l', 'python', template]);
|
|
12
|
+
const venvPath = path.resolve(context.integTestDir, '.venv');
|
|
13
|
+
const venv = { PATH: `${venvPath}/bin:${process.env.PATH}`, VIRTUAL_ENV: venvPath };
|
|
14
|
+
|
|
15
|
+
await shell.shell([`${venvPath}/bin/pip`, 'install', '-r', 'requirements.txt'], { modEnv: venv });
|
|
16
|
+
await shell.shell([`${venvPath}/bin/pip`, 'install', '-r', 'requirements-dev.txt'], { modEnv: venv });
|
|
17
|
+
await shell.shell([`${venvPath}/bin/pytest`], { modEnv: venv });
|
|
18
|
+
await shell.shell(['cdk', 'synth'], { modEnv: venv });
|
|
19
|
+
})));
|
|
20
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { integTest, withTemporaryDirectory, ShellHelper, withPackages, TemporaryDirectoryContext } from '../../lib';
|
|
4
|
+
import { typescriptVersionsSync, typescriptVersionsYoungerThanDaysSync } from '../../lib/npm';
|
|
5
|
+
|
|
6
|
+
['app', 'sample-app'].forEach(template => {
|
|
7
|
+
integTest(`typescript init ${template}`, withTemporaryDirectory(withPackages(async (context) => {
|
|
8
|
+
const shell = ShellHelper.fromContext(context);
|
|
9
|
+
await context.packages.makeCliAvailable();
|
|
10
|
+
|
|
11
|
+
await shell.shell(['cdk', 'init', '-l', 'typescript', template]);
|
|
12
|
+
|
|
13
|
+
await shell.shell(['npm', 'prune']);
|
|
14
|
+
await shell.shell(['npm', 'ls']); // this will fail if we have unmet peer dependencies
|
|
15
|
+
await shell.shell(['npm', 'run', 'build']);
|
|
16
|
+
await shell.shell(['npm', 'run', 'test']);
|
|
17
|
+
|
|
18
|
+
await shell.shell(['cdk', 'synth']);
|
|
19
|
+
})));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Same as https://github.com/DefinitelyTyped/DefinitelyTyped?tab=readme-ov-file#support-window
|
|
23
|
+
const TYPESCRIPT_VERSION_AGE_DAYS = 2 * 365;
|
|
24
|
+
|
|
25
|
+
const TYPESCRIPT_VERSIONS = typescriptVersionsYoungerThanDaysSync(TYPESCRIPT_VERSION_AGE_DAYS, typescriptVersionsSync());
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.log(TYPESCRIPT_VERSIONS);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Test our generated code with various versions of TypeScript
|
|
32
|
+
*/
|
|
33
|
+
TYPESCRIPT_VERSIONS.forEach(tsVersion => {
|
|
34
|
+
integTest(`typescript ${tsVersion} init app`, withTemporaryDirectory(withPackages(async (context) => {
|
|
35
|
+
const shell = ShellHelper.fromContext(context);
|
|
36
|
+
await context.packages.makeCliAvailable();
|
|
37
|
+
|
|
38
|
+
await shell.shell(['node', '--version']);
|
|
39
|
+
await shell.shell(['npm', '--version']);
|
|
40
|
+
|
|
41
|
+
await shell.shell(['cdk', 'init', '-l', 'typescript', 'app', '--generate-only']);
|
|
42
|
+
|
|
43
|
+
// Necessary because recent versions of ts-jest require TypeScript>=4.3 but we
|
|
44
|
+
// still want to test with older versions as well.
|
|
45
|
+
await removeDevDependencies(context);
|
|
46
|
+
|
|
47
|
+
await shell.shell(['npm', 'install', '--save-dev', `typescript@${tsVersion}`]);
|
|
48
|
+
await shell.shell(['npm', 'install']); // Older versions of npm require this to be a separate step from the one above
|
|
49
|
+
await shell.shell(['npx', 'tsc', '--version']);
|
|
50
|
+
await shell.shell(['npm', 'prune']);
|
|
51
|
+
await shell.shell(['npm', 'ls']); // this will fail if we have unmet peer dependencies
|
|
52
|
+
|
|
53
|
+
// We just removed the 'jest' dependency so remove the tests as well because they won't compile
|
|
54
|
+
await shell.shell(['rm', '-rf', 'test/']);
|
|
55
|
+
|
|
56
|
+
await shell.shell(['npm', 'run', 'build']);
|
|
57
|
+
await shell.shell(['cdk', 'synth']);
|
|
58
|
+
})));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
async function removeDevDependencies(context: TemporaryDirectoryContext) {
|
|
62
|
+
const filename = path.join(context.integTestDir, 'package.json');
|
|
63
|
+
const pj = JSON.parse(await fs.readFile(filename, { encoding: 'utf-8' }));
|
|
64
|
+
delete pj.devDependencies;
|
|
65
|
+
await fs.writeFile(filename, JSON.stringify(pj, undefined, 2), { encoding: 'utf-8' });
|
|
66
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { integTest, withTemporaryDirectory, ShellHelper, withPackages } from '../../lib';
|
|
2
|
+
|
|
3
|
+
integTest('typescript init lib', withTemporaryDirectory(withPackages(async (context) => {
|
|
4
|
+
const shell = ShellHelper.fromContext(context);
|
|
5
|
+
await context.packages.makeCliAvailable();
|
|
6
|
+
|
|
7
|
+
await shell.shell(['cdk', 'init', '-l', 'typescript', 'lib']);
|
|
8
|
+
|
|
9
|
+
await shell.shell(['npm', 'prune']);
|
|
10
|
+
await shell.shell(['npm', 'ls']); // this will fail if we have unmet peer dependencies
|
|
11
|
+
await shell.shell(['npm', 'run', 'build']);
|
|
12
|
+
await shell.shell(['npm', 'run', 'test']);
|
|
13
|
+
})));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { withToolContext } from './with-tool-context';
|
|
4
|
+
import { integTest, ShellHelper, TemporaryDirectoryContext } from '../../lib';
|
|
5
|
+
|
|
6
|
+
const TIMEOUT = 1800_000;
|
|
7
|
+
|
|
8
|
+
integTest('amplify integration', withToolContext(async (context) => {
|
|
9
|
+
const shell = ShellHelper.fromContext(context);
|
|
10
|
+
|
|
11
|
+
await shell.shell(['npm', 'create', '-y', 'amplify@latest']);
|
|
12
|
+
await shell.shell(['npx', 'ampx', 'configure', 'telemetry', 'disable']);
|
|
13
|
+
|
|
14
|
+
// This will create 'package.json' implicating a certain version of the CDK
|
|
15
|
+
await updateCdkDependency(context, context.packages.requestedCliVersion(), context.packages.requestedFrameworkVersion());
|
|
16
|
+
await shell.shell(['npm', 'install']);
|
|
17
|
+
|
|
18
|
+
await shell.shell(['npx', 'ampx', 'sandbox', '--once'], {
|
|
19
|
+
modEnv: {
|
|
20
|
+
AWS_REGION: context.aws.region,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
try {
|
|
24
|
+
|
|
25
|
+
// Future code goes here, putting the try/finally here already so it doesn't
|
|
26
|
+
// get forgotten.
|
|
27
|
+
|
|
28
|
+
} finally {
|
|
29
|
+
await shell.shell(['npx', 'ampx', 'sandbox', 'delete', '--yes'], {
|
|
30
|
+
modEnv: {
|
|
31
|
+
AWS_REGION: context.aws.region,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}), TIMEOUT);
|
|
36
|
+
|
|
37
|
+
async function updateCdkDependency(context: TemporaryDirectoryContext, cliVersion: string, libVersion: string) {
|
|
38
|
+
const filename = path.join(context.integTestDir, 'package.json');
|
|
39
|
+
const pj = JSON.parse(await fs.readFile(filename, { encoding: 'utf-8' }));
|
|
40
|
+
pj.devDependencies['aws-cdk'] = cliVersion;
|
|
41
|
+
pj.devDependencies['aws-cdk-lib'] = libVersion;
|
|
42
|
+
await fs.writeFile(filename, JSON.stringify(pj, undefined, 2), { encoding: 'utf-8' });
|
|
43
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TestContext } from '../../lib/integ-test';
|
|
2
|
+
import { AwsContext, withAws } from '../../lib/with-aws';
|
|
3
|
+
import { DisableBootstrapContext } from '../../lib/with-cdk-app';
|
|
4
|
+
import { PackageContext, withPackages } from '../../lib/with-packages';
|
|
5
|
+
import { TemporaryDirectoryContext, withTemporaryDirectory } from '../../lib/with-temporary-directory';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The default prerequisites for tests running tool integrations
|
|
9
|
+
*/
|
|
10
|
+
export function withToolContext<A extends TestContext>(
|
|
11
|
+
block: (context: A & TemporaryDirectoryContext & PackageContext & AwsContext & DisableBootstrapContext
|
|
12
|
+
) => Promise<void>) {
|
|
13
|
+
return withAws(withTemporaryDirectory(withPackages(block)));
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { integTest, withMonolithicCfnIncludeCdkApp } from '../../lib';
|
|
2
|
+
|
|
3
|
+
jest.setTimeout(600_000);
|
|
4
|
+
|
|
5
|
+
describe('uberpackage', () => {
|
|
6
|
+
integTest('works with cloudformation-include', withMonolithicCfnIncludeCdkApp(async (fixture) => {
|
|
7
|
+
fixture.log('Starting test of cfn-include with monolithic CDK');
|
|
8
|
+
|
|
9
|
+
await fixture.cdkSynth();
|
|
10
|
+
}));
|
|
11
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!cfn-include-app.js
|