Skip to content

Commit 63d14e7

Browse files
committed
test(bucket,harbor): assert BucketClaim converges to bucketReady promptly
The bucket suite waited on '{.status.bucketReady}' without an expected value; a bare jsonpath match is satisfied by the literal "false", so the wait passed against an unready claim. Both suites also allowed 300s/600s, long enough to tolerate the propagation race rather than catch it, so they stayed green whether or not the BucketClaim ever converged. Assert bucketReady=true on a 120s bound. Convergence is now controller-driven (the controller requeues the claim until the backend Bucket's readiness propagates) and completes within tens of seconds; a claim frozen by the propagation race never converges and now fails the wait fast instead of being masked. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 250d923 commit 63d14e7

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎hack/e2e-apps/bucket.bats‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ EOF
2121
# Wait for the bucket to be ready
2222
kubectl -n tenant-test wait hr bucket-${name} --timeout=5m --for=condition=ready
2323
timeout 60 sh -ec "until kubectl -n tenant-test get bucketclaims.objectstorage.k8s.io bucket-${name} >/dev/null 2>&1; do sleep 2; done"
24-
kubectl -n tenant-test wait bucketclaims.objectstorage.k8s.io bucket-${name} --timeout=300s --for=jsonpath='{.status.bucketReady}'
24+
# The COSI controller requeues the BucketClaim until the backend Bucket's
25+
# readiness propagates, so this converges within tens of seconds. Assert
26+
# bucketReady=true explicitly: a bare jsonpath match also matches the literal
27+
# "false", so the unqualified form passed against an unready claim. The tight
28+
# bound makes a propagation-race regression fail fast instead of hiding.
29+
kubectl -n tenant-test wait bucketclaims.objectstorage.k8s.io bucket-${name} --timeout=120s --for=jsonpath='{.status.bucketReady}'=true || {
30+
echo "=== BucketClaim did not converge to bucketReady=true ==="
31+
kubectl -n tenant-test get bucketclaims.objectstorage.k8s.io bucket-${name} -o yaml 2>&1 || true
32+
echo "=== backend Buckets (cluster-scoped) ==="
33+
kubectl get buckets.objectstorage.k8s.io -o wide 2>&1 || true
34+
false
35+
}
2536
timeout 60 sh -ec "until kubectl -n tenant-test get bucketaccesses.objectstorage.k8s.io bucket-${name}-admin >/dev/null 2>&1; do sleep 2; done"
2637
kubectl -n tenant-test wait bucketaccesses.objectstorage.k8s.io bucket-${name}-admin --timeout=300s --for=jsonpath='{.status.accessGranted}'
2738
timeout 60 sh -ec "until kubectl -n tenant-test get bucketaccesses.objectstorage.k8s.io bucket-${name}-viewer >/dev/null 2>&1; do sleep 2; done"

‎hack/e2e-apps/harbor.bats‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,22 @@ EOF
4343
timeout 60 sh -ec "until kubectl -n tenant-test get hr $release >/dev/null 2>&1; do sleep 2; done"
4444
kubectl -n tenant-test wait hr $release --timeout=5m --for=condition=ready
4545

46-
# Wait for COSI to provision bucket. The driver creates the Bucket and grants
47-
# access quickly, but the central COSI controller's propagation of the Bucket's
48-
# readiness back onto the namespaced BucketClaim can lag several minutes on a
49-
# loaded runner, so allow the same 10m budget the dependent HelmRelease gets.
46+
# Wait for COSI to provision the bucket. The driver creates the backend Bucket
47+
# and grants access; the central COSI controller requeues the BucketClaim until
48+
# the Bucket's readiness has propagated, so it converges within tens of seconds.
49+
# A frozen claim (the propagation race this guards against) never converges, so
50+
# the tight bound surfaces that regression instead of masking it.
5051
timeout 60 sh -ec "until kubectl -n tenant-test get bucketclaims.objectstorage.k8s.io $release-registry >/dev/null 2>&1; do sleep 2; done"
5152
kubectl -n tenant-test wait bucketclaims.objectstorage.k8s.io $release-registry \
52-
--timeout=600s --for=jsonpath='{.status.bucketReady}'=true
53+
--timeout=120s --for=jsonpath='{.status.bucketReady}'=true || {
54+
echo "=== BucketClaim did not converge to bucketReady=true ==="
55+
kubectl -n tenant-test get bucketclaims.objectstorage.k8s.io $release-registry -o yaml 2>&1 || true
56+
echo "=== backend Buckets (cluster-scoped) ==="
57+
kubectl get buckets.objectstorage.k8s.io -o wide 2>&1 || true
58+
echo "=== objectstorage-controller ==="
59+
kubectl -n cozy-objectstorage-controller get pods 2>&1 || true
60+
false
61+
}
5362
timeout 60 sh -ec "until kubectl -n tenant-test get bucketaccesses.objectstorage.k8s.io $release-registry >/dev/null 2>&1; do sleep 2; done"
5463
kubectl -n tenant-test wait bucketaccesses.objectstorage.k8s.io $release-registry \
5564
--timeout=60s --for=jsonpath='{.status.accessGranted}'=true

0 commit comments

Comments
 (0)