test(e2e-apps): replace fixed sleeps with HelmRelease existence backstop
The app bats files all share the pattern:
kubectl apply -f - <<EOF ... EOF
sleep 5
kubectl wait hr <name> --for=condition=ready
The fixed sleep guesses how long the cozystack-operator needs to translate
the app CR into a HelmRelease. On a noisy CI runner or after a cold
install that wait is sometimes too short, so the immediately-following
`kubectl wait hr ...` fails because the HR object does not exist yet
(`kubectl wait` errors out instantly on a missing resource).
Replace each `sleep 5` (and the one outlier `sleep 15` in foundationdb
that was paying for the same risk) with an event-driven backstop that
polls for the HR's existence and exits the moment it appears, capped at
60s. The downstream `kubectl wait --for=condition=ready` is unchanged,
preserving the original total budget.
Same shape as the LINSTOR fix in commit eb87413 on feat/e2e-optimization:
wait for the actual prerequisite (the HelmRelease the operator creates),
not on a downstream artefact whose existence depends on it.
Files: postgres, mariadb, kafka, mongodb, clickhouse, redis, qdrant,
harbor, openbao, external-dns (both tests), vminstance (both tests, with
the existence backstop hoisted before the downstream vmi-ip poll), and
foundationdb.
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
parent
dcc8718676
commit
66888c91ee
12 changed files with 42 additions and 14 deletions
|
|
@ -35,7 +35,9 @@ spec:
|
|||
resources: {}
|
||||
resourcesPreset: "nano"
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr clickhouse-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr clickhouse-$name --timeout=20s --for=condition=ready
|
||||
timeout 180 sh -ec "until kubectl -n tenant-test get svc chendpoint-clickhouse-$name -o jsonpath='{.spec.ports[*].port}' | grep -q '8123 9000'; do sleep 10; done"
|
||||
kubectl -n tenant-test wait statefulset.apps/chi-clickhouse-$name-clickhouse-0-0 --timeout=120s --for=jsonpath='{.status.replicas}'=1
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ spec:
|
|||
- example.com
|
||||
EOF
|
||||
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr ${name} >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr ${name} --timeout=120s --for=condition=ready
|
||||
kubectl -n tenant-test wait hr ${name}-system --timeout=120s --for=condition=ready
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get deploy -l app.kubernetes.io/instance=${name}-system -o jsonpath='{.items[0].status.readyReplicas}' | grep -q '1'; do sleep 5; done"
|
||||
|
|
@ -41,7 +43,9 @@ spec:
|
|||
- example.org
|
||||
EOF
|
||||
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr ${name} >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr ${name} --timeout=120s --for=condition=ready
|
||||
kubectl -n tenant-test wait hr ${name}-system --timeout=120s --for=condition=ready
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get deploy -l app.kubernetes.io/instance=${name}-system -o jsonpath='{.items[0].status.readyReplicas}' | grep -q '1'; do sleep 5; done"
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ spec:
|
|||
imageType: "unified"
|
||||
automaticReplacements: true
|
||||
EOF
|
||||
sleep 15
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr foundationdb-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
|
||||
# Wait for HelmRelease to be ready
|
||||
kubectl -n tenant-test wait hr foundationdb-$name --timeout=300s --for=condition=ready
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ spec:
|
|||
size: 1Gi
|
||||
replicas: 1
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr $release >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr $release --timeout=60s --for=condition=ready
|
||||
|
||||
# Wait for COSI to provision bucket
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ spec:
|
|||
partitions: 1
|
||||
replicas: 2
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr kafka-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr kafka-$name --timeout=30s --for=condition=ready
|
||||
kubectl wait kafkas -n tenant-test test --timeout=300s --for=condition=ready
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get pvc data-kafka-$name-zookeeper-0; do sleep 10; done"
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@ spec:
|
|||
resources: {}
|
||||
resourcesPreset: "nano"
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr mariadb-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr mariadb-$name --timeout=30s --for=condition=ready
|
||||
timeout 80 sh -ec "until kubectl -n tenant-test get svc mariadb-$name -o jsonpath='{.spec.ports[0].port}' | grep -q '3306'; do sleep 10; done"
|
||||
timeout 80 sh -ec "until kubectl -n tenant-test get endpoints mariadb-$name -o jsonpath='{.subsets[*].addresses[*].ip}' | grep -q '[0-9]'; do sleep 10; done"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ spec:
|
|||
backup:
|
||||
enabled: false
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr mongodb-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
# Wait for HelmRelease
|
||||
kubectl -n tenant-test wait hr mongodb-$name --timeout=60s --for=condition=ready
|
||||
# Wait for MongoDB service (port 27017)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ spec:
|
|||
external: false
|
||||
ui: true
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr openbao-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr openbao-$name --timeout=60s --for=condition=ready
|
||||
kubectl -n tenant-test wait hr openbao-$name-system --timeout=120s --for=condition=ready
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ spec:
|
|||
resources: {}
|
||||
resourcesPreset: "nano"
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr postgres-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr postgres-$name --timeout=100s --for=condition=ready
|
||||
kubectl -n tenant-test wait job.batch postgres-$name-init-job --timeout=50s --for=condition=Complete
|
||||
timeout 40 sh -ec "until kubectl -n tenant-test get svc postgres-$name-r -o jsonpath='{.spec.ports[0].port}' | grep -q '5432'; do sleep 10; done"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ spec:
|
|||
resources: {}
|
||||
external: false
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr qdrant-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr qdrant-$name --timeout=60s --for=condition=ready
|
||||
kubectl -n tenant-test wait hr qdrant-$name-system --timeout=120s --for=condition=ready
|
||||
kubectl -n tenant-test wait sts qdrant-$name --timeout=90s --for=jsonpath='{.status.readyReplicas}'=1
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ spec:
|
|||
resources: {}
|
||||
resourcesPreset: "nano"
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr redis-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr redis-$name --timeout=20s --for=condition=ready
|
||||
kubectl -n tenant-test wait pvc redisfailover-persistent-data-rfr-redis-$name-0 --timeout=50s --for=jsonpath='{.status.phase}'=Bound
|
||||
kubectl -n tenant-test wait deploy rfs-redis-$name --timeout=90s --for=condition=available
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ spec:
|
|||
storage: 5Gi
|
||||
storageClass: replicated
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
||||
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr vm-disk-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
kubectl -n tenant-test wait hr vm-disk-$name --timeout=5s --for=condition=ready
|
||||
kubectl -n tenant-test wait dv vm-disk-$name --timeout=250s --for=condition=ready
|
||||
kubectl -n tenant-test wait pvc vm-disk-$name --timeout=200s --for=jsonpath='{.status.phase}'=Bound
|
||||
|
|
@ -59,7 +61,9 @@ spec:
|
|||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPht0dPk5qQ+54g1hSX7A6AUxXJW5T6n/3d7Ga2F8gTF test@test
|
||||
cloudInitSeed: ""
|
||||
EOF
|
||||
sleep 5
|
||||
# Wait for the operator to materialise the HelmRelease before downstream
|
||||
# waits proceed (kubectl wait errors immediately if the HR does not exist).
|
||||
timeout 60 sh -ec "until kubectl -n tenant-test get hr vm-instance-$name >/dev/null 2>&1; do sleep 2; done"
|
||||
timeout 20 sh -ec "until kubectl -n tenant-test get vmi vm-instance-$name -o jsonpath='{.status.interfaces[0].ipAddress}' | grep -q '[0-9]'; do sleep 5; done"
|
||||
kubectl -n tenant-test wait hr vm-instance-$name --timeout=5s --for=condition=ready
|
||||
kubectl -n tenant-test wait vm vm-instance-$name --timeout=20s --for=condition=ready
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue