Skip to main content

tests

Creates, updates, deletes, gets or lists a tests resource.

Overview

Nametests
TypeResource
Idaws.resiliencehubv2.tests

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the test.
actionsarrayThe fault actions the test runs.
creation_timestring (date-time)The timestamp when the test was created.
logging_configurationobjectConfiguration for test execution logging destinations.
parametersobjectThe parameter values configured for the test.
role_namestringResource name (used in ARN — no spaces allowed). (pattern: <code>[A-Za-z0-9][A-Za-z0-9_-]{1,59}</code>)
service_arnstringARN identifier. (pattern: <code>arn:(aws|aws-cn|aws-iso|aws-iso-[a-z]{1}|aws-us-gov):[A-Za-z0-9][A-Za-z0-9_/.-]{0,62}:([a-z]{2}-((iso[a-z]{0,1}-)|(gov-)){0,1}[a-z]+-[0-9]):[0-9]{12}:[A-Za-z0-9/][A-Za-z0-9:_/+.-]{0,1023}</code>)
stop_conditionsarrayThe stop conditions for the test.
successful_test_runsintegerThe number of successful runs of the test.
test_idstringThe unique identifier of the test.
test_template_arnstringAn ARN owned by the service. Accepts either a standard 12-digit account ID or the literal "aws" for AWS-managed resources, such as AWS-managed test templates. (pattern: <code>arn:(aws|aws-cn|aws-iso|aws-iso-[a-z]{1}|aws-us-gov):[A-Za-z0-9][A-Za-z0-9_/.-]{0,62}:([a-z]{2}-((iso[a-z]{0,1}-)|(gov-)){0,1}[a-z]+-[0-9]):([0-9]{12}|aws):[A-Za-z0-9/][A-Za-z0-9:_/+.-]{0,1023}</code>)
total_test_runsintegerThe total number of runs of the test.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_testselecttestId, serviceArn, regionRetrieves a test by ID.
list_testsselectserviceArn, regionmaxResults, nextTokenLists the tests configured for a service.
create_testinsertregion, serviceArn, testTemplateArnCreates a test for a service by configuring a test template. Each service has one test per template.
update_testupdateregion, testId, serviceArnUpdates the configuration of an existing test.
delete_testdeleteregionDeletes a test.
start_test_runexecregion, testId, serviceArnStarts a run of a test. Each run scopes to the current resources in the service and produces a pass or fail outcome.
stop_test_runexecregion, testRunId, serviceArnStops an in-progress test run.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)
serviceArnstringThe ARN of the service to list tests for.
testIdstringThe identifier of the test to retrieve.
maxResultsinteger
nextTokenstring

SELECT examples

Retrieves a test by ID.

SELECT
name,
actions,
creation_time,
logging_configuration,
parameters,
role_name,
service_arn,
stop_conditions,
successful_test_runs,
test_id,
test_template_arn,
total_test_runs
FROM aws.resiliencehubv2.tests
WHERE testId = '{{ testId }}' -- required
AND serviceArn = '{{ serviceArn }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a test for a service by configuring a test template. Each service has one test per template.

INSERT INTO aws.resiliencehubv2.tests (
serviceArn,
testTemplateArn,
loggingConfiguration,
stopConditions,
roleName,
parameters,
region
)
SELECT
'{{ serviceArn }}' /* required */,
'{{ testTemplateArn }}' /* required */,
'{{ loggingConfiguration }}',
'{{ stopConditions }}',
'{{ roleName }}',
'{{ parameters }}',
'{{ region }}'
RETURNING
test
;

UPDATE examples

Updates the configuration of an existing test.

UPDATE aws.resiliencehubv2.tests
SET
testId = '{{ testId }}',
serviceArn = '{{ serviceArn }}',
loggingConfiguration = '{{ loggingConfiguration }}',
stopConditions = '{{ stopConditions }}',
roleName = '{{ roleName }}',
parameters = '{{ parameters }}'
WHERE
region = '{{ region }}' --required
AND testId = '{{ testId }}' --required
AND serviceArn = '{{ serviceArn }}' --required
RETURNING
test;

DELETE examples

Deletes a test.

DELETE FROM aws.resiliencehubv2.tests
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Starts a run of a test. Each run scopes to the current resources in the service and produces a pass or fail outcome.

EXEC aws.resiliencehubv2.tests.start_test_run
@region='{{ region }}' --required
@@json=
'{
"testId": "{{ testId }}",
"serviceArn": "{{ serviceArn }}"
}'
;