aws-cdk-lib.cloud_assembly_schema.TestCase

interface TestCase

LanguageType name
.NETAmazon.CDK.CloudAssembly.Schema.TestCase
Gogithub.com/aws/aws-cdk-go/awscdk/v2/cloudassemblyschema#TestCase
Javasoftware.amazon.awscdk.cloudassembly.schema.TestCase
Pythonaws_cdk.cloud_assembly_schema.TestCase
TypeScript (source)aws-cdk-lib » cloud_assembly_schema » TestCase

Represents an integration test case.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cloud_assembly_schema } from 'aws-cdk-lib';
const testCase: cloud_assembly_schema.TestCase = {
  stacks: ['stacks'],

  // the properties below are optional
  allowDestroy: ['allowDestroy'],
  assertionStack: 'assertionStack',
  assertionStackName: 'assertionStackName',
  cdkCommandOptions: {
    deploy: {
      args: {
        all: false,
        app: 'app',
        assetMetadata: false,
        caBundlePath: 'caBundlePath',
        changeSetName: 'changeSetName',
        ci: false,
        color: false,
        context: {
          contextKey: 'context',
        },
        debug: false,
        ec2Creds: false,
        exclusively: false,
        execute: false,
        force: false,
        ignoreErrors: false,
        json: false,
        lookups: false,
        notices: false,
        notificationArns: ['notificationArns'],
        output: 'output',
        outputsFile: 'outputsFile',
        parameters: {
          parametersKey: 'parameters',
        },
        pathMetadata: false,
        profile: 'profile',
        proxy: 'proxy',
        requireApproval: cloud_assembly_schema.RequireApproval.NEVER,
        reuseAssets: ['reuseAssets'],
        roleArn: 'roleArn',
        rollback: false,
        stacks: ['stacks'],
        staging: false,
        strict: false,
        toolkitStackName: 'toolkitStackName',
        trace: false,
        usePreviousParameters: false,
        verbose: false,
        versionReporting: false,
      },
      enabled: false,
      expectedMessage: 'expectedMessage',
      expectError: false,
    },
    destroy: {
      args: {
        all: false,
        app: 'app',
        assetMetadata: false,
        caBundlePath: 'caBundlePath',
        color: false,
        context: {
          contextKey: 'context',
        },
        debug: false,
        ec2Creds: false,
        exclusively: false,
        force: false,
        ignoreErrors: false,
        json: false,
        lookups: false,
        notices: false,
        output: 'output',
        pathMetadata: false,
        profile: 'profile',
        proxy: 'proxy',
        roleArn: 'roleArn',
        stacks: ['stacks'],
        staging: false,
        strict: false,
        trace: false,
        verbose: false,
        versionReporting: false,
      },
      enabled: false,
      expectedMessage: 'expectedMessage',
      expectError: false,
    },
  },
  diffAssets: false,
  hooks: {
    postDeploy: ['postDeploy'],
    postDestroy: ['postDestroy'],
    preDeploy: ['preDeploy'],
    preDestroy: ['preDestroy'],
  },
  regions: ['regions'],
  stackUpdateWorkflow: false,
};

Properties

NameTypeDescription
stacksstring[]Stacks that should be tested as part of this test case The stackNames will be passed as args to the cdk commands so dependent stacks will be automatically deployed unless exclusively is passed.
allowDestroy?string[]List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test.
assertionStack?stringThe node id of the stack that contains assertions.
assertionStackName?stringThe name of the stack that contains assertions.
cdkCommandOptions?CdkCommandsAdditional options to use for each CDK command.
diffAssets?booleanWhether or not to include asset hashes in the diff Asset hashes can introduces a lot of unneccessary noise into tests, but there are some cases where asset hashes should be included.
hooks?HooksAdditional commands to run at predefined points in the test workflow.
regions?string[]Limit deployment to these regions.
stackUpdateWorkflow?booleanRun update workflow on this test case This should only be set to false to test scenarios that are not possible to test as part of the update workflow.

stacks

Type: string[]

Stacks that should be tested as part of this test case The stackNames will be passed as args to the cdk commands so dependent stacks will be automatically deployed unless exclusively is passed.


allowDestroy?

Type: string[] (optional, default: do not allow destruction of any resources on update)

List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test.

This list should only include resources that for this specific integration test we are sure will not cause errors or an outage if destroyed. For example, maybe we know that a new resource will be created first before the old resource is destroyed which prevents any outage.

e.g. ['AWS::IAM::Role']


assertionStack?

Type: string (optional, default: no assertion stack)

The node id of the stack that contains assertions.

This is the value that can be used to deploy the stack with the CDK CLI


assertionStackName?

Type: string (optional, default: no assertion stack)

The name of the stack that contains assertions.


cdkCommandOptions?

Type: CdkCommands (optional, default: runner default options)

Additional options to use for each CDK command.


diffAssets?

Type: boolean (optional, default: false)

Whether or not to include asset hashes in the diff Asset hashes can introduces a lot of unneccessary noise into tests, but there are some cases where asset hashes should be included.

For example any tests involving custom resources or bundling


hooks?

Type: Hooks (optional, default: no hooks)

Additional commands to run at predefined points in the test workflow.

e.g. { postDeploy: ['yarn', 'test'] }


regions?

Type: string[] (optional, default: can run in any region)

Limit deployment to these regions.


stackUpdateWorkflow?

Type: boolean (optional, default: true)

Run update workflow on this test case This should only be set to false to test scenarios that are not possible to test as part of the update workflow.