Skip to content

Commit

Permalink
Merge pull request #94 from engedaam/soak-testing-v3
Browse files Browse the repository at this point in the history
Soak testing
  • Loading branch information
engedaam authored Oct 28, 2023
2 parents 8f604a7 + 39a7f7d commit cf31bbf
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 5 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/e2e-sock-trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: E2ESoakTrigger
on:
schedule:
- cron: '0 */3 * * *'
workflow_run:
workflows: [ApprovalComment]
types: [completed]
workflow_dispatch:
inputs:
region:
required: true
default: 'us-west-2'
type: choice
options:
- "us-east-1"
- "us-west-2"
cleanup:
required: true
default: true
type: boolean
jobs:
reslove_cluster:
runs-on: ubuntu-latest
outputs:
CREATE_CLUSTER: ${{ steps.create_cluster.outputs.SHOULD_RUN }}
PREEXISTING: ${{ steps.create_cluster.outputs.GIT_REF }}
steps:
- id: create_cluster
run: |
export PREEXISTING=$(eksctl get cluster -o json | jq '.[].Name' | grep soak)
echo "Found existing cluster name \"$PREEXISTING\""
if [[ $PREEXISTING != "" ]]; then
echo PREEXISTING=$PREEXISTING >> $GITHUB_OUTPUT
echo CREATE_CLUSTER=true >> $GITHUB_OUTPUT
else
echo CREATE_CLUSTER=false >> $GITHUB_OUTPUT
fi
sock:
needs: [reslove_cluster]
strategy:
fail-fast: false
matrix:
suite:
- Beta/Integration
uses: ./.github/workflows/e2e.yaml
with:
suite: ${{ matrix.suite }}
region: ${{ inputs.region || 'us-west-1' }}
workflow_trigger: "soak"
create_cluster: ${{needs.reslove_cluster.outputs.CREATE_CLUSTER }}
preexisiting_cluster: ${{needs.reslove_cluster.outputs.PREEXISTING || '' }}
# Default to true unless using a workflow_dispatch
cleanup: false
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
23 changes: 18 additions & 5 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ on:
required: true
workflow_trigger:
type: string
preexisiting_cluster:
type: string
create_cluster:
type: string
secrets:
SLACK_WEBHOOK_URL:
required: true
Expand Down Expand Up @@ -100,15 +104,22 @@ jobs:
aws-region: ${{ inputs.region }}
role-duration-seconds: 21600
- name: add jitter on cluster creation
if: inputs.create_cluster
run: |
# Creating jitter so that we can stagger cluster creation to avoid throttling
sleep $(( $RANDOM % 300 + 1 ))
- id: generate-cluster-name
if: inputs.create_cluster
run: |
CLUSTER_NAME=$(echo ${{ inputs.suite }}-$RANDOM$RANDOM | awk '{print tolower($0)}' | tr / -)
if [[ ${{ inputs.workflow_trigger }} == 'soak' ]]; then
CLUSTER_NAME=$(echo ${{ inputs.workflow_trigger }}-$RANDOM$RANDOM | awk '{print tolower($0)}' | tr / -)
else
CLUSTER_NAME=$(echo ${{ inputs.suite }}-$RANDOM$RANDOM | awk '{print tolower($0)}' | tr / -)
fi
echo "Using cluster name \"$CLUSTER_NAME\""
echo CLUSTER_NAME=$CLUSTER_NAME >> $GITHUB_OUTPUT
- name: create eks cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}'
- name: create eks cluster '${{ steps.generate-cluster-name.outputs.CLUSTER_NAME || inputs.preexisiting_cluster }}'
if: inputs.create_cluster
uses: ./.github/actions/e2e/create-cluster
with:
account_id: ${{ vars.ACCOUNT_ID }}
Expand All @@ -120,6 +131,7 @@ jobs:
ip_family: ${{ contains(inputs.suite, 'IPv6') && 'IPv6' || 'IPv4' }} # Set the value to IPv6 if IPv6 suite, else IPv4
git_ref: ${{ inputs.git_ref }}
- name: install prometheus
if: inputs.create_cluster
uses: ./.github/actions/e2e/install-prometheus
with:
account_id: ${{ vars.ACCOUNT_ID }}
Expand All @@ -129,6 +141,7 @@ jobs:
workspace_id: ${{ vars.WORKSPACE_ID }}
git_ref: ${{ inputs.git_ref }}
- name: install karpenter
if: inputs.create_cluster
uses: ./.github/actions/e2e/install-karpenter
with:
account_id: ${{ vars.ACCOUNT_ID }}
Expand All @@ -140,10 +153,10 @@ jobs:
git_ref: ${{ inputs.git_ref }}
- name: run the ${{ inputs.suite }} test suite
run: |
aws eks update-kubeconfig --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}
aws eks update-kubeconfig --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME || inputs.preexisiting_cluster }}
TEST_SUITE="${{ inputs.suite }}" ENABLE_METRICS=${{ inputs.enable_metrics }} METRICS_REGION=${{ vars.TIMESTREAM_REGION }} GIT_REF="$(git rev-parse HEAD)" \
CLUSTER_NAME="${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}" CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }} --query "cluster.endpoint" --output text)" \
INTERRUPTION_QUEUE="${{ steps.generate-cluster-name.outputs.CLUSTER_NAME }}" make e2etests
CLUSTER_NAME="${{ steps.generate-cluster-name.outputs.CLUSTER_NAME || inputs.preexisiting_cluster }}" CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${{ steps.generate-cluster-name.outputs.CLUSTER_NAME || inputs.preexisiting_cluster }} --query "cluster.endpoint" --output text)" \
INTERRUPTION_QUEUE="${{ steps.generate-cluster-name.outputs.CLUSTER_NAME || inputs.preexisiting_cluster }}" make e2etests
- name: notify slack of success or failure
uses: ./.github/actions/e2e/slack/notify
if: (success() || failure()) && github.event_name != 'workflow_run' && inputs.workflow_trigger != 'versionCompatibility'
Expand Down

0 comments on commit cf31bbf

Please sign in to comment.