[AWS Automation] Stack tear down mechanism for the deployment on Jenkins (#3656)

Make awsi_test_profile_vs2019 a nonblocking step to make sure that resources are cleaned up even though automation tests failed

Signed-off-by: Junbo Liang <junbo@amazon.com>
This commit is contained in:
Junbo Liang
2021-09-10 12:56:41 -07:00
committed by GitHub
parent 2629216e46
commit 3535d6b6b3
4 changed files with 121 additions and 15 deletions
+12 -10
View File
@@ -8,19 +8,21 @@
## Deploy CDK Applications
1. Go to the AWS IAM console and create an IAM role called o3de-automation-tests which adds your own account as as a trusted entity and uses the "AdministratorAccess" permissions policy.
2. Copy {engine_root}\scripts\build\Platform\Windows\deploy_cdk_applications.cmd to your engine root folder.
3. Open a Command Prompt window at the engine root and set the following environment variables:
Set O3DE_AWS_PROJECT_NAME=AWSAUTO
Set O3DE_AWS_DEPLOY_REGION=us-east-1
Set ASSUME_ROLE_ARN="arn:aws:iam::{your_aws_account_id}:role/o3de-automation-tests"
Set COMMIT_ID=HEAD
4. Deploy the CDK applications for AWS gems by running deploy_cdk_applications.cmd in the same Command Prompt window.
5. Edit AWS\common\constants.py to replace the assume role ARN with your own:
arn:aws:iam::{your_aws_account_id}:role/o3de-automation-tests
3. Open a new Command Prompt window at the engine root and set the following environment variables:
Set O3DE_AWS_PROJECT_NAME=AWSAUTO
Set O3DE_AWS_DEPLOY_REGION=us-east-1
Set ASSUME_ROLE_ARN="arn:aws:iam::{your_aws_account_id}:role/o3de-automation-tests"
Set COMMIT_ID=HEAD
4. In the same Command Prompt window, Deploy the CDK applications for AWS gems by running deploy_cdk_applications.cmd.
## Run Automation Tests
### CLI
Open a Command Prompt window at the engine root and run the following CLI command:
In the same Command Prompt window, run the following CLI command:
python\python.cmd -m pytest {path_to_the_test_file} --build-directory {directory_to_the_profile_build}
### Pycharm
You can also run any specific automation test directly from Pycharm by providing the "--build-directory" argument in the Run Configuration.
You can also run any specific automation test directly from Pycharm by providing the "--build-directory" argument in the Run Configuration.
## Destroy CDK Applications
1. Copy {engine_root}\scripts\build\Platform\Windows\destroy_cdk_applications.cmd to your engine root folder.
2. In the same Command Prompt window, destroy the CDK applications for AWS gems by running destroy_cdk_applications.cmd.
@@ -167,10 +167,6 @@ class TestAWSMetricsWindows(object):
args=(aws_metrics_utils, resource_mappings, True))
kinesis_analytics_application_thread.start()
# Clear the analytics bucket objects before sending new metrics.
aws_metrics_utils.empty_bucket(
resource_mappings.get_resource_name_id('AWSMetrics.AnalyticsBucketName'))
log_monitor = setup(launcher, asset_processor)
# Kinesis analytics application needs to be in the running state before we start the game launcher.
@@ -205,6 +201,10 @@ class TestAWSMetricsWindows(object):
for thread in operational_threads:
thread.join()
# Clear the analytics bucket objects so that the S3 bucket can be destroyed during tear down.
aws_metrics_utils.empty_bucket(
resource_mappings.get_resource_name_id('AWSMetrics.AnalyticsBucketName'))
def test_unauthorized_user_request_rejected(self,
level: str,
launcher: pytest.fixture,