Skip to content

Commit d6ac62a

Browse files
test(bucket,harbor): fail fast on frozen BucketClaims; enforce readonly denial
Fold main's post-branch bucket/harbor bats drift into the Chainsaw suites: - BucketClaim bucketReady budgets tightened to 2m (bucket had the 5m default, harbor a stale 10m with the reversed 'can lag on a loaded runner' rationale): the objectstorage-controller requeues the claim until the backend Bucket is ready (0f1cc54), so readiness converges in tens of seconds and a claim not ready after 2m is frozen — the tight bound surfaces the propagation regression instead of masking it (63d14e7) - the bucket viewer-upload soft-xfail is promoted back to a hard failure: accessPolicy=readonly enforcement landed with seaweedfs-cosi-driver v0.3.1 (#1921, eab9b03), so a successful readonly upload is now a regression, exactly what the suite's own TODO called for - both catch blocks gain the backend view (cluster-scoped Buckets + cozy-objectstorage-controller pods) where a frozen claim actually surfaces Assisted-By: Claude <[email protected]> Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 21e21a9 commit d6ac62a

2 files changed

Lines changed: 32 additions & 17 deletions

File tree

‎hack/e2e-chainsaw/bucket/chainsaw-test.yaml‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ spec:
1818
apiVersion: objectstorage.k8s.io/v1alpha1
1919
kind: BucketClaim
2020
name: bucket-test
21+
# The backend view: cluster-scoped Buckets plus the COSI controller pods,
22+
# where a frozen-claim readiness propagation failure actually surfaces.
23+
- get:
24+
apiVersion: objectstorage.k8s.io/v1alpha1
25+
kind: Bucket
26+
- script:
27+
content: kubectl -n cozy-objectstorage-controller get pods
2128
steps:
2229
- name: create-bucket
2330
try:
@@ -38,7 +45,13 @@ spec:
3845
- status: "True"
3946
# Replaces `until kubectl get ...` + `kubectl wait --for=jsonpath=...`
4047
# pairs: one assert handles both existence and the status field.
48+
# 2m, not the default 5m: the objectstorage-controller requeues the
49+
# BucketClaim until the backend Bucket is ready, so readiness converges
50+
# within tens of seconds; a claim still not ready after 2m is frozen
51+
# (readiness-propagation regression), and the tight bound surfaces that
52+
# instead of masking it (mirrors the bats 120s budget from 63d14e748).
4153
- assert:
54+
timeout: 2m
4255
resource:
4356
apiVersion: objectstorage.k8s.io/v1alpha1
4457
kind: BucketClaim
@@ -101,23 +114,17 @@ spec:
101114
mc ls --insecure "ro-user/$BUCKET_NAME/rw-test.txt"
102115
mc cp --insecure "ro-user/$BUCKET_NAME/rw-test.txt" "$workdir/ro-test-download.txt"
103116
104-
# Viewer (readonly) upload: must eventually be denied. The
105-
# seaweedfs-cosi-driver does not yet enforce accessPolicy=readonly
106-
# (cozystack/cozystack#1921, blocked upstream on
107-
# kubernetes-sigs/container-object-storage-interface#244), so the
108-
# viewer credential can currently still write. Treat that as a known
109-
# gap instead of failing, but keep exercising the path so the test
110-
# turns loud the moment enforcement lands.
111-
# TODO(#1921): restore the hard failure (exit 1) once the driver
112-
# enforces read-only access.
117+
# Viewer (readonly) upload must be DENIED. accessPolicy=readonly
118+
# enforcement landed with seaweedfs-cosi-driver v0.3.1 (#1921,
119+
# eab9b034f), so a successful upload is a regression, not a known
120+
# gap — fail hard.
113121
echo "readonly test" > "$workdir/ro-test.txt"
114122
if mc cp --insecure "$workdir/ro-test.txt" "ro-user/$BUCKET_NAME/ro-test.txt"; then
115-
echo "::warning::readonly user was able to upload — seaweedfs-cosi-driver does not enforce accessPolicy=readonly yet (#1921)"
123+
echo "FAIL: read-only user must NOT be able to upload (accessPolicy=readonly regression; enforced since cosi-driver v0.3.1, #1921)" >&2
116124
# Drop the object the viewer should not have been able to create
117125
# (via the admin user, which is unambiguously allowed to delete).
118126
mc rm --insecure "rw-user/$BUCKET_NAME/ro-test.txt" || true
119-
else
120-
echo "readonly upload correctly denied — if #1921 has landed, promote this back to a hard assertion"
127+
exit 1
121128
fi
122129
123130
# Remove the test object so bucket cleanup is not blocked

‎hack/e2e-chainsaw/harbor/chainsaw-test.yaml‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ spec:
2626
apiVersion: objectstorage.k8s.io/v1alpha1
2727
kind: BucketAccess
2828
name: harbor-test-registry
29+
# The backend view: cluster-scoped Buckets plus the COSI controller pods,
30+
# where a frozen-claim readiness propagation failure actually surfaces.
31+
- get:
32+
apiVersion: objectstorage.k8s.io/v1alpha1
33+
kind: Bucket
34+
- script:
35+
content: kubectl -n cozy-objectstorage-controller get pods
2936
- podLogs:
3037
selector: app.kubernetes.io/instance=harbor-test
3138
tail: 50
@@ -50,12 +57,13 @@ spec:
5057

5158
- name: wait-cosi-bucket
5259
try:
53-
# 10m, not the default 5m: readiness on the namespaced BucketClaim can lag
54-
# several minutes on a loaded runner (seaweedfs/COSI provisioning is the slow
55-
# path), so allow the same budget the dependent harbor-test-system HR gets.
56-
# Matches the BATS original (--timeout=600s); see docs/agents/e2e-testing.md §6.
60+
# 2m, not the default 5m: the objectstorage-controller requeues the
61+
# BucketClaim until the backend Bucket is ready, so readiness converges
62+
# within tens of seconds; a claim still not ready after 2m is frozen
63+
# (readiness-propagation regression), and the tight bound surfaces that
64+
# instead of masking it (mirrors the bats 120s budget from 63d14e748).
5765
- assert:
58-
timeout: 10m
66+
timeout: 2m
5967
resource:
6068
apiVersion: objectstorage.k8s.io/v1alpha1
6169
kind: BucketClaim

0 commit comments

Comments
 (0)