integtests

package
v1.168.0-devpreview Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

integ-tests

Overview

This library is meant to be used in combination with the integ-runner CLI to enable users to write and execute integration tests for AWS CDK Constructs.

An integration test should be defined as a CDK application, and there should be a 1:1 relationship between an integration test and a CDK application.

So for example, in order to create an integration test called my-function we would need to create a file to contain our integration test application.

test/integ.my-function.ts

app := awscdk.NewApp()
stack := awscdk.NewStack()
lambda.NewFunction(stack, jsii.String("MyFunction"), &functionProps{
	runtime: lambda.runtime_NODEJS_12_X(),
	handler: jsii.String("index.handler"),
	code: lambda.code.fromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
})

This is a self contained CDK application which we could deploy by running

cdk deploy --app 'node test/integ.my-function.js'

In order to turn this into an integration test, all that is needed is to use the IntegTest construct.

var app app
var stack stack

awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stack,
	},
})

You will notice that the stack is registered to the IntegTest as a test case. Each integration test can contain multiple test cases, which are just instances of a stack. See the Usage section for more details.

Usage

IntegTest

Suppose you have a simple stack, that only encapsulates a Lambda function with a certain handler:

type stackUnderTestProps struct {
	stackProps
	architecture architecture
}

type stackUnderTest struct {
	stack
}

func newStackUnderTest(scope construct, id *string, props stackUnderTestProps) *stackUnderTest {
	this := &stackUnderTest{}
	newStack_Override(this, scope, id, props)

	lambda.NewFunction(this, jsii.String("Handler"), &functionProps{
		runtime: lambda.runtime_NODEJS_12_X(),
		handler: jsii.String("index.handler"),
		code: lambda.code.fromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
		architecture: props.architecture,
	})
	return this
}

You may want to test this stack under different conditions. For example, we want this stack to be deployed correctly, regardless of the architecture we choose for the Lambda function. In particular, it should work for both ARM_64 and X86_64. So you can create an IntegTestCase that exercises both scenarios:

type stackUnderTestProps struct {
	stackProps
	architecture architecture
}

type stackUnderTest struct {
	stack
}

func newStackUnderTest(scope construct, id *string, props stackUnderTestProps) *stackUnderTest {
	this := &stackUnderTest{}
	newStack_Override(this, scope, id, props)

	lambda.NewFunction(this, jsii.String("Handler"), &functionProps{
		runtime: lambda.runtime_NODEJS_12_X(),
		handler: jsii.String("index.handler"),
		code: lambda.code.fromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
		architecture: props.architecture,
	})
	return this
}

// Beginning of the test suite
app := awscdk.NewApp()

awscdk.NewIntegTest(app, jsii.String("DifferentArchitectures"), &integTestProps{
	testCases: []*stack{
		NewStackUnderTest(app, jsii.String("Stack1"), &stackUnderTestProps{
			architecture: lambda.*architecture_ARM_64(),
		}),
		NewStackUnderTest(app, jsii.String("Stack2"), &stackUnderTestProps{
			architecture: lambda.*architecture_X86_64(),
		}),
	},
})

This is all the instruction you need for the integration test runner to know which stacks to synthesize, deploy and destroy. But you may also need to customize the behavior of the runner by changing its parameters. For example:

app := awscdk.NewApp()

stackUnderTest := awscdk.NewStack(app, jsii.String("StackUnderTest"))

stack := awscdk.NewStack(app, jsii.String("stack"))

testCase := awscdk.NewIntegTest(app, jsii.String("CustomizedDeploymentWorkflow"), &integTestProps{
	testCases: []stack{
		stackUnderTest,
	},
	diffAssets: jsii.Boolean(true),
	stackUpdateWorkflow: jsii.Boolean(true),
	cdkCommandOptions: &cdkCommands{
		deploy: &deployCommand{
			args: &deployOptions{
				requireApproval: awscdk.RequireApproval_NEVER,
				json: jsii.Boolean(true),
			},
		},
		destroy: &destroyCommand{
			args: &destroyOptions{
				force: jsii.Boolean(true),
			},
		},
	},
})
IntegTestCaseStack

In the majority of cases an integration test will contain a single IntegTestCase. By default when you create an IntegTest an IntegTestCase is created for you and all of your test cases are registered to this IntegTestCase. The IntegTestCase and IntegTestCaseStack constructs are only needed when it is necessary to defined different options for individual test cases.

For example, you might want to have one test case where diffAssets is enabled.

var app app
var stackUnderTest stack

testCaseWithAssets := awscdk.NewIntegTestCaseStack(app, jsii.String("TestCaseAssets"), &integTestCaseStackProps{
	diffAssets: jsii.Boolean(true),
})

awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stackUnderTest,
		testCaseWithAssets,
	},
})

Assertions

This library also provides a utility to make assertions against the infrastructure that the integration test deploys.

There are two main scenarios in which assertions are created.

  • Part of an integration test using integ-runner

In this case you would create an integration test using the IntegTest construct and then make assertions using the assert property. You should not utilize the assertion constructs directly, but should instead use the methods on IntegTest.assert.

var app app
var stack stack


integ := awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stack,
	},
})
integ.assertions.awsApiCall(jsii.String("S3"), jsii.String("getObject"))
  • Part of a normal CDK deployment

In this case you may be using assertions as part of a normal CDK deployment in order to make an assertion on the infrastructure before the deployment is considered successful. In this case you can utilize the assertions constructs directly.

var myAppStack stack


awscdk.NewAwsApiCall(myAppStack, jsii.String("GetObject"), &awsApiCallProps{
	service: jsii.String("S3"),
	api: jsii.String("getObject"),
})
DeployAssert

Assertions are created by using the DeployAssert construct. This construct creates it's own Stack separate from any stacks that you create as part of your integration tests. This Stack is treated differently from other stacks by the integ-runner tool. For example, this stack will not be diffed by the integ-runner.

DeployAssert also provides utilities to register your own assertions.

var myCustomResource customResource
var stack stack
var app app


integ := awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stack,
	},
})
integ.assertions.expect(jsii.String("CustomAssertion"), awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"foo": jsii.String("bar"),
}), awscdk.ActualResult.fromCustomResource(myCustomResource, jsii.String("data")))

In the above example an assertion is created that will trigger a user defined CustomResource and assert that the data attribute is equal to { foo: 'bar' }.

AwsApiCall

A common method to retrieve the "actual" results to compare with what is expected is to make an AWS API call to receive some data. This library does this by utilizing CloudFormation custom resources which means that CloudFormation will call out to a Lambda Function which will use the AWS JavaScript SDK to make the API call.

This can be done by using the class directory (in the case of a normal deployment):

var stack stack


awscdk.NewAwsApiCall(stack, jsii.String("MyAssertion"), &awsApiCallProps{
	service: jsii.String("SQS"),
	api: jsii.String("receiveMessage"),
	parameters: map[string]*string{
		"QueueUrl": jsii.String("url"),
	},
})

Or by using the awsApiCall method on DeployAssert (when writing integration tests):

var app app
var stack stack

integ := awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stack,
	},
})
integ.assertions.awsApiCall(jsii.String("SQS"), jsii.String("receiveMessage"), map[string]*string{
	"QueueUrl": jsii.String("url"),
})
EqualsAssertion

This library currently provides the ability to assert that two values are equal to one another by utilizing the EqualsAssertion class. This utilizes a Lambda backed CustomResource which in tern uses the Match utility from the @aws-cdk/assertions library.

var app app
var stack stack
var queue queue
var fn iFunction


integ := awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stack,
	},
})

integ.assertions.invokeFunction(&lambdaInvokeFunctionProps{
	functionName: fn.functionName,
	invocationType: awscdk.InvocationType_EVENT,
	payload: jSON.stringify(map[string]*string{
		"status": jsii.String("OK"),
	}),
})

message := integ.assertions.awsApiCall(jsii.String("SQS"), jsii.String("receiveMessage"), map[string]interface{}{
	"QueueUrl": queue.queueUrl,
	"WaitTimeSeconds": jsii.Number(20),
})

