From 5f061e668edf0fd36dd0f049a548340ebca9baf1 Mon Sep 17 00:00:00 2001 From: Prashant Srivastava <50466688+srprash@users.noreply.github.com> Date: Thu, 1 Sep 2022 14:31:20 -0700 Subject: [PATCH] Test linux zip in China & US Gov regions (#178) --- .github/workflows/continuous-build.yml | 39 ++++++++++++++++--- testing/README.md | 7 ++++ .../terraform/testcases/linux_zip_cn.tfvars | 5 +++ .../testcases/linux_zip_us_gov.tfvars | 5 +++ 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 testing/README.md create mode 100644 testing/terraform/testcases/linux_zip_cn.tfvars create mode 100644 testing/terraform/testcases/linux_zip_us_gov.tfvars diff --git a/.github/workflows/continuous-build.yml b/.github/workflows/continuous-build.yml index ca92f45..b4008ef 100644 --- a/.github/workflows/continuous-build.yml +++ b/.github/workflows/continuous-build.yml @@ -166,6 +166,8 @@ jobs: - linux_deb - linux_rpm - linux_zip + - linux_zip_cn + - linux_zip_us_gov steps: - name: Checkout repo @@ -185,20 +187,44 @@ jobs: # workaround for handling input value for auto-triggered workflows # https://dev.to/mrmike/github-action-handling-input-default-value-5f2g - - name: Set AWS region value + - name: Set AWS region and partition values id: setRegion run: | - USER_INPUT=${{ github.event.inputs.region }} - # Use user input region or fall back to "us-west-2" - REGION=${USER_INPUT:-"us-west-2"} - echo "::set-output name=region::$REGION" + if [[ ${{ matrix.testcases }} == "linux_zip_cn" ]]; then + echo "::set-output name=region::cn-north-1" + echo "::set-output name=partition::aws-cn" + elif [[ ${{ matrix.testcases }} == "linux_zip_us_gov" ]]; then + echo "::set-output name=region::us-gov-west-1" + echo "::set-output name=partition::aws-us-gov" + else + USER_INPUT=${{ github.event.inputs.region }} + # Use user input region or fall back to "us-west-2" + REGION=${USER_INPUT:-"us-west-2"} + echo "::set-output name=region::$REGION" + echo "::set-output name=partition::aws" + fi - name: Configure AWS Credentials + if: ${{ steps.setRegion.outputs.partition == 'aws' }} uses: aws-actions/configure-aws-credentials@v1 with: role-to-assume: ${{ secrets.TESTING_ROLE_ARN }} aws-region: ${{ steps.setRegion.outputs.region }} + - name: Configure AWS Credentials - China + if: ${{ steps.setRegion.outputs.partition == 'aws-cn' }} + uses: aws-actions/configure-aws-credentials@v1 + with: + role-to-assume: ${{ secrets.TESTING_ROLE_ARN_CN }} + aws-region: cn-north-1 + + - name: Configure AWS Credentials - US Gov + if: ${{ steps.setRegion.outputs.partition == 'aws-us-gov' }} + uses: aws-actions/configure-aws-credentials@v1 + with: + role-to-assume: ${{ secrets.TESTING_ROLE_ARN_US_GOV }} + aws-region: us-gov-west-1 + - name: Generate trace data id: traceData run: | @@ -206,6 +232,7 @@ jobs: ./testing/generate_trace_data.sh - name: Run terraform and send trace data + id: terraformSendData run: | cd testing/terraform terraform init @@ -213,7 +240,7 @@ jobs: terraform apply -auto-approve -var-file=./testcases/${{ matrix.testcases }}.tfvars -var=aws_region=${{ steps.setRegion.outputs.region }} - name: Validate trace data - if: always() + if: steps.terraformSendData.outcome == 'success' run: | echo "trace-id: ${{ env.TRACE_ID }}" echo "sleeping for 60 seconds" diff --git a/testing/README.md b/testing/README.md new file mode 100644 index 0000000..5dcb385 --- /dev/null +++ b/testing/README.md @@ -0,0 +1,7 @@ +## Testing X-Ray Daemon + +This directory contains the resources and logic for testing the functionality of X-Ray Daemon for various test cases. The testcases leverage Terraform with variable configurations to launch X-Ray Daemon on AWS EC2 instances and send a trace through it. + +Current features of this testing suite are: +1. Testing the `.zip`, `.deb`, and `.rpm` binaries for x86_64 architecture of Linux platform. +2. Testing the `.zip` binary for x86_64 architecture of Linux platform in China and US Gov AWS partitions. diff --git a/testing/terraform/testcases/linux_zip_cn.tfvars b/testing/terraform/testcases/linux_zip_cn.tfvars new file mode 100644 index 0000000..85ff45c --- /dev/null +++ b/testing/terraform/testcases/linux_zip_cn.tfvars @@ -0,0 +1,5 @@ +testing_ami = "amazonlinux2" +daemon_file_name = "aws-xray-daemon-linux-3.x.zip" +daemon_install_command = "unzip aws-xray-daemon-linux-3.x.zip -d ./xray_daemon" +daemon_start_command = "nohup sudo ./xray_daemon/xray --log-level debug --log-file ./xray_daemon/xray_log &" +daemon_package_local_path = "../../distributions/aws-xray-daemon-linux-3.x.zip" \ No newline at end of file diff --git a/testing/terraform/testcases/linux_zip_us_gov.tfvars b/testing/terraform/testcases/linux_zip_us_gov.tfvars new file mode 100644 index 0000000..85ff45c --- /dev/null +++ b/testing/terraform/testcases/linux_zip_us_gov.tfvars @@ -0,0 +1,5 @@ +testing_ami = "amazonlinux2" +daemon_file_name = "aws-xray-daemon-linux-3.x.zip" +daemon_install_command = "unzip aws-xray-daemon-linux-3.x.zip -d ./xray_daemon" +daemon_start_command = "nohup sudo ./xray_daemon/xray --log-level debug --log-file ./xray_daemon/xray_log &" +daemon_package_local_path = "../../distributions/aws-xray-daemon-linux-3.x.zip" \ No newline at end of file