Skip to content

Commit

Permalink
create soaking test (#112)
Browse files Browse the repository at this point in the history
* modify the get-testcase script to get soaking test cases.

* modify ci workflow to put testing version in candidate package.

* Update soaking.yml
  • Loading branch information
wyTrivail committed Nov 13, 2020
1 parent c644b33 commit feb5191
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 12 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,11 @@ jobs:
with:
repository: 'aws-observability/aws-otel-collector-test-framework'
path: testing-framework
ref: v0.2.1

- name: Run testing suite on ec2
run: |
pwd=$PWD
cd testing-framework/terraform/ec2 && terraform init && terraform apply -auto-approve -var="testing_ami=${{ matrix.testing_ami }}" -var="aoc_version=${{ needs.e2etest-preparation.outputs.version }}" -var="testcase=../testcases/${{ matrix.testcase }}" -var-file="../testcases/${{ matrix.testcase }}/parameters.tfvars"
if [[ -f testing-framework/terraform/testcases/${{ matrix.testcase }}/parameters.tfvars ]] ; then opts="-var-file=../testcases/${{ matrix.testcase }}/parameters.tfvars" ; else opts="" ; fi
cd testing-framework/terraform/ec2 && terraform init && terraform apply -auto-approve $opts -var="testing_ami=${{ matrix.testing_ami }}" -var="aoc_version=${{ needs.e2etest-preparation.outputs.version }}" -var="testcase=../testcases/${{ matrix.testcase }}"
- name: Destroy resources
if: ${{ always() }}
run: |
Expand Down Expand Up @@ -425,11 +424,12 @@ jobs:
with:
repository: 'aws-observability/aws-otel-collector-test-framework'
path: testing-framework
ref: v0.2.1

- name: Run testing suite on ecs
run: |
cd testing-framework/terraform/ecs && terraform init && terraform apply -auto-approve -var="ecs_launch_type=${{ matrix.launch_type }}" -var="aoc_version=${{ needs.e2etest-preparation.outputs.version }}" -var="testcase=../testcases/${{ matrix.testcase }}" -var-file="../testcases/${{ matrix.testcase }}/parameters.tfvars"
if [[ -f testing-framework/terraform/testcases/${{ matrix.testcase }}/parameters.tfvars ]] ; then opts="-var-file=../testcases/${{ matrix.testcase }}/parameters.tfvars" ; else opts="" ; fi
cd testing-framework/terraform/ecs && terraform init && terraform apply -auto-approve $opts -var="ecs_launch_type=${{ matrix.launch_type }}" -var="aoc_version=${{ needs.e2etest-preparation.outputs.version }}" -var="testcase=../testcases/${{ matrix.testcase }}"
- name: Destroy resources
if: ${{ always() }}
run: |
Expand Down Expand Up @@ -464,11 +464,11 @@ jobs:
with:
repository: 'aws-observability/aws-otel-collector-test-framework'
path: testing-framework
ref: v0.2.1

- name: Run testing suite on eks
run: |
cd testing-framework/terraform/eks && terraform init && terraform apply -auto-approve -var="aoc_version=${{ needs.e2etest-preparation.outputs.version }}" -var="testcase=../testcases/${{ matrix.testcase }}" -var-file="../testcases/${{ matrix.testcase }}/parameters.tfvars"
if [[ -f testing-framework/terraform/testcases/${{ matrix.testcase }}/parameters.tfvars ]] ; then opts="-var-file=../testcases/${{ matrix.testcase }}/parameters.tfvars" ; else opts="" ; fi
cd testing-framework/terraform/eks && terraform init && terraform apply -auto-approve $opts -var="aoc_version=${{ needs.e2etest-preparation.outputs.version }}" -var="testcase=../testcases/${{ matrix.testcase }}"
- name: Destroy resources
if: ${{ always() }}
Expand Down Expand Up @@ -496,9 +496,11 @@ jobs:

- name: prepare production version
run: |
Version=`cat build/packages/VERSION | awk -F "-" '{print $1}'`
TESTING_VERSION=`cat build/packages/VERSION`
VERSION=`cat $TESTING_VERSION | awk -F "-" '{print $1}'`
echo $Version > build/packages/VERSION
echo $GITHUB_SHA > build/packages/GITHUB_SHA
echo $TESTING_VERSION > build/packages/TESTING_VERSION
- name: upload packages as release candidate on s3
uses: aws-observability/aws-otel-collector-test-framework@deprecating
Expand Down
154 changes: 154 additions & 0 deletions .github/workflows/soaking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

name: 'nightly soaking test'
on:
schedule:
- cron: '0 2 * * *' # every night at 2 am UTC

jobs:
get-testing-version:
runs-on: ubuntu-latest
outputs:
testing_version: ${{ steps.get-testing-version.outputs.testing_version }}
steps:
- uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.INTEG_TEST_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.INTEG_TEST_AWS_KEY_SECRET }}
aws-region: us-west-2

- name: download packages as release candidate from s3
uses: aws-observability/aws-otel-collector-test-framework@deprecating
with:
running_type: candidate
opts: "-t=DownloadCandidate -s=.aoc-stack-test.yml -p=${{ steps.get_version.outputs.version }} -g=${{ github.sha }}"

- name: get testing version
id: get-testing-version
run: |
testing_version=`cat build/packages/TESTING_VERSION`
echo "::set-output name=testing_version::$testing_version"
get-soaking-test-cases:
runs-on: ubuntu-latest
outputs:
soaking_matrix: ${{ steps.get-test-cases.outputs.soaking_matrix }}
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2.1.4