message.assertAtPath(jsii.String("Messages.0.Body"), awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"requestContext": map[string]*string{
		"condition": jsii.String("Success"),
	},
	"requestPayload": map[string]*string{
		"status": jsii.String("OK"),
	},
	"responseContext": map[string]*f64{
		"statusCode": jsii.Number(200),
	},
	"responsePayload": jsii.String("success"),
}))
Match

integ-tests also provides a Match utility similar to the @aws-cdk/assertions module. Match can be used to construct the ExpectedResult.

var message awsApiCall


message.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"Messages": awscdk.Match.arrayWith([]interface{}{
		map[string]map[string]map[string][]interface{}{
			"Body": map[string]map[string][]interface{}{
				"Values": awscdk.Match.arrayWith([]interface{}{
					map[string]*f64{
						"Asdf": jsii.Number(3),
					},
				}),
				"Message": awscdk.Match.stringLikeRegexp(jsii.String("message")),
			},
		},
	}),
}))
Examples
Invoke a Lambda Function

In this example there is a Lambda Function that is invoked and we assert that the payload that is returned is equal to '200'.

var lambdaFunction iFunction
var app app


stack := awscdk.NewStack(app, jsii.String("cdk-integ-lambda-bundling"))

integ := awscdk.NewIntegTest(app, jsii.String("IntegTest"), &integTestProps{
	testCases: []stack{
		stack,
	},
})

invoke := integ.assertions.invokeFunction(&lambdaInvokeFunctionProps{
	functionName: lambdaFunction.functionName,
})
invoke.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"Payload": jsii.String("200"),
}))
Make an AWS API Call

In this example there is a StepFunctions state machine that is executed and then we assert that the result of the execution is successful.

var app app
var stack stack
var sm iStateMachine


testCase := awscdk.NewIntegTest(app, jsii.String("IntegTest"), &integTestProps{
	testCases: []*stack{
		stack,
	},
})

// Start an execution
start := testCase.assertions.awsApiCall(jsii.String("StepFunctions"), jsii.String("startExecution"), map[string]*string{
	"stateMachineArn": sm.stateMachineArn,
})

// describe the results of the execution
describe := testCase.assertions.awsApiCall(jsii.String("StepFunctions"), jsii.String("describeExecution"), map[string]*string{
	"executionArn": start.getAttString(jsii.String("executionArn")),
})

// assert the results
describe.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"status": jsii.String("SUCCEEDED"),
}))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertionsProvider_IsConstruct

func AssertionsProvider_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func AwsApiCall_IsConstruct

func AwsApiCall_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func EqualsAssertion_IsConstruct

func EqualsAssertion_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func IntegTestCaseStack_IsConstruct

func IntegTestCaseStack_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func IntegTestCaseStack_IsIntegTestCaseStack

func IntegTestCaseStack_IsIntegTestCaseStack(x interface{}) *bool

Returns whether the construct is a IntegTestCaseStack. Experimental.

func IntegTestCaseStack_IsStack

func IntegTestCaseStack_IsStack(x interface{}) *bool

Return whether the given object is a Stack.

We do attribute detection since we can't reliably use 'instanceof'. Experimental.

func IntegTestCaseStack_Of

func IntegTestCaseStack_Of(construct constructs.IConstruct) awscdk.Stack

Looks up the first stack scope in which `construct` is defined.

Fails if there is no stack up the tree. Experimental.

func IntegTestCase_IsConstruct

func IntegTestCase_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func IntegTest_IsConstruct

func IntegTest_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func LambdaInvokeFunction_IsConstruct

func LambdaInvokeFunction_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Match_ArrayWith

func Match_ArrayWith(pattern *[]interface{}) *map[string]*[]interface{}

Matches the specified pattern with the array found in the same relative path of the target.

The set of elements (or matchers) must be in the same order as would be found. Experimental.

func Match_ObjectLike

func Match_ObjectLike(pattern *map[string]interface{}) *map[string]*map[string]interface{}

Matches the specified pattern to an object found in the same relative path of the target.

The keys and their values (or matchers) must be present in the target but the target can be a superset. Experimental.

func Match_StringLikeRegexp

func Match_StringLikeRegexp(pattern *string) *map[string]*string

Matches targets according to a regular expression. Experimental.

func NewActualResult_Override

func NewActualResult_Override(a ActualResult)

Experimental.

func NewAssertionsProvider_Override

func NewAssertionsProvider_Override(a AssertionsProvider, scope constructs.Construct, id *string)

Experimental.

func NewAwsApiCall_Override

func NewAwsApiCall_Override(a AwsApiCall, scope constructs.Construct, id *string, props *AwsApiCallProps)

Experimental.

func NewEqualsAssertion_Override

func NewEqualsAssertion_Override(e EqualsAssertion, scope constructs.Construct, id *string, props *EqualsAssertionProps)

Experimental.

func NewExpectedResult_Override

func NewExpectedResult_Override(e ExpectedResult)

Experimental.

func NewIntegTestCaseStack_Override

func NewIntegTestCaseStack_Override(i IntegTestCaseStack, scope constructs.Construct, id *string, props *IntegTestCaseStackProps)

Experimental.

func NewIntegTestCase_Override

func NewIntegTestCase_Override(i IntegTestCase, scope constructs.Construct, id *string, props *IntegTestCaseProps)

Experimental.

func NewIntegTest_Override

func NewIntegTest_Override(i IntegTest, scope constructs.Construct, id *string, props *IntegTestProps)

Experimental.

func NewLambdaInvokeFunction_Override

func NewLambdaInvokeFunction_Override(l LambdaInvokeFunction, scope constructs.Construct, id *string, props *LambdaInvokeFunctionProps)

Experimental.

func NewMatch_Override

func NewMatch_Override(m Match)

Experimental.

Types

type ActualResult

type ActualResult interface {
	// The actual results as a string.
	// Experimental.
	Result() *string
	// Experimental.
	SetResult(val *string)
}

Represents the "actual" results to compare.

Example:

var myCustomResource customResource
var stack stack
var app app

integ := awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stack,
	},
})
integ.assertions.expect(jsii.String("CustomAssertion"), awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"foo": jsii.String("bar"),
}), awscdk.ActualResult.fromCustomResource(myCustomResource, jsii.String("data")))

Experimental.

func ActualResult_FromAwsApiCall

func ActualResult_FromAwsApiCall(query IAwsApiCall, attribute *string) ActualResult

Get the actual results from a AwsApiCall. Experimental.

func ActualResult_FromCustomResource

func ActualResult_FromCustomResource(customResource awscdk.CustomResource, attribute *string) ActualResult

Get the actual results from a CustomResource. Experimental.

type AssertionRequest

type AssertionRequest struct {
	// The actual value received.
	// Experimental.
	Actual interface{} `field:"required" json:"actual" yaml:"actual"`
	// The expected value to assert.
	// Experimental.
	Expected interface{} `field:"required" json:"expected" yaml:"expected"`
	// Set this to true if a failed assertion should result in a CloudFormation deployment failure.
	//
	// This is only necessary if assertions are being
	// executed outside of `integ-runner`.
	// Experimental.
	FailDeployment *bool `field:"optional" json:"failDeployment" yaml:"failDeployment"`
}

A request to make an assertion that the actual value matches the expected.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var actual interface{}
var expected interface{}

assertionRequest := &assertionRequest{
	actual: actual,
	expected: expected,

	// the properties below are optional
	failDeployment: jsii.Boolean(false),
}

Experimental.

type AssertionResult

type AssertionResult struct {
	// The result of an assertion.
	// Experimental.
	Data *string `field:"required" json:"data" yaml:"data"`
	// Whether or not the assertion failed.
	// Experimental.
	Failed *bool `field:"optional" json:"failed" yaml:"failed"`
}

The result of an Assertion wrapping the actual result data in another struct.

Needed to access the whole message via getAtt() on the custom resource.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

assertionResult := &assertionResult{
	data: jsii.String("data"),

	// the properties below are optional
	failed: jsii.Boolean(false),
}

Experimental.

type AssertionResultData

