Class TestOptions
The set of options to control the workflow of the test runner.
Inheritance
Implements
Namespace: Amazon.CDK.CloudAssembly.Schema
Assembly: Amazon.CDK.CloudAssembly.Schema.dll
Syntax (csharp)
public class TestOptions : Object, ITestOptions
Syntax (vb)
Public Class TestOptions
Inherits Object
Implements ITestOptions
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.CloudAssembly.Schema;
var testOptions = new TestOptions {
AllowDestroy = new [] { "allowDestroy" },
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" }
},
Regions = new [] { "regions" },
StackUpdateWorkflow = false
};
Synopsis
Constructors
TestOptions() |
Properties
AllowDestroy | List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test. |
CdkCommandOptions | Additional options to use for each CDK command. |
DiffAssets | 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 | Additional commands to run at predefined points in the test workflow. |
Regions | Limit deployment to these regions. |
StackUpdateWorkflow | 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. |
Constructors
TestOptions()
public TestOptions()
Properties
AllowDestroy
List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test.
public string[] AllowDestroy { get; set; }
Property Value
System.String[]
Remarks
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
CdkCommandOptions
Additional options to use for each CDK command.
public ICdkCommands CdkCommandOptions { get; set; }
Property Value
Remarks
Default: - runner default options
DiffAssets
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.
public Nullable<bool> DiffAssets { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
For example any tests involving custom resources or bundling
Default: false
Hooks
Additional commands to run at predefined points in the test workflow.
public IHooks Hooks { get; set; }
Property Value
Remarks
e.g. { postDeploy: ['yarn', 'test'] }
Default: - no hooks
Regions
Limit deployment to these regions.
public string[] Regions { get; set; }
Property Value
System.String[]
Remarks
Default: - can run in any region
StackUpdateWorkflow
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.
public Nullable<bool> StackUpdateWorkflow { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true