- name: get all the soaking test cases
id: get-test-cases
run: |
soaking_matrix=$(python e2etest/get-testcases.py soaking_matrix)
echo "::set-output name=soaking_matrix::$soaking_matrix"
get-negative-soaking-test-cases:
runs-on: ubuntu-latest
outputs:
soaking_matrix: ${{ steps.get-test-cases.outputs.soaking_matrix }}
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2.1.4

- name: get all the soaking test cases
id: get-test-cases
run: |
soaking_matrix=$(python e2etest/get-testcases.py negative_soaking_matrix)
echo "::set-output name=soaking_matrix::$soaking_matrix"
run-soaking-test:
runs-on: ubuntu-latest
needs: [get-soaking-test-cases, get-testing-version]
strategy:
matrix: ${{ fromJson(needs.get-soaking-test-cases.outputs.soaking_matrix) }}
steps:
- uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.INTEG_TEST_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.INTEG_TEST_AWS_KEY_SECRET }}
aws-region: us-west-2

- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11

- name: Set up terraform
uses: hashicorp/setup-terraform@v1

- name: Check out testing framework
uses: actions/checkout@v2
with:
repository: 'aws-observability/aws-otel-collector-test-framework'
path: testing-framework

- name: Run Soaking test
run: |
if [[ -f testing-framework/terraform/testcases/${{ matrix.testcase }}/parameters.tfvars ]] ; then opts="-var-file=../testcases/${{ matrix.testcase }}/parameters.tfvars" ; else opts="" ; fi
cd testing-framework/terraform/soaking && terraform init && terraform apply -auto-approve $opts -var="aoc_version=${{ needs.get-testing-version.testing_version }}" -var="testcase=../testcases/${{ matrix.testcase }}"
- name: Destroy resources
if: ${{ always() }}
run: |
cd testing-framework/terraform/eks && terraform destroy -auto-approve
run-negative-soaking-test:
runs-on: ubuntu-latest
needs: [get-negative-soaking-test-cases, get-testing-version]
strategy:
matrix: ${{ fromJson(needs.get-negative-soaking-test-cases.outputs.soaking_matrix) }}
steps:
- uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.INTEG_TEST_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.INTEG_TEST_AWS_KEY_SECRET }}
aws-region: us-west-2

- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11

- name: Set up terraform
uses: hashicorp/setup-terraform@v1

- name: Check out testing framework
uses: actions/checkout@v2
with:
repository: 'aws-observability/aws-otel-collector-test-framework'
path: testing-framework

- name: Run Soaking test
run: |
if [[ -f testing-framework/terraform/testcases/${{ matrix.testcase }}/parameters.tfvars ]] ; then opts="-var-file=../testcases/${{ matrix.testcase }}/parameters.tfvars" ; else opts="" ; fi
cd testing-framework/terraform/soaking && terraform init && terraform apply -auto-approve $opts -var="negative_soaking=true" -var="aoc_version=${{ needs.get-testing-version.testing_version }}" -var="testcase=../testcases/${{ matrix.testcase }}"
- name: Destroy resources
if: ${{ always() }}
run: |
cd testing-framework/terraform/eks && terraform destroy -auto-approve
15 changes: 14 additions & 1 deletion e2etest/get-testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@
ecs_matrix = {"testcase": [], "launch_type": ["EC2", "FARGATE"]}
eks_matrix = {"testcase": []}
local_matrix = {"testcase": []}
matrix = {"ec2_matrix": ec2_matrix, "ecs_matrix": ecs_matrix, "eks_matrix": eks_matrix, "local_matrix": local_matrix}
soaking_matrix = {"testcase": []}
negative_soaking_matrix = {"testcase": []}
matrix = {
"ec2_matrix": ec2_matrix,
"ecs_matrix": ecs_matrix,
"eks_matrix": eks_matrix,
"local_matrix": local_matrix,
"soaking_matrix": soaking_matrix,
"negative_soaking_matrix": negative_soaking_matrix
}

with open(testcase_json) as f:
testcases = json.load(f)
Expand All @@ -24,5 +33,9 @@
eks_matrix["testcase"].append(testcase["case_name"])
if 'LOCAL' in testcase["platforms"]:
local_matrix["testcase"].append(testcase["case_name"])
if 'SOAKING' in testcase["platforms"]:
soaking_matrix["testcase"].append(testcase["case_name"])
if 'NEG_SOAKING' in testcase["platforms"]:
negative_soaking_matrix["testcase"].append(testcase["case_name"])

print(json.dumps(matrix[which_matrix]))
6 changes: 3 additions & 3 deletions e2etest/testcases.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[
{
"case_name": "xrayreceiver",
"platforms": ["EC2", "ECS", "EKS"]
"platforms": ["EC2", "ECS", "EKS", "SOAKING"]
},
{
"case_name": "otlp",
"platforms": ["EC2", "ECS", "EKS"]
"platforms": ["EC2", "ECS", "EKS", "SOAKING"]
},
{
"case_name": "otlp_mock",
"platforms": ["LOCAL"]
"platforms": ["LOCAL", "SOAKING", "NEG_SOAKING"]
},
{
"case_name": "ecsmetrics",
Expand Down

0 comments on commit feb5191

Please sign in to comment.