type AssertionResultData struct {
	// The status of the assertion, i.e. pass or fail.
	// Experimental.
	Status Status `field:"required" json:"status" yaml:"status"`
	// Any message returned with the assertion result typically this will be the diff if there is any.
	// Experimental.
	Message *string `field:"optional" json:"message" yaml:"message"`
}

The result of an assertion.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

assertionResultData := &assertionResultData{
	status: awscdk.Integ_tests.status_PASS,

	// the properties below are optional
	message: jsii.String("message"),
}

Experimental.

type AssertionType

type AssertionType string

The type of assertion to perform. Experimental.

const (
	// Assert that two values are equal.
	// Experimental.
	AssertionType_EQUALS AssertionType = "EQUALS"
	// The keys and their values must be present in the target but the target can be a superset.
	// Experimental.
	AssertionType_OBJECT_LIKE AssertionType = "OBJECT_LIKE"
	// Matches the specified pattern with the array The set of elements must be in the same order as would be found.
	// Experimental.
	AssertionType_ARRAY_WITH AssertionType = "ARRAY_WITH"
)

type AssertionsProvider

type AssertionsProvider interface {
	awscdk.Construct
	// A reference to the provider Lambda Function execution Role ARN.
	// Experimental.
	HandlerRoleArn() awscdk.Reference
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// The ARN of the lambda function which can be used as a serviceToken to a CustomResource.
	// Experimental.
	ServiceToken() *string
	// Create a policy statement from a specific api call.
	// Experimental.
	AddPolicyStatementFromSdkCall(service *string, api *string, resources *[]*string)
	// Encode an object so it can be passed as custom resource parameters.
	//
	// Custom resources will convert
	// all input parameters to strings so we encode non-strings here
	// so we can then decode them correctly in the provider function.
	// Experimental.
	Encode(obj interface{}) interface{}
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

Represents an assertions provider.

The creates a singletone Lambda Function that will create a single function per stack that serves as the custom resource provider for the various assertion providers.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

assertionsProvider := awscdk.Integ_tests.NewAssertionsProvider(this, jsii.String("MyAssertionsProvider"))

Experimental.

func NewAssertionsProvider

func NewAssertionsProvider(scope constructs.Construct, id *string) AssertionsProvider

Experimental.

type AwsApiCall

type AwsApiCall interface {
	awscdk.Construct
	IAwsApiCall
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	Provider() AssertionsProvider
	// Experimental.
	SetProvider(val AssertionsProvider)
	// Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.
	//
	// For example the SQS.receiveMessage api response would look
	// like:
	//
	// If you wanted to assert the value of `Body` you could do.
	// Experimental.
	AssertAtPath(path *string, expected ExpectedResult)
	// Assert that the ExpectedResult is equal to the result of the AwsApiCall.
	// Experimental.
	Expect(expected ExpectedResult)
	// Returns the value of an attribute of the custom resource of an arbitrary type.
	//
	// Attributes are returned from the custom resource provider through the
	// `Data` map where the key is the attribute name.
	// Experimental.
	GetAtt(attributeName *string) awscdk.Reference
	// Returns the value of an attribute of the custom resource of type string.
	//
	// Attributes are returned from the custom resource provider through the
	// `Data` map where the key is the attribute name.
	// Experimental.
	GetAttString(attributeName *string) *string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

Construct that creates a custom resource that will perform a query using the AWS SDK.

Example:

var myAppStack stack

awscdk.NewAwsApiCall(myAppStack, jsii.String("GetObject"), &awsApiCallProps{
	service: jsii.String("S3"),
	api: jsii.String("getObject"),
})

Experimental.

func NewAwsApiCall

func NewAwsApiCall(scope constructs.Construct, id *string, props *AwsApiCallProps) AwsApiCall

Experimental.

type AwsApiCallOptions

type AwsApiCallOptions struct {
	// The api call to make, i.e. getBucketLifecycle.
	// Experimental.
	Api *string `field:"required" json:"api" yaml:"api"`
	// The AWS service, i.e. S3.
	// Experimental.
	Service *string `field:"required" json:"service" yaml:"service"`
	// Any parameters to pass to the api call.
	// Experimental.
	Parameters interface{} `field:"optional" json:"parameters" yaml:"parameters"`
}

Options to perform an AWS JavaScript V2 API call.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var parameters interface{}

awsApiCallOptions := &awsApiCallOptions{
	api: jsii.String("api"),
	service: jsii.String("service"),

	// the properties below are optional
	parameters: parameters,
}

Experimental.

type AwsApiCallProps

type AwsApiCallProps struct {
	// The api call to make, i.e. getBucketLifecycle.
	// Experimental.
	Api *string `field:"required" json:"api" yaml:"api"`
	// The AWS service, i.e. S3.
	// Experimental.
	Service *string `field:"required" json:"service" yaml:"service"`
	// Any parameters to pass to the api call.
	// Experimental.
	Parameters interface{} `field:"optional" json:"parameters" yaml:"parameters"`
}

Options for creating an SDKQuery provider.

Example:

var myAppStack stack

awscdk.NewAwsApiCall(myAppStack, jsii.String("GetObject"), &awsApiCallProps{
	service: jsii.String("S3"),
	api: jsii.String("getObject"),
})

Experimental.

type AwsApiCallRequest

type AwsApiCallRequest struct {
	// The AWS api call to make i.e. getBucketLifecycle.
	// Experimental.
	Api *string `field:"required" json:"api" yaml:"api"`
	// The AWS service i.e. S3.
	// Experimental.
	Service *string `field:"required" json:"service" yaml:"service"`
	// Whether or not to flatten the response from the api call.
	//
	// Valid values are 'true' or 'false' as strings
	//
	// Typically when using an SdkRequest you will be passing it as the
	// `actual` value to an assertion provider so this would be set
	// to 'false' (you want the actual response).
	//
	// If you are using the SdkRequest to perform more of a query to return
	// a single value to use, then this should be set to 'true'. For example,
	// you could make a StepFunctions.startExecution api call and retreive the
	// `executionArn` from the response.
	// Experimental.
	FlattenResponse *string `field:"optional" json:"flattenResponse" yaml:"flattenResponse"`
	// Any parameters to pass to the api call.
	// Experimental.
	Parameters interface{} `field:"optional" json:"parameters" yaml:"parameters"`
}

A AWS JavaScript SDK V2 request.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var parameters interface{}

awsApiCallRequest := &awsApiCallRequest{
	api: jsii.String("api"),
	service: jsii.String("service"),

	// the properties below are optional
	flattenResponse: jsii.String("flattenResponse"),
	parameters: parameters,
}

Experimental.

type AwsApiCallResult

type AwsApiCallResult struct {
	// The full api response.
	// Experimental.
	ApiCallResponse interface{} `field:"required" json:"apiCallResponse" yaml:"apiCallResponse"`
}

The result from a SdkQuery.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var apiCallResponse interface{}

awsApiCallResult := &awsApiCallResult{
	apiCallResponse: apiCallResponse,
}

Experimental.

type EqualsAssertion

type EqualsAssertion interface {
	awscdk.Construct
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// The result of the assertion.
	// Experimental.
	Result() *string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

Construct that creates a CustomResource to assert that two values are equal.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var actualResult actualResult
var expectedResult expectedResult

equalsAssertion := awscdk.Integ_tests.NewEqualsAssertion(this, jsii.String("MyEqualsAssertion"), &equalsAssertionProps{
	actual: actualResult,
	expected: expectedResult,

	// the properties below are optional
	failDeployment: jsii.Boolean(false),
})

Experimental.

func NewEqualsAssertion

func NewEqualsAssertion(scope constructs.Construct, id *string, props *EqualsAssertionProps) EqualsAssertion

Experimental.

type EqualsAssertionProps

type EqualsAssertionProps struct {
	// The actual results to compare.
	// Experimental.
	Actual ActualResult `field:"required" json:"actual" yaml:"actual"`
	// The expected result to assert.
	// Experimental.
	Expected ExpectedResult `field:"required" json:"expected" yaml:"expected"`
	// Set this to true if a failed assertion should result in a CloudFormation deployment failure.
	//
	// This is only necessary if assertions are being
	// executed outside of `integ-runner`.
	// Experimental.
	FailDeployment *bool `field:"optional" json:"failDeployment" yaml:"failDeployment"`
}

Options for an EqualsAssertion.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var actualResult actualResult
var expectedResult expectedResult

equalsAssertionProps := &equalsAssertionProps{
	actual: actualResult,
	expected: expectedResult,

	// the properties below are optional
	failDeployment: jsii.Boolean(false),
}

Experimental.

type ExpectedResult

type ExpectedResult interface {
	// The expected results encoded as a string.
	// Experimental.
	Result() *string
	// Experimental.
	SetResult(val *string)
}

Represents the "expected" results to compare.

Example:

var app app
var integ integTest

integ.assertions.awsApiCall(jsii.String("SQS"), jsii.String("sendMessage"), map[string]*string{
	"QueueUrl": jsii.String("url"),
	"MessageBody": jsii.String("hello"),
})
message := integ.assertions.awsApiCall(jsii.String("SQS"), jsii.String("receiveMessage"), map[string]*string{
	"QueueUrl": jsii.String("url"),
})
message.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"Messages": []interface{}{
		map[string]*string{
			"Body": jsii.String("hello"),
		},
	},
}))

