diff --git a/.github/workflows/ci-e2e-tests.yml b/.github/workflows/ci-e2e-tests.yml index c095102..abf1c20 100644 --- a/.github/workflows/ci-e2e-tests.yml +++ b/.github/workflows/ci-e2e-tests.yml @@ -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 diff --git a/scripts/wait-for-proxy-service-database-metric-partitions.sh b/scripts/wait-for-proxy-service-database-metric-partitions.sh new file mode 100755 index 0000000..13593b6 --- /dev/null +++ b/scripts/wait-for-proxy-service-database-metric-partitions.sh @@ -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