tests
Creates, updates, deletes, gets or lists a tests resource.
Overview
| Name | tests |
| Type | Resource |
| Id | aws.resiliencehubv2.tests |
Fields
The following fields are returned by SELECT queries:
- get_test
- list_tests
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the test. |
actions | array | The fault actions the test runs. |
creation_time | string (date-time) | The timestamp when the test was created. |
logging_configuration | object | Configuration for test execution logging destinations. |
parameters | object | The parameter values configured for the test. |
role_name | string | Resource name (used in ARN — no spaces allowed). (pattern: <code>[A-Za-z0-9][A-Za-z0-9_-]{1,59}</code>) |
service_arn | string | ARN 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_conditions | array | The stop conditions for the test. |
successful_test_runs | integer | The number of successful runs of the test. |
test_id | string | The unique identifier of the test. |
test_template_arn | string | An 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_runs | integer | The total number of runs of the test. |
| Name | Datatype | Description |
|---|---|---|
creation_time | string (date-time) | The timestamp when the test was created. |
service_arn | string | ARN 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>) |
successful_test_runs | integer | The number of successful runs of the test. |
test_id | string | The unique identifier of a test. |
test_template_arn | string | An 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_runs | integer | The total number of runs of the test. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_test | select | testId, serviceArn, region | Retrieves a test by ID. | |
list_tests | select | serviceArn, region | maxResults, nextToken | Lists the tests configured for a service. |
create_test | insert | region, serviceArn, testTemplateArn | Creates a test for a service by configuring a test template. Each service has one test per template. | |
update_test | update | region, testId, serviceArn | Updates the configuration of an existing test. | |
delete_test | delete | region | Deletes a test. | |
start_test_run | exec | region, testId, serviceArn | Starts a run of a test. Each run scopes to the current resources in the service and produces a pass or fail outcome. | |
stop_test_run | exec | region, testRunId, serviceArn | Stops 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
serviceArn | string | The ARN of the service to list tests for. |
testId | string | The identifier of the test to retrieve. |
maxResults | integer | |
nextToken | string |
SELECT examples
- get_test
- list_tests
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
;
Lists the tests configured for a service.
SELECT
creation_time,
service_arn,
successful_test_runs,
test_id,
test_template_arn,
total_test_runs
FROM aws.resiliencehubv2.tests
WHERE serviceArn = '{{ serviceArn }}' -- required
AND region = '{{ region }}' -- required
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
;
INSERT examples
- create_test
- Manifest
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
;
# Description fields are for documentation purposes
- name: tests
props:
- name: region
value: "{{ region }}"
description: Required parameter for the tests resource.
- name: serviceArn
value: "{{ serviceArn }}"
description: |
ARN identifier.
- name: testTemplateArn
value: "{{ testTemplateArn }}"
description: |
An 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.
- name: loggingConfiguration
description: |
Configuration for test execution logging destinations.
value:
s3BucketName: "{{ s3BucketName }}"
cloudWatchLogGroupArn: "{{ cloudWatchLogGroupArn }}"
logSchemaVersion: "{{ logSchemaVersion }}"
- name: stopConditions
value:
- source: "{{ source }}"
value: "{{ value }}"
- name: roleName
value: "{{ roleName }}"
description: |
Resource name (used in ARN — no spaces allowed).
- name: parameters
value: "{{ parameters }}"
UPDATE examples
- update_test
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
- delete_test
Deletes a test.
DELETE FROM aws.resiliencehubv2.tests
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- start_test_run
- stop_test_run
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 }}"
}'
;
Stops an in-progress test run.
EXEC aws.resiliencehubv2.tests.stop_test_run
@region='{{ region }}' --required
@@json=
'{
"testRunId": "{{ testRunId }}",
"serviceArn": "{{ serviceArn }}"
}'
;