Class: AWSCDK::CloudAssemblySchema::TestOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_assembly_schema/test_options.rb

Overview

The set of options to control the workflow of the test runner.

Direct Known Subclasses

TestCase

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ TestOptions

Returns a new instance of TestOptions.

Parameters:

  • allow_delete_failures (Boolean, nil) (defaults to: nil)

    Whether to allow resources that fail to delete during a stack update.

  • allow_destroy (Array<String>, nil) (defaults to: nil)

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

  • cdk_command_options (AWSCDK::CloudAssemblySchema::CDKCommands, nil) (defaults to: nil)

    Additional options to use for each CDK command.

  • diff_assets (Boolean, nil) (defaults to: nil)

    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, nil) (defaults to: nil)

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

  • regions (Array<String>, nil) (defaults to: nil)

    Limit deployment to these regions.

  • stack_update_workflow (Boolean, nil) (defaults to: nil)

    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.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'cloud_assembly_schema/test_options.rb', line 14

def initialize(allow_delete_failures: nil, allow_destroy: nil, cdk_command_options: nil, diff_assets: nil, hooks: nil, regions: nil, stack_update_workflow: 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 = cdk_command_options.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::CDKCommands.new(**cdk_command_options.transform_keys(&:to_sym)) : cdk_command_options
  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?
end

Instance Attribute Details

#allow_delete_failuresBoolean? (readonly)

Note:

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.

Returns:

  • (Boolean, nil)


38
39
40
# File 'cloud_assembly_schema/test_options.rb', line 38

def allow_delete_failures
  @allow_delete_failures
end

#allow_destroyArray<String>? (readonly)

Note:

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']

Returns:

  • (Array<String>, nil)


50
51
52
# File 'cloud_assembly_schema/test_options.rb', line 50

def allow_destroy
  @allow_destroy
end

#cdk_command_optionsAWSCDK::CloudAssemblySchema::CDKCommands? (readonly)

Note:

Default: - runner default options

Additional options to use for each CDK command.



55
56
57
# File 'cloud_assembly_schema/test_options.rb', line 55

def cdk_command_options
  @cdk_command_options
end

#diff_assetsBoolean? (readonly)

Note:

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

Returns:

  • (Boolean, nil)


63
64
65
# File 'cloud_assembly_schema/test_options.rb', line 63

def diff_assets
  @diff_assets
end

#hooksAWSCDK::CloudAssemblySchema::Hooks? (readonly)

Note:

Default: - no hooks

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

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



70
71
72
# File 'cloud_assembly_schema/test_options.rb', line 70

def hooks
  @hooks
end

#regionsArray<String>? (readonly)

Note:

Default: - can run in any region

Limit deployment to these regions.

Returns:

  • (Array<String>, nil)


75
76
77
# File 'cloud_assembly_schema/test_options.rb', line 75

def regions
  @regions
end

#stack_update_workflowBoolean? (readonly)

Note:

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.

Returns:

  • (Boolean, nil)


80
81
82
# File 'cloud_assembly_schema/test_options.rb', line 80

def stack_update_workflow
  @stack_update_workflow
end

Class Method Details

.jsii_propertiesObject



82
83
84
85
86
87
88
89
90
91
92
# File 'cloud_assembly_schema/test_options.rb', line 82

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",
  }
end

Instance Method Details

#to_jsiiObject



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'cloud_assembly_schema/test_options.rb', line 94

def to_jsii
  result = {}
  result.merge!({
    "allowDeleteFailures" => @allow_delete_failures,
    "allowDestroy" => @allow_destroy,
    "cdkCommandOptions" => @cdk_command_options,
    "diffAssets" => @diff_assets,
    "hooks" => @hooks,
    "regions" => @regions,
    "stackUpdateWorkflow" => @stack_update_workflow,
  })
  result.compact
end