Skip to content

Commit

Permalink
ensure metric partitions are created before running e2e-tests in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
galxy25 committed Sep 26, 2023
1 parent 3ce72dd commit f68fec2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
run: bash ${GITHUB_WORKSPACE}/scripts/wait-for-proxy-service-running.sh
env:
PROXY_CONTAINER_PORT: 7777
- name: wait for proxy service metric partitions database tables to be created
run: bash ${GITHUB_WORKSPACE}/scripts/wait-for-proxy-service-database-metric-partitions.sh
env:
# needs to be 1 + number of partitions created by /clients/database/migrations/20230523101344_partition_proxied_request_metrics_table.up.sql
MINIMUM_REQUIRED_PARTITIONS: 30
PROXY_CONTAINER_PORT: 7777
- name: run e2e tests
run: make e2e-test
- name: print proxy service logs
Expand Down
17 changes: 17 additions & 0 deletions scripts/wait-for-proxy-service-database-metric-partitions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -x

while true
do
CREATED_PARTITIONS=$(curl -f http://localhost:"${PROXY_CONTAINER_PORT}/status/database" | jq '.total_proxied_request_metric_partitions')

echo "$CREATED_PARTITIONS partitions exist"

if [ "$CREATED_PARTITIONS" -ge "$MINIMUM_REQUIRED_PARTITIONS" ]
then
echo "MINIMUM_REQUIRED_PARTITIONS created $CREATED_PARTITIONS; required: $MINIMUM_REQUIRED_PARTITIONS"
exit 0
fi

sleep 1
done

0 comments on commit f68fec2

Please sign in to comment.