Contract tests for resource types
As part of testing your resource, the CloudFormation CLI performs a suite of tests, each written to test a requirement contained in the resource type handler contract. Each handler invocation is expected to follow the general requirements for that handler listed in the contract. This topic lists tests that explicitly test some more specific requirements.
create
handler tests
The CloudFormation CLI performs the following contract tests for
create
handlers.
Test | Description |
---|---|
|
Creates a resource, waits for the resource creation to
complete, and then creates the resource again with the
expectation that the second create operation will fail with the
|
|
Creates a resource, waits for the resource creation to
complete, and then reads the created resource to ensure that the
input to the |
|
Creates a resource, waits for the resource creation to complete, and then deletes the created resource. It also checks if the create input is equal to the create output (which is then used for delete input), with the exception of readOnly and writeOnly properties. |
|
Creates a resource, waits for the resource creation to complete, and then lists out the resources with the expectation that the created resource exists in the returned list. |
update
handler tests
The CloudFormation CLI performs the following contract tests for
update
handlers.
Test | Description |
---|---|
|
Creates a resource, updates the resource, and then reads the resource to check that the update was made by comparing the read output with the update input. The comparison excludes read-only and write-only properties because they can't be included in the update input and read output, respectively. |
|
Creates a resource, updates the resource, and then lists the resource to check that the updated resource exists in the returned list. |
|
Updates a resource without creating it first. The test expects
the update operation to fail with the |
delete
handler tests
The CloudFormation CLI performs the following contract tests for
delete
handlers.
Test | Description |
---|---|
|
Creates a resource, deletes the resource, and then creates the resource again with the expectation that the deletion was successful and a new resource can be created. The CloudFormation CLI performs this contract test for resources with create-only primary identifiers. |
|
Creates a resource, deletes the resource, and then updates the
resource with the expectation that the update operation will
fail with the |
|
Creates a resource, deletes the resource, and then reads the
resource with the expectation that the read operation will fail
with the |
|
Creates a resource, deletes the resource, and then lists the resource with the expectation that the returned list doesn't contain the deleted resource. |
|
Creates a resource, deletes the resource, and then deletes the
resource again with the expectation that the second delete
operation will fail with the |