IntegTestCase
- class aws_cdk.integ_tests_alpha.IntegTestCase(scope, id, *, stacks, assertion_stack=None, allow_destroy=None, cdk_command_options=None, diff_assets=None, hooks=None, regions=None, stack_update_workflow=None)
Bases:
Construct
(experimental) 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
- Stability:
experimental
- ExampleMetadata:
fixture=_generated
Example:
# 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 cloud_assembly_schema # stack: cdk.Stack integ_test_case = integ_tests_alpha.IntegTestCase(self, "MyIntegTestCase", stacks=[stack], # the properties below are optional 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"] ), regions=["regions"], stack_update_workflow=False )
- Parameters:
scope (
Construct
) –id (
str
) –stacks (
Sequence
[Stack
]) – (experimental) Stacks to be deployed during the test.assertion_stack (
Optional
[Stack
]) – (experimental) Specify a stack to use for assertions. Default: - a stack is created for youallow_destroy (
Optional
[Sequence
[str
]]) – 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’] Default: - do not allow destruction of any resources on updatecdk_command_options (
Union
[CdkCommands
,Dict
[str
,Any
],None
]) – Additional options to use for each CDK command. Default: - runner default optionsdiff_assets (
Optional
[bool
]) – 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 Default: falsehooks (
Union
[Hooks
,Dict
[str
,Any
],None
]) – Additional commands to run at predefined points in the test workflow. e.g. { postDeploy: [‘yarn’, ‘test’] } Default: - no hooksregions (
Optional
[Sequence
[str
]]) – Limit deployment to these regions. Default: - can run in any regionstack_update_workflow (
Optional
[bool
]) – 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. Default: true
- Stability:
experimental
Methods
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- assertions
(experimental) Make assertions on resources in this test case.
- Stability:
experimental
- manifest
(experimental) The integration test manifest for this test case.
Manifests are used by the integration test runner.
- Stability:
experimental
- node
The tree node.
Static Methods
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
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 classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
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 theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.