Skip to content

Commit

Permalink
feat: verify metrics in build (#72)
Browse files Browse the repository at this point in the history
* ✨feature: add verify metrics
  • Loading branch information
maxisam committed Sep 9, 2023
1 parent 6ccbb03 commit 1c3050a
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ jobs:
run: |
sleep 60
echo '💥💥💥💥💥💥💥💥 Get mgob Version 💥💥💥💥💥💥💥💥💥💥'
curl http://127.0.0.1:8090/version
curl http://127.0.0.1:8090/version | tee version.txt
echo '💥💥💥💥💥💥💥💥 Get mgob Metrics 💥💥💥💥💥💥💥💥💥💥'
curl http://127.0.0.1:8090/metrics
curl http://127.0.0.1:8090/metrics | tee metrics.txt
echo '💥💥💥💥💥💥💥💥 Get mgob logs 💥💥💥💥💥💥💥💥💥💥'
logs=$(docker logs mgob 2>&1)
echo "$logs" | tee logs.txt
Expand Down Expand Up @@ -116,6 +116,16 @@ jobs:
with:
name: logs
path: logs.txt
- name: Upload version as artifact
uses: actions/upload-artifact@v3
with:
name: version
path: version.txt
- name: Upload metrics as artifact
uses: actions/upload-artifact@v3
with:
name: metrics
path: metrics.txt
- name: Verify mgob restore
run: |
echo 'Restore integration test'
Expand All @@ -141,6 +151,20 @@ jobs:
exit 1
fi
- name: Verify metrics
run: |
echo 'Verify metrics'
# should find "mgob_scheduler_backup_total{plan="mongo-test",status="200"} 1"
if ! grep -q "mgob_scheduler_backup_total{plan=\"mongo-test\",status=\"200\"} 1" metrics.txt; then
echo "Metrics integration test failed for mongo-test"
exit 1
fi
# should find "mgob_scheduler_backup_total{plan="no-local",status="200"} 1"
if ! grep -q "mgob_scheduler_backup_total{plan=\"no-local\",status=\"200\"} 1" metrics.txt; then
echo "Metrics integration test failed for no-local"
exit 1
fi
- name: Push mgob image
uses: docker/build-push-action@v3
with:
Expand Down

0 comments on commit 1c3050a

Please sign in to comment.