Experimental.

func ExpectedResult_ArrayWith

func ExpectedResult_ArrayWith(expected *[]interface{}) ExpectedResult

The actual results must be a list and must contain an item with the expected results.

Example:

// actual results
actual := []map[string]*string{
	map[string]*string{
		"stringParam": jsii.String("hello"),
	},
	map[string]*string{
		"stringParam": jsii.String("world"),
	},
}
// pass
awscdk.ExpectedResult.arrayWith([]interface{}{
	map[string]*string{
		"stringParam": jsii.String("hello"),
	},
})

Experimental.

func ExpectedResult_Exact

func ExpectedResult_Exact(expected interface{}) ExpectedResult

The actual results must match exactly.

Missing data will result in a failure.

Example:

// actual results
actual := map[string]interface{}{
	"stringParam": jsii.String("hello"),
	"numberParam": jsii.Number(3),
	"booleanParam": jsii.Boolean(true),
}
// pass
awscdk.ExpectedResult.exact(map[string]interface{}{
	"stringParam": jsii.String("hello"),
	"numberParam": jsii.Number(3),
	"booleanParam": jsii.Boolean(true),
})

// fail
awscdk.ExpectedResult.exact(map[string]*string{
	"stringParam": jsii.String("hello"),
})

Experimental.

func ExpectedResult_ObjectLike

func ExpectedResult_ObjectLike(expected *map[string]interface{}) ExpectedResult

The expected results must be a subset of the actual results.

Example:

// actual results
actual := map[string]interface{}{
	"stringParam": jsii.String("hello"),
	"numberParam": jsii.Number(3),
	"booleanParam": jsii.Boolean(true),
}
// pass
awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"stringParam": jsii.String("hello"),
})

Experimental.

func ExpectedResult_StringLikeRegexp

func ExpectedResult_StringLikeRegexp(expected *string) ExpectedResult

Actual results is a string that matches the Expected result regex.

Example:

// actual results
actual := "some string value"

// pass
awscdk.ExpectedResult.stringLikeRegexp(jsii.String("value"))

Experimental.

type IAwsApiCall

type IAwsApiCall interface {
	awscdk.IConstruct
	// Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.
	//
	// For example the SQS.receiveMessage api response would look
	// like:
	//
	// If you wanted to assert the value of `Body` you could do.
	//
	// Example:
	//   var integ integTest
	//   actual := map[string][]map[string]interface{}{
	//   	"Messages": []map[string]interface{}{
	//   		map[string]interface{}{
	//   			"MessageId": jsii.String(""),
	//   			"ReceiptHandle": jsii.String(""),
	//   			"MD5OfBody": jsii.String(""),
	//   			"Body": jsii.String("hello"),
	//   			"Attributes": map[string]interface{}{
	//   			},
	//   			"MD5OfMessageAttributes": map[string]interface{}{
	//   			},
	//   			"MessageAttributes": map[string]interface{}{
	//   			},
	//   		},
	//   	},
	//   }
	//   message := integ.assertions.awsApiCall(jsii.String("SQS"), jsii.String("receiveMessage"))
	//
	//   message.assertAtPath(jsii.String("Messages.0.Body"), awscdk.ExpectedResult.stringLikeRegexp(jsii.String("hello")))
	//
	// Experimental.
	AssertAtPath(path *string, expected ExpectedResult)
	// Assert that the ExpectedResult is equal to the result of the AwsApiCall.
	//
	// Example:
	//   var integ integTest
	//
	//   invoke := integ.assertions.invokeFunction(&lambdaInvokeFunctionProps{
	//   	functionName: jsii.String("my-func"),
	//   })
	//   invoke.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	//   	"Payload": jsii.String("OK"),
	//   }))
	//
	// Experimental.
	Expect(expected ExpectedResult)
	// Returns the value of an attribute of the custom resource of an arbitrary type.
	//
	// Attributes are returned from the custom resource provider through the
	// `Data` map where the key is the attribute name.
	//
	// Returns: a token for `Fn::GetAtt`. Use `Token.asXxx` to encode the returned `Reference` as a specific type or
	// use the convenience `getAttString` for string attributes.
	// Experimental.
	GetAtt(attributeName *string) awscdk.Reference
	// Returns the value of an attribute of the custom resource of type string.
	//
	// Attributes are returned from the custom resource provider through the
	// `Data` map where the key is the attribute name.
	//
	// Returns: a token for `Fn::GetAtt` encoded as a string.
	// Experimental.
	GetAttString(attributeName *string) *string
}

Interface for creating a custom resource that will perform an API call using the AWS SDK. Experimental.

type IDeployAssert

type IDeployAssert interface {
	// Query AWS using JavaScript SDK V2 API calls.
	//
	// This can be used to either
	// trigger an action or to return a result that can then be asserted against
	// an expected value.
	//
	// Example:
	//   var app app
	//   var integ integTest
	//
	//   integ.assertions.awsApiCall(jsii.String("SQS"), jsii.String("sendMessage"), map[string]*string{
	//   	"QueueUrl": jsii.String("url"),
	//   	"MessageBody": jsii.String("hello"),
	//   })
	//   message := integ.assertions.awsApiCall(jsii.String("SQS"), jsii.String("receiveMessage"), map[string]*string{
	//   	"QueueUrl": jsii.String("url"),
	//   })
	//   message.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	//   	"Messages": []interface{}{
	//   		map[string]*string{
	//   			"Body": jsii.String("hello"),
	//   		},
	//   	},
	//   }))
	//
	// Experimental.
	AwsApiCall(service *string, api *string, parameters interface{}) IAwsApiCall
	// Assert that the ExpectedResult is equal to the ActualResult.
	//
	// Example:
	//   var integ integTest
	//   var apiCall awsApiCall
	//
	//   integ.assertions.expect(jsii.String("invoke"), awscdk.ExpectedResult.objectLike(map[string]interface{}{
	//   	"Payload": jsii.String("OK"),
	//   }), awscdk.ActualResult.fromAwsApiCall(apiCall, jsii.String("Body")))
	//
	// Experimental.
	Expect(id *string, expected ExpectedResult, actual ActualResult)
	// Invoke a lambda function and return the response which can be asserted.
	//
	// Example:
	//   var app app
	//   var integ integTest
	//
	//   invoke := integ.assertions.invokeFunction(&lambdaInvokeFunctionProps{
	//   	functionName: jsii.String("my-function"),
	//   })
	//   invoke.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	//   	"Payload": jsii.String("200"),
	//   }))
	//
	// Experimental.
	InvokeFunction(props *LambdaInvokeFunctionProps) IAwsApiCall
}

Interface that allows for registering a list of assertions that should be performed on a construct.

This is only necessary when writing integration tests. Experimental.

type IntegTest

