Skip to content

Commit dd5204a

Browse files
committed
OTel kuttl test: move check for 5 minute metric to last to avoid failures.
1 parent eb05b58 commit dd5204a

8 files changed

+23
-22
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
apply:
4+
- files/03--annotate-cluster.yaml
5+
assert:
6+
- files/03-backup-completed.yaml

testing/kuttl/e2e/otel-logging-and-metrics/05--backup.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

testing/kuttl/e2e/otel-logging-and-metrics/02-assert-instance.yaml renamed to testing/kuttl/e2e/otel-logging-and-metrics/06-assert-instance.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)