@@ -6,7 +6,8 @@ commands:
66# and 5s queries are present, as well as patroni metrics.
77# Then, check the collector logs for patroni, pgbackrest, and postgres logs.
88# Finally, ensure the monitoring user exists and is configured.
9- - script : |
9+ - timeout : 400
10+ script : |
1011 retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
1112 check_containers_ready() { bash -ceu 'echo "$1" | jq -e ".[] | select(.type==\"ContainersReady\") | .status==\"True\""' - "$@"; }
1213 contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
@@ -22,21 +23,6 @@ commands:
2223 exit 1
2324 }
2425
25- scrape_metrics=$(kubectl exec "${pod}" -c collector -n "${NAMESPACE}" -- \
26- curl --insecure --silent http://localhost:9187/metrics)
27- { contains "${scrape_metrics}" 'ccp_connection_stats_active'; } || {
28- retry "5 second metric not found"
29- exit 1
30- }
31- { contains "${scrape_metrics}" 'ccp_database_size_bytes'; } || {
32- retry "5 minute metric not found"
33- exit 1
34- }
35- { contains "${scrape_metrics}" 'patroni_postgres_running'; } || {
36- retry "patroni metric not found"
37- exit 1
38- }
39-
4026 logs=$(kubectl logs "${pod}" --namespace "${NAMESPACE}" -c collector | grep InstrumentationScope)
4127 { contains "${logs}" 'InstrumentationScope patroni'; } || {
4228 retry "patroni logs not found"
@@ -51,6 +37,21 @@ commands:
5137 exit 1
5238 }
5339
40+ scrape_metrics=$(kubectl exec "${pod}" -c collector -n "${NAMESPACE}" -- \
41+ curl --insecure --silent http://localhost:9187/metrics)
42+ { contains "${scrape_metrics}" 'ccp_connection_stats_active'; } || {
43+ retry "5 second metric not found"
44+ exit 1
45+ }
46+ { contains "${scrape_metrics}" 'patroni_postgres_running'; } || {
47+ retry "patroni metric not found"
48+ exit 1
49+ }
50+ { contains "${scrape_metrics}" 'ccp_database_size_bytes'; } || {
51+ retry "5 minute metric not found"
52+ exit 1
53+ }
54+
5455 kubectl exec --stdin "${pod}" --namespace "${NAMESPACE}" -c database \
5556 -- psql -qb --set ON_ERROR_STOP=1 --file=- <<'SQL'
5657 DO $$
0 commit comments