type IntegTest interface {
	awscdk.Construct
	// Make assertions on resources in this test case.
	// Experimental.
	Assertions() IDeployAssert
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

A collection of test cases.

Each test case file should contain exactly one instance of this class.

Example:

var lambdaFunction iFunction
var app app

stack := awscdk.NewStack(app, jsii.String("cdk-integ-lambda-bundling"))

integ := awscdk.NewIntegTest(app, jsii.String("IntegTest"), &integTestProps{
	testCases: []stack{
		stack,
	},
})

invoke := integ.assertions.invokeFunction(&lambdaInvokeFunctionProps{
	functionName: lambdaFunction.functionName,
})
invoke.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"Payload": jsii.String("200"),
}))

Experimental.

func NewIntegTest

func NewIntegTest(scope constructs.Construct, id *string, props *IntegTestProps) IntegTest

Experimental.

type IntegTestCase

type IntegTestCase interface {
	awscdk.Construct
	// Make assertions on resources in this test case.
	// Experimental.
	Assertions() IDeployAssert
	// The integration test manifest for this test case.
	//
	// Manifests are used
	// by the integration test runner.
	// Experimental.
	Manifest() *cloudassemblyschema.IntegManifest
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

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 monocdk "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 := awscdk.Integ_tests.NewIntegTestCase(this, jsii.String("MyIntegTestCase"), &integTestCaseProps{
	stacks: []*stack{
		stack,
	},

	// the properties below are optional
	allowDestroy: []*string{
		jsii.String("allowDestroy"),
	},
	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),
				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"),
		},
	},
	regions: []*string{
		jsii.String("regions"),
	},
	stackUpdateWorkflow: jsii.Boolean(false),
})

Experimental.

func NewIntegTestCase

func NewIntegTestCase(scope constructs.Construct, id *string, props *IntegTestCaseProps) IntegTestCase

Experimental.

type IntegTestCaseProps

type IntegTestCaseProps struct {
	// 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']
	// Experimental.
	AllowDestroy *[]*string `field:"optional" json:"allowDestroy" yaml:"allowDestroy"`
	// Additional options to use for each CDK command.
	// Experimental.
	CdkCommandOptions *cloudassemblyschema.CdkCommands `field:"optional" json:"cdkCommandOptions" yaml:"cdkCommandOptions"`
	// 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.
	// Experimental.
	DiffAssets *bool `field:"optional" json:"diffAssets" yaml:"diffAssets"`
	// Additional commands to run at predefined points in the test workflow.
	//
	// e.g. { postDeploy: ['yarn', 'test'] }
	// Experimental.
	Hooks *cloudassemblyschema.Hooks `field:"optional" json:"hooks" yaml:"hooks"`
	// Limit deployment to these regions.
	// Experimental.
	Regions *[]*string `field:"optional" json:"regions" yaml:"regions"`
	// 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.
	// Experimental.
	StackUpdateWorkflow *bool `field:"optional" json:"stackUpdateWorkflow" yaml:"stackUpdateWorkflow"`
	// Stacks to be deployed during the test.
	// Experimental.
	Stacks *[]awscdk.Stack `field:"required" json:"stacks" yaml:"stacks"`
}

Properties of an integration test case.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import monocdk "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

integTestCaseProps := &integTestCaseProps{
	stacks: []*stack{
		stack,
	},

	// the properties below are optional
	allowDestroy: []*string{
		jsii.String("allowDestroy"),
	},
	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),
				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"),
		},
	},
	regions: []*string{
		jsii.String("regions"),
	},
	stackUpdateWorkflow: jsii.Boolean(false),
}

Experimental.

type IntegTestCaseStack

