Skip to content

Commit dc8671d

Browse files
author
Batuhan Aykac
committed
test: add e2e circuit breaker rollback detection test
1 parent e42a5bb commit dc8671d

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Circuit Breaker Test
2+
on: workflow_dispatch
3+
jobs:
4+
test-happy-path:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: aws-actions/configure-aws-credentials@v4
9+
with:
10+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
11+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
12+
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
13+
aws-region: us-west-2
14+
- name: Deploy good image (should succeed)
15+
uses: ./
16+
with:
17+
task-definition: test-task-def-good.json
18+
service: cb-test-svc
19+
cluster: cb-test
20+
wait-for-service-stability: true
21+
force-new-deployment: true
22+
23+
test-rollback-detection:
24+
runs-on: ubuntu-latest
25+
needs: test-happy-path
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: aws-actions/configure-aws-credentials@v4
29+
with:
30+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
31+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
32+
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
33+
aws-region: us-west-2
34+
- name: Deploy bad image (should fail)
35+
id: bad-deploy
36+
uses: ./
37+
continue-on-error: true
38+
with:
39+
task-definition: test-task-def-bad.json
40+
service: cb-test-svc
41+
cluster: cb-test
42+
wait-for-service-stability: true
43+
- name: Assert it failed
44+
run: |
45+
if [ "${{ steps.bad-deploy.outcome }}" != "failure" ]; then
46+
echo "::error::Expected failure but got ${{ steps.bad-deploy.outcome }}"
47+
exit 1
48+
fi
49+
echo "Correctly detected circuit breaker rollback!"

test-task-def-bad.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"family":"cb-test","requiresCompatibilities":["FARGATE"],"networkMode":"awsvpc","cpu":"256","memory":"512","containerDefinitions":[{"name":"web","image":"public.ecr.aws/nginx/nginx:this-tag-does-not-exist-99999","essential":true,"portMappings":[{"containerPort":80}]}]}

test-task-def-good.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"family":"cb-test","requiresCompatibilities":["FARGATE"],"networkMode":"awsvpc","cpu":"256","memory":"512","containerDefinitions":[{"name":"web","image":"public.ecr.aws/nginx/nginx:latest","essential":true,"portMappings":[{"containerPort":80}]}]}

0 commit comments

Comments
 (0)