Experimental
@aws-cdk/integ-tests-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
IntegTestCase
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 { aws_lambda as lambda } 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
allowDeleteFailures: false,
allowDestroy: ['allowDestroy'],
assertionStack: stack,
cdkCommandOptions: {
deploy: {
args: {
all: false,
app: 'app',
assetMetadata: false,
caBundlePath: 'caBundlePath',
changeSetName: 'changeSetName',
ci: false,
color: false,
concurrency: 123,
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'],
},
providerLogLevel: lambda.ApplicationLogLevel.INFO,
regions: ['regions'],
stackUpdateWorkflow: false,
});
from aws_cdk.cloud_assembly_schema import CdkCommands, DeployCommand, DeployOptions, DestroyCommand, DestroyOptions, Hooks
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.integ_tests_alpha as integ_tests_alpha
import aws_cdk as cdk
from aws_cdk import aws_lambda as lambda_
from aws_cdk import cloud_assembly_schema
# stack: cdk.Stack
integ_test_case = integ_tests_alpha.IntegTestCase(self, "MyIntegTestCase",
stacks=[stack],
# the properties below are optional
allow_delete_failures=False,
allow_destroy=["allowDestroy"],
assertion_stack=stack,
cdk_command_options=CdkCommands(
deploy=DeployCommand(
args=DeployOptions(
all=False,
app="app",
asset_metadata=False,
ca_bundle_path="caBundlePath",
change_set_name="changeSetName",
ci=False,
color=False,
concurrency=123,
context={
"context_key": "context"
},
debug=False,
ec2_creds=False,
exclusively=False,
execute=False,
force=False,
ignore_errors=False,
json=False,
lookups=False,
notices=False,
notification_arns=["notificationArns"],
output="output",
outputs_file="outputsFile",
parameters={
"parameters_key": "parameters"
},
path_metadata=False,
profile="profile",
proxy="proxy",
require_approval=cloud_assembly_schema.RequireApproval.NEVER,
reuse_assets=["reuseAssets"],
role_arn="roleArn",
rollback=False,
stacks=["stacks"],
staging=False,
strict=False,
toolkit_stack_name="toolkitStackName",
trace=False,
use_previous_parameters=False,
verbose=False,
version_reporting=False
),
enabled=False,
expected_message="expectedMessage",
expect_error=False
),
destroy=DestroyCommand(
args=DestroyOptions(
all=False,
app="app",
asset_metadata=False,
ca_bundle_path="caBundlePath",
color=False,
context={
"context_key": "context"
},
debug=False,
ec2_creds=False,
exclusively=False,
force=False,
ignore_errors=False,
json=False,
lookups=False,
notices=False,
output="output",
path_metadata=False,
profile="profile",
proxy="proxy",
role_arn="roleArn",
stacks=["stacks"],
staging=False,
strict=False,
trace=False,
verbose=False,
version_reporting=False
),
enabled=False,
expected_message="expectedMessage",
expect_error=False
)
),
diff_assets=False,
hooks=Hooks(
post_deploy=["postDeploy"],
post_destroy=["postDestroy"],
pre_deploy=["preDeploy"],
pre_destroy=["preDestroy"]
),
provider_log_level=lambda_.ApplicationLogLevel.INFO,
regions=["regions"],
stack_update_workflow=False
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.integtests.alpha.*;
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.cloud_assembly_schema.*;
Stack stack;
IntegTestCase integTestCase = IntegTestCase.Builder.create(this, "MyIntegTestCase")
.stacks(List.of(stack))
// the properties below are optional
.allowDeleteFailures(false)
.allowDestroy(List.of("allowDestroy"))
.assertionStack(stack)
.cdkCommandOptions(CdkCommands.builder()
.deploy(DeployCommand.builder()
.args(DeployOptions.builder()
.all(false)
.app("app")
.assetMetadata(false)
.caBundlePath("caBundlePath")
.changeSetName("changeSetName")
.ci(false)
.color(false)
.concurrency(123)
.context(Map.of(
"contextKey", "context"))
.debug(false)
.ec2Creds(false)
.exclusively(false)
.execute(false)
.force(false)
.ignoreErrors(false)
.json(false)
.lookups(false)
.notices(false)
.notificationArns(List.of("notificationArns"))
.output("output")
.outputsFile("outputsFile")
.parameters(Map.of(
"parametersKey", "parameters"))
.pathMetadata(false)
.profile("profile")
.proxy("proxy")
.requireApproval(RequireApproval.NEVER)
.reuseAssets(List.of("reuseAssets"))
.roleArn("roleArn")
.rollback(false)
.stacks(List.of("stacks"))
.staging(false)
.strict(false)
.toolkitStackName("toolkitStackName")
.trace(false)
.usePreviousParameters(false)
.verbose(false)
.versionReporting(false)
.build())
.enabled(false)
.expectedMessage("expectedMessage")
.expectError(false)
.build())
.destroy(DestroyCommand.builder()
.args(DestroyOptions.builder()
.all(false)
.app("app")
.assetMetadata(false)
.caBundlePath("caBundlePath")
.color(false)
.context(Map.of(
"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(List.of("stacks"))
.staging(false)
.strict(false)
.trace(false)
.verbose(false)
.versionReporting(false)
.build())
.enabled(false)
.expectedMessage("expectedMessage")
.expectError(false)
.build())
.build())
.diffAssets(false)
.hooks(Hooks.builder()
.postDeploy(List.of("postDeploy"))
.postDestroy(List.of("postDestroy"))
.preDeploy(List.of("preDeploy"))
.preDestroy(List.of("preDestroy"))
.build())
.providerLogLevel(ApplicationLogLevel.INFO)
.regions(List.of("regions"))
.stackUpdateWorkflow(false)
.build();
// Install: dotnet add package Amazon.CDK.IntegTests.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.IntegTests.Alpha;
using Amazon.CDK;
using Amazon.CDK.AWS.Lambda;
using Amazon.CDK.Cloud_assembly_schema;
Stack stack;
var integTestCase = new IntegTestCase(this, "MyIntegTestCase", new IntegTestCaseProps {
Stacks = new [] { stack },
// the properties below are optional
AllowDeleteFailures = false,
AllowDestroy = new [] { "allowDestroy" },
AssertionStack = stack,
CdkCommandOptions = new CdkCommands {
Deploy = new DeployCommand {
Args = new DeployOptions {
All = false,
App = "app",
AssetMetadata = false,
CaBundlePath = "caBundlePath",
ChangeSetName = "changeSetName",
Ci = false,
Color = false,
Concurrency = 123,
Context = new Dictionary<string, string> {
{ "contextKey", "context" }
},
Debug = false,
Ec2Creds = false,
Exclusively = false,
Execute = false,
Force = false,
IgnoreErrors = false,
Json = false,
Lookups = false,
Notices = false,
NotificationArns = new [] { "notificationArns" },
Output = "output",
OutputsFile = "outputsFile",
Parameters = new Dictionary<string, string> {
{ "parametersKey", "parameters" }
},
PathMetadata = false,
Profile = "profile",
Proxy = "proxy",
RequireApproval = RequireApproval.NEVER,
ReuseAssets = new [] { "reuseAssets" },
RoleArn = "roleArn",
Rollback = false,
Stacks = new [] { "stacks" },
Staging = false,
Strict = false,
ToolkitStackName = "toolkitStackName",
Trace = false,
UsePreviousParameters = false,
Verbose = false,
VersionReporting = false
},
Enabled = false,
ExpectedMessage = "expectedMessage",
ExpectError = false
},
Destroy = new DestroyCommand {
Args = new DestroyOptions {
All = false,
App = "app",
AssetMetadata = false,
CaBundlePath = "caBundlePath",
Color = false,
Context = new Dictionary<string, string> {
{ "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 = new [] { "stacks" },
Staging = false,
Strict = false,
Trace = false,
Verbose = false,
VersionReporting = false
},
Enabled = false,
ExpectedMessage = "expectedMessage",
ExpectError = false
}
},
DiffAssets = false,
Hooks = new Hooks {
PostDeploy = new [] { "postDeploy" },
PostDestroy = new [] { "postDestroy" },
PreDeploy = new [] { "preDeploy" },
PreDestroy = new [] { "preDestroy" }
},
ProviderLogLevel = ApplicationLogLevel.INFO,
Regions = new [] { "regions" },
StackUpdateWorkflow = false
});
// Install: go get github.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import integ_tests_alpha "github.com/aws/aws-cdk-go/awscdkintegtestsalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var stack Stack
integTestCase := integ_tests_alpha.NewIntegTestCase(this, jsii.String("MyIntegTestCase"), &IntegTestCaseProps{
Stacks: []Stack{
stack,
},
// the properties below are optional
AllowDeleteFailures: jsii.Boolean(false),
AllowDestroy: []*string{
jsii.String("allowDestroy"),
},
AssertionStack: stack,
CdkCommandOptions: &CdkCommands{
Deploy: &DeployCommand{
Args: &DeployOptions{
All: jsii.Boolean(false),
App: jsii.String("app"),
AssetMetadata: jsii.Boolean(false),
CaBundlePath: jsii.String("caBundlePath"),
ChangeSetName: jsii.String("changeSetName"),
Ci: jsii.Boolean(false),
Color: jsii.Boolean(false),
Concurrency: jsii.Number(123),
Context: map[string]*string{
"contextKey": jsii.String("context"),
},
Debug: jsii.Boolean(false),
Ec2Creds: jsii.Boolean(false),
Exclusively: jsii.Boolean(false),
Execute: jsii.Boolean(false),
Force: jsii.Boolean(false),
IgnoreErrors: jsii.Boolean(false),
Json: jsii.Boolean(false),
Lookups: jsii.Boolean(false),
Notices: jsii.Boolean(false),
NotificationArns: []*string{
jsii.String("notificationArns"),
},
Output: jsii.String("output"),
OutputsFile: jsii.String("outputsFile"),
Parameters: map[string]*string{
"parametersKey": jsii.String("parameters"),
},
PathMetadata: jsii.Boolean(false),
Profile: jsii.String("profile"),
Proxy: jsii.String("proxy"),
RequireApproval: awscdk.Cloud_assembly_schema.RequireApproval_NEVER,
ReuseAssets: []*string{
jsii.String("reuseAssets"),
},
RoleArn: jsii.String("roleArn"),
Rollback: jsii.Boolean(false),
Stacks: []*string{
jsii.String("stacks"),
},
Staging: jsii.Boolean(false),
Strict: jsii.Boolean(false),
ToolkitStackName: jsii.String("toolkitStackName"),
Trace: jsii.Boolean(false),
UsePreviousParameters: jsii.Boolean(false),
Verbose: jsii.Boolean(false),
VersionReporting: jsii.Boolean(false),
},
Enabled: jsii.Boolean(false),
ExpectedMessage: jsii.String("expectedMessage"),
ExpectError: jsii.Boolean(false),
},
Destroy: &DestroyCommand{
Args: &DestroyOptions{
All: jsii.Boolean(false),
App: jsii.String("app"),
AssetMetadata: jsii.Boolean(false),
CaBundlePath: jsii.String("caBundlePath"),
Color: jsii.Boolean(false),
Context: map[string]*string{
"contextKey": jsii.String("context"),
},
Debug: jsii.Boolean(false),
Ec2Creds: jsii.Boolean(false),
Exclusively: jsii.Boolean(false),
Force: jsii.Boolean(false),
IgnoreErrors: jsii.Boolean(false),
Json: jsii.Boolean(false),
Lookups: jsii.Boolean(false),
Notices: jsii.Boolean(false),
Output: jsii.String("output"),
PathMetadata: jsii.Boolean(false),
Profile: jsii.String("profile"),
Proxy: jsii.String("proxy"),
RoleArn: jsii.String("roleArn"),
Stacks: []*string{
jsii.String("stacks"),
},
Staging: jsii.Boolean(false),
Strict: jsii.Boolean(false),
Trace: jsii.Boolean(false),
Verbose: jsii.Boolean(false),
VersionReporting: jsii.Boolean(false),
},
Enabled: jsii.Boolean(false),
ExpectedMessage: jsii.String("expectedMessage"),
ExpectError: jsii.Boolean(false),
},
},
DiffAssets: jsii.Boolean(false),
Hooks: &Hooks{
PostDeploy: []*string{
jsii.String("postDeploy"),
},
PostDestroy: []*string{
jsii.String("postDestroy"),
},
PreDeploy: []*string{
jsii.String("preDeploy"),
},
PreDestroy: []*string{
jsii.String("preDestroy"),
},
},
ProviderLogLevel: awscdk.Aws_lambda.ApplicationLogLevel_INFO,
Regions: []*string{
jsii.String("regions"),
},
StackUpdateWorkflow: jsii.Boolean(false),
})
Initializer
new IntegTestCase(scope: Construct, id: string, props: IntegTestCaseProps)
IntegTestCase(scope: Construct, id: str, props: IntegTestCaseProps)
new IntegTestCase(Construct scope, String id, IntegTestCaseProps props)
new IntegTestCase(Construct scope, string id, IntegTestCaseProps props)
NewIntegTestCase(Scope Construct, Id *string, Props IntegTestCaseProps)
Construct Props
allowDeleteFailuresbooleanallow_delete_failuresboolallowDeleteFailuresBooleanAllowDeleteFailuresboolAllowDeleteFailures*bool= false#When false, the test will fail if CloudFormation skips deleting a resource during a stack update. When true, only a warning is printed.
allowDestroystring[]allow_destroytyping.List[str]allowDestroyList<String>AllowDestroystring[]AllowDestroy*[]*string= do not allow destruction of any …#notes · default
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']
Default: do not allow destruction of any resources on update
assertionStackStackassertion_stackStackassertionStackStackAssertionStackStackAssertionStackStack= a stack is created for you#cdkCommandOptionsCdkCommandscdk_command_optionsCdkCommandscdkCommandOptionsCdkCommandsCdkCommandOptionsCdkCommandsCdkCommandOptionsCdkCommands= runner default options#For example any tests involving custom resources or bundling
e.g. { postDeploy: ['yarn', 'test'] }
providerLogLevelApplicationLogLevelprovider_log_levelApplicationLogLevelproviderLogLevelApplicationLogLevelProviderLogLevelApplicationLogLevelProviderLogLevelApplicationLogLevel= ApplicationLogLevel.FATAL#regionsstring[]regionstyping.List[str]regionsList<String>Regionsstring[]Regions*[]*string= can run in any region#stackUpdateWorkflowbooleanstack_update_workflowboolstackUpdateWorkflowBooleanStackUpdateWorkflowboolStackUpdateWorkflow*bool= true#Properties
assertionsIDeployAssertassertionsIDeployAssertassertionsIDeployAssertAssertionsIDeployAssertAssertionsIDeployAssertrequired#manifestIntegManifestmanifestIntegManifestmanifestIntegManifestManifestIntegManifestManifestIntegManifestrequired#Manifests are used by the integration test runner.
Methods
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.
1 parameter · returns
Parameters
mixinsmixinsmixinsmixinsMixins— The mixins to apply.
Returns: This construct for chaining