type IntegTestCaseStack interface {
	awscdk.Stack
	// The AWS account into which this stack will be deployed.
	//
	// This value is resolved according to the following rules:
	//
	// 1. The value provided to `env.account` when the stack is defined. This can
	//     either be a concerete account (e.g. `585695031111`) or the
	//     `Aws.accountId` token.
	// 3. `Aws.accountId`, which represents the CloudFormation intrinsic reference
	//     `{ "Ref": "AWS::AccountId" }` encoded as a string token.
	//
	// Preferably, you should use the return value as an opaque string and not
	// attempt to parse it to implement your logic. If you do, you must first
	// check that it is a concerete value an not an unresolved token. If this
	// value is an unresolved token (`Token.isUnresolved(stack.account)` returns
	// `true`), this implies that the user wishes that this stack will synthesize
	// into a **account-agnostic template**. In this case, your code should either
	// fail (throw an error, emit a synth error using `Annotations.of(construct).addError()`) or
	// implement some other region-agnostic behavior.
	// Experimental.
	Account() *string
	// The ID of the cloud assembly artifact for this stack.
	// Experimental.
	ArtifactId() *string
	// Make assertions on resources in this test case.
	// Experimental.
	Assertions() IDeployAssert
	// Returns the list of AZs that are available in the AWS environment (account/region) associated with this stack.
	//
	// If the stack is environment-agnostic (either account and/or region are
	// tokens), this property will return an array with 2 tokens that will resolve
	// at deploy-time to the first two availability zones returned from CloudFormation's
	// `Fn::GetAZs` intrinsic function.
	//
	// If they are not available in the context, returns a set of dummy values and
	// reports them as missing, and let the CLI resolve them by calling EC2
	// `DescribeAvailabilityZones` on the target environment.
	//
	// To specify a different strategy for selecting availability zones override this method.
	// Experimental.
	AvailabilityZones() *[]*string
	// Indicates whether the stack requires bundling or not.
	// Experimental.
	BundlingRequired() *bool
	// Return the stacks this stack depends on.
	// Experimental.
	Dependencies() *[]awscdk.Stack
	// The environment coordinates in which this stack is deployed.
	//
	// In the form
	// `aws://account/region`. Use `stack.account` and `stack.region` to obtain
	// the specific values, no need to parse.
	//
	// You can use this value to determine if two stacks are targeting the same
	// environment.
	//
	// If either `stack.account` or `stack.region` are not concrete values (e.g.
	// `Aws.account` or `Aws.region`) the special strings `unknown-account` and/or
	// `unknown-region` will be used respectively to indicate this stack is
	// region/account-agnostic.
	// Experimental.
	Environment() *string
	// Indicates if this is a nested stack, in which case `parentStack` will include a reference to it's parent.
	// Experimental.
	Nested() *bool
	// If this is a nested stack, returns it's parent stack.
	// Experimental.
	NestedStackParent() awscdk.Stack
	// If this is a nested stack, this represents its `AWS::CloudFormation::Stack` resource.
	//
	// `undefined` for top-level (non-nested) stacks.
	// Experimental.
	NestedStackResource() awscdk.CfnResource
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Returns the list of notification Amazon Resource Names (ARNs) for the current stack.
	// Experimental.
	NotificationArns() *[]*string
	// Returns the parent of a nested stack.
	// Deprecated: use `nestedStackParent`.
	ParentStack() awscdk.Stack
	// The partition in which this stack is defined.
	// Experimental.
	Partition() *string
	// The AWS region into which this stack will be deployed (e.g. `us-west-2`).
	//
	// This value is resolved according to the following rules:
	//
	// 1. The value provided to `env.region` when the stack is defined. This can
	//     either be a concerete region (e.g. `us-west-2`) or the `Aws.region`
	//     token.
	// 3. `Aws.region`, which is represents the CloudFormation intrinsic reference
	//     `{ "Ref": "AWS::Region" }` encoded as a string token.
	//
	// Preferably, you should use the return value as an opaque string and not
	// attempt to parse it to implement your logic. If you do, you must first
	// check that it is a concerete value an not an unresolved token. If this
	// value is an unresolved token (`Token.isUnresolved(stack.region)` returns
	// `true`), this implies that the user wishes that this stack will synthesize
	// into a **region-agnostic template**. In this case, your code should either
	// fail (throw an error, emit a synth error using `Annotations.of(construct).addError()`) or
	// implement some other region-agnostic behavior.
	// Experimental.
	Region() *string
	// The ID of the stack.
	//
	// Example:
	//   // After resolving, looks like
	//   'arn:aws:cloudformation:us-west-2:123456789012:stack/teststack/51af3dc0-da77-11e4-872e-1234567db123'
	//
	// Experimental.
	StackId() *string
	// The concrete CloudFormation physical stack name.
	//
	// This is either the name defined explicitly in the `stackName` prop or
	// allocated based on the stack's location in the construct tree. Stacks that
	// are directly defined under the app use their construct `id` as their stack
	// name. Stacks that are defined deeper within the tree will use a hashed naming
	// scheme based on the construct path to ensure uniqueness.
	//
	// If you wish to obtain the deploy-time AWS::StackName intrinsic,
	// you can use `Aws.stackName` directly.
	// Experimental.
	StackName() *string
	// Synthesis method for this stack.
	// Experimental.
	Synthesizer() awscdk.IStackSynthesizer
	// Tags to be applied to the stack.
	// Experimental.
	Tags() awscdk.TagManager
	// The name of the CloudFormation template file emitted to the output directory during synthesis.
	//
	// Example value: `MyStack.template.json`
	// Experimental.
	TemplateFile() *string
	// Options for CloudFormation template (like version, transform, description).
	// Experimental.
	TemplateOptions() awscdk.ITemplateOptions
	// Whether termination protection is enabled for this stack.
	// Experimental.
	TerminationProtection() *bool
	// The Amazon domain suffix for the region in which this stack is defined.
	// Experimental.
	UrlSuffix() *string
	// Add a dependency between this stack and another stack.
	//
	// This can be used to define dependencies between any two stacks within an
	// app, and also supports nested stacks.
	// Experimental.
	AddDependency(target awscdk.Stack, reason *string)
	// Register a docker image asset on this Stack.
	// Deprecated: Use `stack.synthesizer.addDockerImageAsset()` if you are calling,
	// and a different `IStackSynthesizer` class if you are implementing.
	AddDockerImageAsset(asset *awscdk.DockerImageAssetSource) *awscdk.DockerImageAssetLocation
	// Register a file asset on this Stack.
	// Deprecated: Use `stack.synthesizer.addFileAsset()` if you are calling,
	// and a different IStackSynthesizer class if you are implementing.
	AddFileAsset(asset *awscdk.FileAssetSource) *awscdk.FileAssetLocation
	// Add a Transform to this stack. A Transform is a macro that AWS CloudFormation uses to process your template.
	//
	// Duplicate values are removed when stack is synthesized.
	//
	// Example:
	//   declare const stack: Stack;
	//
	//   stack.addTransform('AWS::Serverless-2016-10-31')
	//
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html
	//
	// Experimental.
	AddTransform(transform *string)
	// Returns the naming scheme used to allocate logical IDs.
	//
	// By default, uses
	// the `HashedAddressingScheme` but this method can be overridden to customize
	// this behavior.
	//
	// In order to make sure logical IDs are unique and stable, we hash the resource
	// construct tree path (i.e. toplevel/secondlevel/.../myresource) and add it as
	// a suffix to the path components joined without a separator (CloudFormation
	// IDs only allow alphanumeric characters).
	//
	// The result will be:
	//
	//    <path.join(”)><md5(path.join('/')>
	//      "human"      "hash"
	//
	// If the "human" part of the ID exceeds 240 characters, we simply trim it so
	// the total ID doesn't exceed CloudFormation's 255 character limit.
	//
	// We only take 8 characters from the md5 hash (0.000005 chance of collision).
	//
	// Special cases:
	//
	// - If the path only contains a single component (i.e. it's a top-level
	//    resource), we won't add the hash to it. The hash is not needed for
	//    disamiguation and also, it allows for a more straightforward migration an
	//    existing CloudFormation template to a CDK stack without logical ID changes
	//    (or renames).
	// - For aesthetic reasons, if the last components of the path are the same
	//    (i.e. `L1/L2/Pipeline/Pipeline`), they will be de-duplicated to make the
	//    resulting human portion of the ID more pleasing: `L1L2Pipeline<HASH>`
	//    instead of `L1L2PipelinePipeline<HASH>`
	// - If a component is named "Default" it will be omitted from the path. This
	//    allows refactoring higher level abstractions around constructs without affecting
	//    the IDs of already deployed resources.
	// - If a component is named "Resource" it will be omitted from the user-visible
	//    path, but included in the hash. This reduces visual noise in the human readable
	//    part of the identifier.
	// Experimental.
	AllocateLogicalId(cfnElement awscdk.CfnElement) *string
	// Create a CloudFormation Export for a value.
	//
	// Returns a string representing the corresponding `Fn.importValue()`
	// expression for this Export. You can control the name for the export by
	// passing the `name` option.
	//
	// If you don't supply a value for `name`, the value you're exporting must be
	// a Resource attribute (for example: `bucket.bucketName`) and it will be
	// given the same name as the automatic cross-stack reference that would be created
	// if you used the attribute in another Stack.
	//
	// One of the uses for this method is to *remove* the relationship between
	// two Stacks established by automatic cross-stack references. It will
	// temporarily ensure that the CloudFormation Export still exists while you
	// remove the reference from the consuming stack. After that, you can remove
	// the resource and the manual export.
	//
	// ## Example
	//
	// Here is how the process works. Let's say there are two stacks,
	// `producerStack` and `consumerStack`, and `producerStack` has a bucket
	// called `bucket`, which is referenced by `consumerStack` (perhaps because
	// an AWS Lambda Function writes into it, or something like that).
	//
	// It is not safe to remove `producerStack.bucket` because as the bucket is being
	// deleted, `consumerStack` might still be using it.
	//
	// Instead, the process takes two deployments:
	//
	// ### Deployment 1: break the relationship
	//
	// - Make sure `consumerStack` no longer references `bucket.bucketName` (maybe the consumer
	//    stack now uses its own bucket, or it writes to an AWS DynamoDB table, or maybe you just
	//    remove the Lambda Function altogether).
	// - In the `ProducerStack` class, call `this.exportValue(this.bucket.bucketName)`. This
	//    will make sure the CloudFormation Export continues to exist while the relationship
	//    between the two stacks is being broken.
	// - Deploy (this will effectively only change the `consumerStack`, but it's safe to deploy both).
	//
	// ### Deployment 2: remove the bucket resource
	//
	// - You are now free to remove the `bucket` resource from `producerStack`.
	// - Don't forget to remove the `exportValue()` call as well.
	// - Deploy again (this time only the `producerStack` will be changed -- the bucket will be deleted).
	// Experimental.
	ExportValue(exportedValue interface{}, options *awscdk.ExportValueOptions) *string
	// Creates an ARN from components.
	//
	// If `partition`, `region` or `account` are not specified, the stack's
	// partition, region and account will be used.
	//
	// If any component is the empty string, an empty string will be inserted
	// into the generated ARN at the location that component corresponds to.
	//
	// The ARN will be formatted as follows:
	//
	//    arn:{partition}:{service}:{region}:{account}:{resource}{sep}}{resource-name}
	//
	// The required ARN pieces that are omitted will be taken from the stack that
	// the 'scope' is attached to. If all ARN pieces are supplied, the supplied scope
	// can be 'undefined'.
	// Experimental.
	FormatArn(components *awscdk.ArnComponents) *string
	// Allocates a stack-unique CloudFormation-compatible logical identity for a specific resource.
	//
	// This method is called when a `CfnElement` is created and used to render the
	// initial logical identity of resources. Logical ID renames are applied at
	// this stage.
	//
	// This method uses the protected method `allocateLogicalId` to render the
	// logical ID for an element. To modify the naming scheme, extend the `Stack`
	// class and override this method.
	// Experimental.
	GetLogicalId(element awscdk.CfnElement) *string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Given an ARN, parses it and returns components.
	//
	// IF THE ARN IS A CONCRETE STRING...
	//
	// ...it will be parsed and validated. The separator (`sep`) will be set to '/'
	// if the 6th component includes a '/', in which case, `resource` will be set
	// to the value before the '/' and `resourceName` will be the rest. In case
	// there is no '/', `resource` will be set to the 6th components and
	// `resourceName` will be set to the rest of the string.
	//
	// IF THE ARN IS A TOKEN...
	//
	// ...it cannot be validated, since we don't have the actual value yet at the
	// time of this function call. You will have to supply `sepIfToken` and
	// whether or not ARNs of the expected format usually have resource names
	// in order to parse it properly. The resulting `ArnComponents` object will
	// contain tokens for the subexpressions of the ARN, not string literals.
	//
	// If the resource name could possibly contain the separator char, the actual
	// resource name cannot be properly parsed. This only occurs if the separator
	// char is '/', and happens for example for S3 object ARNs, IAM Role ARNs,
	// IAM OIDC Provider ARNs, etc. To properly extract the resource name from a
	// Tokenized ARN, you must know the resource type and call
	// `Arn.extractResourceName`.
	//
	// Returns: an ArnComponents object which allows access to the various
	// components of the ARN.
	// Deprecated: use splitArn instead.
	ParseArn(arn *string, sepIfToken *string, hasName *bool) *awscdk.ArnComponents
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Deprecated.
	//
	// Returns: reference itself without any change.
	// See: https://github.com/aws/aws-cdk/pull/7187
	//
	// Deprecated: cross reference handling has been moved to `App.prepare()`.
	PrepareCrossReference(_sourceStack awscdk.Stack, reference awscdk.Reference) awscdk.IResolvable
	// Look up a fact value for the given fact for the region of this stack.
	//
	// Will return a definite value only if the region of the current stack is resolved.
	// If not, a lookup map will be added to the stack and the lookup will be done at
	// CDK deployment time.
	//
	// What regions will be included in the lookup map is controlled by the
	// `@aws-cdk/core:target-partitions` context value: it must be set to a list
	// of partitions, and only regions from the given partitions will be included.
	// If no such context key is set, all regions will be included.
	//
	// This function is intended to be used by construct library authors. Application
	// builders can rely on the abstractions offered by construct libraries and do
	// not have to worry about regional facts.
	//
	// If `defaultValue` is not given, it is an error if the fact is unknown for
	// the given region.
	// Experimental.
	RegionalFact(factName *string, defaultValue *string) *string
	// Rename a generated logical identities.
	//
	// To modify the naming scheme strategy, extend the `Stack` class and
	// override the `allocateLogicalId` method.
	// Experimental.
	RenameLogicalId(oldId *string, newId *string)
	// DEPRECATED.
	// Deprecated: use `reportMissingContextKey()`.
	ReportMissingContext(report *cxapi.MissingContext)
	// Indicate that a context key was expected.
	//
	// Contains instructions which will be emitted into the cloud assembly on how
	// the key should be supplied.
	// Experimental.
	ReportMissingContextKey(report *cloudassemblyschema.MissingContext)
	// Resolve a tokenized value in the context of the current stack.
	// Experimental.
	Resolve(obj interface{}) interface{}
	// Splits the provided ARN into its components.
	//
	// Works both if 'arn' is a string like 'arn:aws:s3:::bucket',
	// and a Token representing a dynamic CloudFormation expression
	// (in which case the returned components will also be dynamic CloudFormation expressions,
	// encoded as Tokens).
	// Experimental.
	SplitArn(arn *string, arnFormat awscdk.ArnFormat) *awscdk.ArnComponents
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Convert an object, potentially containing tokens, to a JSON string.
	// Experimental.
	ToJsonString(obj interface{}, space *float64) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

An integration test case stack. Allows the definition of test properties that should apply to this stack.

This should be used if there are multiple stacks in the integration test and it is necessary to specify different test case option for each. Otherwise normal stacks should be added to IntegTest.

Example:

var app app
var stackUnderTest stack

testCaseWithAssets := awscdk.NewIntegTestCaseStack(app, jsii.String("TestCaseAssets"), &integTestCaseStackProps{
	diffAssets: jsii.Boolean(true),
})

awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stackUnderTest,
		testCaseWithAssets,
	},
})

