Class: AWSCDK::CloudAssemblySchema::TestCase
- Inherits:
-
TestOptions
- Object
- TestOptions
- AWSCDK::CloudAssemblySchema::TestCase
- Defined in:
- cloud_assembly_schema/test_case.rb
Overview
Represents an integration test case.
Instance Attribute Summary collapse
-
#allow_delete_failures ⇒ Boolean?
readonly
Whether to allow resources that fail to delete during a stack update.
-
#allow_destroy ⇒ Array<String>?
readonly
List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test.
-
#assertion_stack ⇒ String?
readonly
The node id of the stack that contains assertions.
-
#assertion_stack_name ⇒ String?
readonly
The name of the stack that contains assertions.
-
#cdk_command_options ⇒ AWSCDK::CloudAssemblySchema::CDKCommands?
readonly
Additional options to use for each CDK command.
-
#diff_assets ⇒ Boolean?
readonly
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.
-
#hooks ⇒ AWSCDK::CloudAssemblySchema::Hooks?
readonly
Additional commands to run at predefined points in the test workflow.
-
#regions ⇒ Array<String>?
readonly
Limit deployment to these regions.
-
#stack_update_workflow ⇒ Boolean?
readonly
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.
-
#stacks ⇒ Array<String>
readonly
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
exclusivelyis passed.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(allow_delete_failures: nil, allow_destroy: nil, cdk_command_options: nil, diff_assets: nil, hooks: nil, regions: nil, stack_update_workflow: nil, stacks:, assertion_stack: nil, assertion_stack_name: nil) ⇒ TestCase
constructor
A new instance of TestCase.
- #to_jsii ⇒ Object
Constructor Details
#initialize(allow_delete_failures: nil, allow_destroy: nil, cdk_command_options: nil, diff_assets: nil, hooks: nil, regions: nil, stack_update_workflow: nil, stacks:, assertion_stack: nil, assertion_stack_name: nil) ⇒ TestCase
Returns a new instance of TestCase.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'cloud_assembly_schema/test_case.rb', line 17 def initialize(allow_delete_failures: nil, allow_destroy: nil, cdk_command_options: nil, diff_assets: nil, hooks: nil, regions: nil, stack_update_workflow: nil, stacks:, assertion_stack: nil, assertion_stack_name: nil) @allow_delete_failures = allow_delete_failures Jsii::Type.check_type(@allow_delete_failures, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowDeleteFailures") unless @allow_delete_failures.nil? @allow_destroy = allow_destroy Jsii::Type.check_type(@allow_destroy, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowDestroy") unless @allow_destroy.nil? @cdk_command_options = .is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::CDKCommands.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(@cdk_command_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuQ2RrQ29tbWFuZHMifQ==")), "cdkCommandOptions") unless @cdk_command_options.nil? @diff_assets = diff_assets Jsii::Type.check_type(@diff_assets, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "diffAssets") unless @diff_assets.nil? @hooks = hooks.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::Hooks.new(**hooks.transform_keys(&:to_sym)) : hooks Jsii::Type.check_type(@hooks, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuSG9va3MifQ==")), "hooks") unless @hooks.nil? @regions = regions Jsii::Type.check_type(@regions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "regions") unless @regions.nil? @stack_update_workflow = stack_update_workflow Jsii::Type.check_type(@stack_update_workflow, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "stackUpdateWorkflow") unless @stack_update_workflow.nil? @stacks = stacks Jsii::Type.check_type(@stacks, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "stacks") @assertion_stack = assertion_stack Jsii::Type.check_type(@assertion_stack, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "assertionStack") unless @assertion_stack.nil? @assertion_stack_name = assertion_stack_name Jsii::Type.check_type(@assertion_stack_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "assertionStackName") unless @assertion_stack_name.nil? end |
Instance Attribute Details
#allow_delete_failures ⇒ Boolean? (readonly)
Default: false
Whether to allow resources that fail to delete during a stack update.
When false, the test will fail if CloudFormation skips deleting a resource during a stack update. When true, only a warning is printed.
47 48 49 |
# File 'cloud_assembly_schema/test_case.rb', line 47 def allow_delete_failures @allow_delete_failures end |
#allow_destroy ⇒ Array<String>? (readonly)
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']
59 60 61 |
# File 'cloud_assembly_schema/test_case.rb', line 59 def allow_destroy @allow_destroy end |
#assertion_stack ⇒ String? (readonly)
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
100 101 102 |
# File 'cloud_assembly_schema/test_case.rb', line 100 def assertion_stack @assertion_stack end |
#assertion_stack_name ⇒ String? (readonly)
Default: - no assertion stack
The name of the stack that contains assertions.
105 106 107 |
# File 'cloud_assembly_schema/test_case.rb', line 105 def assertion_stack_name @assertion_stack_name end |
#cdk_command_options ⇒ AWSCDK::CloudAssemblySchema::CDKCommands? (readonly)
Default: - runner default options
Additional options to use for each CDK command.
64 65 66 |
# File 'cloud_assembly_schema/test_case.rb', line 64 def @cdk_command_options end |
#diff_assets ⇒ Boolean? (readonly)
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
72 73 74 |
# File 'cloud_assembly_schema/test_case.rb', line 72 def diff_assets @diff_assets end |
#hooks ⇒ AWSCDK::CloudAssemblySchema::Hooks? (readonly)
Default: - no hooks
Additional commands to run at predefined points in the test workflow.
e.g. { postDeploy: ['yarn', 'test'] }
79 80 81 |
# File 'cloud_assembly_schema/test_case.rb', line 79 def hooks @hooks end |
#regions ⇒ Array<String>? (readonly)
Default: - can run in any region
Limit deployment to these regions.
84 85 86 |
# File 'cloud_assembly_schema/test_case.rb', line 84 def regions @regions end |
#stack_update_workflow ⇒ Boolean? (readonly)
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.
89 90 91 |
# File 'cloud_assembly_schema/test_case.rb', line 89 def stack_update_workflow @stack_update_workflow end |
#stacks ⇒ Array<String> (readonly)
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.
93 94 95 |
# File 'cloud_assembly_schema/test_case.rb', line 93 def stacks @stacks end |
Class Method Details
.jsii_properties ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'cloud_assembly_schema/test_case.rb', line 107 def self.jsii_properties { :allow_delete_failures => "allowDeleteFailures", :allow_destroy => "allowDestroy", :cdk_command_options => "cdkCommandOptions", :diff_assets => "diffAssets", :hooks => "hooks", :regions => "regions", :stack_update_workflow => "stackUpdateWorkflow", :stacks => "stacks", :assertion_stack => "assertionStack", :assertion_stack_name => "assertionStackName", } end |
Instance Method Details
#to_jsii ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'cloud_assembly_schema/test_case.rb', line 122 def to_jsii result = {} result.merge!(super) result.merge!({ "allowDeleteFailures" => @allow_delete_failures, "allowDestroy" => @allow_destroy, "cdkCommandOptions" => @cdk_command_options, "diffAssets" => @diff_assets, "hooks" => @hooks, "regions" => @regions, "stackUpdateWorkflow" => @stack_update_workflow, "stacks" => @stacks, "assertionStack" => @assertion_stack, "assertionStackName" => @assertion_stack_name, }) result.compact end |