@aws-cdk_integ-tests-alpha.IntegTestCase

class IntegTestCase (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.IntegTests.Alpha.IntegTestCase
Gogithub.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2#IntegTestCase
Javasoftware.amazon.awscdk.integtests.alpha.IntegTestCase
Pythonaws_cdk.integ_tests_alpha.IntegTestCase
TypeScript (source)@aws-cdk/integ-tests-alpha ยป IntegTestCase

Implements IConstruct, IDependable

An integration test case. Allows the definition of test properties that apply to all stacks under this case.

It is recommended that you use the IntegTest construct since that will create a default IntegTestCase

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as integ_tests_alpha from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
import { cloud_assembly_schema } from 'aws-cdk-lib';

declare const stack: cdk.Stack;
const integTestCase = new integ_tests_alpha.IntegTestCase(this, 'MyIntegTestCase', {
  stacks: [stack],

  // the properties below are optional
  allowDestroy: ['allowDestroy'],
  assertionStack: stack,
  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,
});

Initializer

new IntegTestCase(scope: Construct, id: string, props: IntegTestCaseProps)

Parameters

  • scope Construct
  • id string
  • props IntegTestCaseProps

Construct Props

NameTypeDescription
stacks๐Ÿ”นStack[]Stacks to be deployed during the test.
allowDestroy?๐Ÿ”นstring[]List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test.
assertionStack?๐Ÿ”นStackSpecify a stack to use for 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: Stack[]

Stacks to be deployed during the test.


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: Stack (optional, default: a stack is created for you)

Specify a stack to use for 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.

Properties

NameTypeDescription
assertions๐Ÿ”นIDeployAssertMake assertions on resources in this test case.
manifest๐Ÿ”นIntegManifestThe integration test manifest for this test case.
node๐Ÿ”นNodeThe tree node.

assertions๐Ÿ”น

Type: IDeployAssert

Make assertions on resources in this test case.


manifest๐Ÿ”น

Type: IntegManifest

The integration test manifest for this test case.

Manifests are used by the integration test runner.


node๐Ÿ”น

Type: Node

The tree node.

Methods

NameDescription
toString()๐Ÿ”นReturns a string representation of this construct.

toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.