Experimental.

func NewIntegTestCaseStack

func NewIntegTestCaseStack(scope constructs.Construct, id *string, props *IntegTestCaseStackProps) IntegTestCaseStack

Experimental.

type IntegTestCaseStackProps

type IntegTestCaseStackProps struct {
	// 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']
	// Experimental.
	AllowDestroy *[]*string `field:"optional" json:"allowDestroy" yaml:"allowDestroy"`
	// Additional options to use for each CDK command.
	// Experimental.
	CdkCommandOptions *cloudassemblyschema.CdkCommands `field:"optional" json:"cdkCommandOptions" yaml:"cdkCommandOptions"`
	// 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.
	// Experimental.
	DiffAssets *bool `field:"optional" json:"diffAssets" yaml:"diffAssets"`
	// Additional commands to run at predefined points in the test workflow.
	//
	// e.g. { postDeploy: ['yarn', 'test'] }
	// Experimental.
	Hooks *cloudassemblyschema.Hooks `field:"optional" json:"hooks" yaml:"hooks"`
	// Limit deployment to these regions.
	// Experimental.
	Regions *[]*string `field:"optional" json:"regions" yaml:"regions"`
	// 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.
	// Experimental.
	StackUpdateWorkflow *bool `field:"optional" json:"stackUpdateWorkflow" yaml:"stackUpdateWorkflow"`
	// Include runtime versioning information in this Stack.
	// Experimental.
	AnalyticsReporting *bool `field:"optional" json:"analyticsReporting" yaml:"analyticsReporting"`
	// A description of the stack.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The AWS environment (account/region) where this stack will be deployed.
	//
	// Set the `region`/`account` fields of `env` to either a concrete value to
	// select the indicated environment (recommended for production stacks), or to
	// the values of environment variables
	// `CDK_DEFAULT_REGION`/`CDK_DEFAULT_ACCOUNT` to let the target environment
	// depend on the AWS credentials/configuration that the CDK CLI is executed
	// under (recommended for development stacks).
	//
	// If the `Stack` is instantiated inside a `Stage`, any undefined
	// `region`/`account` fields from `env` will default to the same field on the
	// encompassing `Stage`, if configured there.
	//
	// If either `region` or `account` are not set nor inherited from `Stage`, the
	// Stack will be considered "*environment-agnostic*"". Environment-agnostic
	// stacks can be deployed to any environment but may not be able to take
	// advantage of all features of the CDK. For example, they will not be able to
	// use environmental context lookups such as `ec2.Vpc.fromLookup` and will not
	// automatically translate Service Principals to the right format based on the
	// environment's AWS partition, and other such enhancements.
	//
	// Example:
	//   // Use a concrete account and region to deploy this stack to:
	//   // `.account` and `.region` will simply return these values.
	//   new Stack(app, 'Stack1', {
	//     env: {
	//       account: '123456789012',
	//       region: 'us-east-1'
	//     },
	//   });
	//
	//   // Use the CLI's current credentials to determine the target environment:
	//   // `.account` and `.region` will reflect the account+region the CLI
	//   // is configured to use (based on the user CLI credentials)
	//   new Stack(app, 'Stack2', {
	//     env: {
	//       account: process.env.CDK_DEFAULT_ACCOUNT,
	//       region: process.env.CDK_DEFAULT_REGION
	//     },
	//   });
	//
	//   // Define multiple stacks stage associated with an environment
	//   const myStage = new Stage(app, 'MyStage', {
	//     env: {
	//       account: '123456789012',
	//       region: 'us-east-1'
	//     }
	//   });
	//
	//   // both of these stacks will use the stage's account/region:
	//   // `.account` and `.region` will resolve to the concrete values as above
	//   new MyStack(myStage, 'Stack1');
	//   new YourStack(myStage, 'Stack2');
	//
	//   // Define an environment-agnostic stack:
	//   // `.account` and `.region` will resolve to `{ "Ref": "AWS::AccountId" }` and `{ "Ref": "AWS::Region" }` respectively.
	//   // which will only resolve to actual values by CloudFormation during deployment.
	//   new MyStack(app, 'Stack1');
	//
	// Experimental.
	Env *awscdk.Environment `field:"optional" json:"env" yaml:"env"`
	// Name to deploy the stack with.
	// Experimental.
	StackName *string `field:"optional" json:"stackName" yaml:"stackName"`
	// Synthesis method to use while deploying this stack.
	// Experimental.
	Synthesizer awscdk.IStackSynthesizer `field:"optional" json:"synthesizer" yaml:"synthesizer"`
	// Stack tags that will be applied to all the taggable resources and the stack itself.
	// Experimental.
	Tags *map[string]*string `field:"optional" json:"tags" yaml:"tags"`
	// Whether to enable termination protection for this stack.
	// Experimental.
	TerminationProtection *bool `field:"optional" json:"terminationProtection" yaml:"terminationProtection"`
}

