diff --git a/packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js b/packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js index c0d6307db8f57..673806b72ec56 100755 --- a/packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js +++ b/packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js @@ -72,6 +72,13 @@ class YourStack extends cdk.Stack { } } +class NoticesStack extends cdk.Stack { + constructor(parent, id, props) { + super(parent, id, props); + new sqs.Queue(this, 'queue'); + } +} + class SsoPermissionSetNoPolicy extends Stack { constructor(scope, id) { super(scope, id); @@ -753,6 +760,7 @@ switch (stackSet) { // Deploy all does a wildcard ${stackPrefix}-test-* new MyStack(app, `${stackPrefix}-test-1`, { env: defaultEnv }); new YourStack(app, `${stackPrefix}-test-2`); + new NoticesStack(app, `${stackPrefix}-notices`); // Deploy wildcard with parameters does ${stackPrefix}-param-test-* new ParameterStack(app, `${stackPrefix}-param-test-1`); new OtherParameterStack(app, `${stackPrefix}-param-test-2`); diff --git a/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts b/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts index f093ce86236d6..f714f99b9bb0c 100644 --- a/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts +++ b/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts @@ -2260,33 +2260,79 @@ integTest( }), ); -integTest('cdk notices for bootstrap', withDefaultFixture(async (fixture) => { +integTest('cdk notices are displayed correctly', withDefaultFixture(async (fixture) => { const cache = { expiration: 4125963264000, // year 2100 so we never overwrite the cache - notices: [{ - title: 'Bootstrap stack outdated', - issueNumber: 16600, - overview: 'Your environments "{resolve:ENVIRONMENTS}" are running an outdated bootstrap stack.', - components: [{ - name: 'bootstrap', - version: '<2000', - }], - schemaVersion: '1', - }], + notices: [ + { + title: 'CLI Notice', + issueNumber: 1111, + overview: 'Overview for CLI Notice', + components: [ + { + name: 'cli', + version: '<99.0.0', + }, + ], + schemaVersion: '1', + }, + { + title: 'Framework Notice', + issueNumber: 2222, + overview: 'Overview for Framework Notice', + components: [ + { + name: 'framework', + version: '<99.0.0', + }, + ], + schemaVersion: '1', + }, + { + title: 'Queue Notice', + issueNumber: 3333, + overview: 'Overview for Queue Notice', + components: [ + { + name: 'aws-cdk-lib.aws_sqs.Queue', + version: '<99.0.0', + }, + ], + schemaVersion: '1', + }, + { + title: 'Bootstrap 22 Notice', + issueNumber: 4444, + overview: 'Overview for Bootstrap 22 Notice. AffectedEnvironments:<{resolve:ENVIRONMENTS}>', + components: [ + { + name: 'bootstrap', + version: '22', + }, + ], + schemaVersion: '1', + }, + ], }; const cdkCacheDir = path.join(fixture.integTestDir, 'cache'); await fs.mkdir(cdkCacheDir); await fs.writeFile(path.join(cdkCacheDir, 'notices.json'), JSON.stringify(cache)); - const output = await fixture.cdkDeploy('test-2', { + const output = await fixture.cdkDeploy('notices', { verbose: false, modEnv: { CDK_HOME: fixture.integTestDir, }, }); - expect(output).toContain('Your environments \"aws://'); + expect(output).toContain('Overview for CLI Notice'); + expect(output).toContain('Overview for Framework Notice'); + expect(output).toContain('Overview for Queue Notice'); + expect(output).toContain('Overview for Bootstrap 22 Notice'); + + // assert dynamic environments are resolved + expect(output).toContain(`AffectedEnvironments:`); }));