Properties of an integration test case stack.

Example:

var app app
var stackUnderTest stack

testCaseWithAssets := awscdk.NewIntegTestCaseStack(app, jsii.String("TestCaseAssets"), &integTestCaseStackProps{
	diffAssets: jsii.Boolean(true),
})

awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stackUnderTest,
		testCaseWithAssets,
	},
})

Experimental.

type IntegTestProps

type IntegTestProps struct {
	// 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']
	// Experimental.
	AllowDestroy *[]*string `field:"optional" json:"allowDestroy" yaml:"allowDestroy"`
	// Additional options to use for each CDK command.
	// Experimental.
	CdkCommandOptions *cloudassemblyschema.CdkCommands `field:"optional" json:"cdkCommandOptions" yaml:"cdkCommandOptions"`
	// 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.
	// Experimental.
	DiffAssets *bool `field:"optional" json:"diffAssets" yaml:"diffAssets"`
	// Additional commands to run at predefined points in the test workflow.
	//
	// e.g. { postDeploy: ['yarn', 'test'] }
	// Experimental.
	Hooks *cloudassemblyschema.Hooks `field:"optional" json:"hooks" yaml:"hooks"`
	// Limit deployment to these regions.
	// Experimental.
	Regions *[]*string `field:"optional" json:"regions" yaml:"regions"`
	// 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.
	// Experimental.
	StackUpdateWorkflow *bool `field:"optional" json:"stackUpdateWorkflow" yaml:"stackUpdateWorkflow"`
	// List of test cases that make up this test.
	// Experimental.
	TestCases *[]awscdk.Stack `field:"required" json:"testCases" yaml:"testCases"`
}

Integration test properties.

Example:

var lambdaFunction iFunction
var app app

stack := awscdk.NewStack(app, jsii.String("cdk-integ-lambda-bundling"))

integ := awscdk.NewIntegTest(app, jsii.String("IntegTest"), &integTestProps{
	testCases: []stack{
		stack,
	},
})

invoke := integ.assertions.invokeFunction(&lambdaInvokeFunctionProps{
	functionName: lambdaFunction.functionName,
})
invoke.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"Payload": jsii.String("200"),
}))

Experimental.

type InvocationType

type InvocationType string

The type of invocation.

Default is REQUEST_RESPONE.

Example:

var app app
var stack stack
var queue queue
var fn iFunction

integ := awscdk.NewIntegTest(app, jsii.String("Integ"), &integTestProps{
	testCases: []*stack{
		stack,
	},
})

integ.assertions.invokeFunction(&lambdaInvokeFunctionProps{
	functionName: fn.functionName,
	invocationType: awscdk.InvocationType_EVENT,
	payload: jSON.stringify(map[string]*string{
		"status": jsii.String("OK"),
	}),
})

message := integ.assertions.awsApiCall(jsii.String("SQS"), jsii.String("receiveMessage"), map[string]interface{}{
	"QueueUrl": queue.queueUrl,
	"WaitTimeSeconds": jsii.Number(20),
})

message.assertAtPath(jsii.String("Messages.0.Body"), awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"requestContext": map[string]*string{
		"condition": jsii.String("Success"),
	},
	"requestPayload": map[string]*string{
		"status": jsii.String("OK"),
	},
	"responseContext": map[string]*f64{
		"statusCode": jsii.Number(200),
	},
	"responsePayload": jsii.String("success"),
}))

Experimental.

const (
	// Invoke the function asynchronously.
	//
	// Send events that fail multiple times to the function's
	// dead-letter queue (if it's configured).
	// The API response only includes a status code.
	// Experimental.
	InvocationType_EVENT InvocationType = "EVENT"
	// Invoke the function synchronously.
	//
	// Keep the connection open until the function returns a response or times out.
	// The API response includes the function response and additional data.
	// Experimental.
	InvocationType_REQUEST_RESPONE InvocationType = "REQUEST_RESPONE"
	// Validate parameter values and verify that the user or role has permission to invoke the function.
	// Experimental.
	InvocationType_DRY_RUN InvocationType = "DRY_RUN"
)

type LambdaInvokeFunction

type LambdaInvokeFunction interface {
	AwsApiCall
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	Provider() AssertionsProvider
	// Experimental.
	SetProvider(val AssertionsProvider)
	// Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.
	//
	// For example the SQS.receiveMessage api response would look
	// like:
	//
	// If you wanted to assert the value of `Body` you could do.
	// Experimental.
	AssertAtPath(path *string, expected ExpectedResult)
	// Assert that the ExpectedResult is equal to the result of the AwsApiCall.
	// Experimental.
	Expect(expected ExpectedResult)
	// Returns the value of an attribute of the custom resource of an arbitrary type.
	//
	// Attributes are returned from the custom resource provider through the
	// `Data` map where the key is the attribute name.
	// Experimental.
	GetAtt(attributeName *string) awscdk.Reference
	// Returns the value of an attribute of the custom resource of type string.
	//
	// Attributes are returned from the custom resource provider through the
	// `Data` map where the key is the attribute name.
	// Experimental.
	GetAttString(attributeName *string) *string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

An AWS Lambda Invoke function API call.

Use this istead of the generic AwsApiCall in order to invoke a lambda function. This will automatically create the correct permissions to invoke the function.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

lambdaInvokeFunction := awscdk.Integ_tests.NewLambdaInvokeFunction(this, jsii.String("MyLambdaInvokeFunction"), &lambdaInvokeFunctionProps{
	functionName: jsii.String("functionName"),

	// the properties below are optional
	invocationType: awscdk.*Integ_tests.invocationType_EVENT,
	logType: awscdk.*Integ_tests.logType_NONE,
	payload: jsii.String("payload"),
})

Experimental.

func NewLambdaInvokeFunction

func NewLambdaInvokeFunction(scope constructs.Construct, id *string, props *LambdaInvokeFunctionProps) LambdaInvokeFunction

Experimental.

type LambdaInvokeFunctionProps

type LambdaInvokeFunctionProps struct {
	// The name of the function to invoke.
	// Experimental.
	FunctionName *string `field:"required" json:"functionName" yaml:"functionName"`
	// The type of invocation to use.
	// Experimental.
	InvocationType InvocationType `field:"optional" json:"invocationType" yaml:"invocationType"`
	// Whether to return the logs as part of the response.
	// Experimental.
	LogType LogType `field:"optional" json:"logType" yaml:"logType"`
	// Payload to send as part of the invoke.
	// Experimental.
	Payload *string `field:"optional" json:"payload" yaml:"payload"`
}

Options to pass to the Lambda invokeFunction API call.

Example:

var lambdaFunction iFunction
var app app

stack := awscdk.NewStack(app, jsii.String("cdk-integ-lambda-bundling"))

integ := awscdk.NewIntegTest(app, jsii.String("IntegTest"), &integTestProps{
	testCases: []stack{
		stack,
	},
})

invoke := integ.assertions.invokeFunction(&lambdaInvokeFunctionProps{
	functionName: lambdaFunction.functionName,
})
invoke.expect(awscdk.ExpectedResult.objectLike(map[string]interface{}{
	"Payload": jsii.String("200"),
}))

Experimental.

type LogType

type LogType string

Set to Tail to include the execution log in the response.

Applies to synchronously invoked functions only. Experimental.

const (
	// The log messages are not returned in the response.
	// Experimental.
	LogType_NONE LogType = "NONE"
	// The log messages are returned in the response.
	// Experimental.
	LogType_TAIL LogType = "TAIL"
)

type Match

type Match interface {
}

Partial and special matching during assertions. Experimental.

type Status

type Status string

The status of the assertion. Experimental.

const (
	// The assertion passed.
	// Experimental.
	Status_PASS Status = "PASS"
	// The assertion failed.
	// Experimental.
	Status_FAIL Status = "FAIL"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL