@@ -2,6 +2,7 @@ package testing
22
33import (
44 "context"
5+ "flag"
56 "testing"
67
78 "github.com/versity/versitygw/tests/integration"
@@ -46,6 +47,16 @@ func smokeHarness(t *testing.T) *Harness {
4647 return h
4748}
4849
50+ // shuffleEnabled reports whether `go test -shuffle` is active. Shuffle is a
51+ // runtime flag (there is no build tag for it), so we inspect it directly. A
52+ // couple of order-sensitive upstream cases key off this to skip only when the
53+ // run order — and thus their process-global bucket-name counter — is
54+ // randomized; in fixed order they are deterministic and run normally.
55+ func shuffleEnabled () bool {
56+ f := flag .Lookup ("test.shuffle" )
57+ return f != nil && f .Value .String () != "off"
58+ }
59+
4960// =============================================================
5061// Known-passing cases
5162// =============================================================
@@ -89,7 +100,6 @@ func TestSmoke_ListBuckets(t *testing.T) {
89100 {"empty_success" , integration .ListBuckets_empty_success },
90101 {"invalid_max_buckets" , integration .ListBuckets_invalid_max_buckets },
91102 {"success" , integration .ListBuckets_success },
92- {"truncated" , integration .ListBuckets_truncated },
93103 {"with_prefix" , integration .ListBuckets_with_prefix },
94104 }
95105 s3conf := newS3Conf (smokeHarness (t ).Config ())
@@ -100,6 +110,26 @@ func TestSmoke_ListBuckets(t *testing.T) {
100110 }
101111 })
102112 }
113+
114+ // truncated exercises paginated ListBuckets and ingot passes it in
115+ // deterministic (fixed) order — so it runs in the normal test run, the
116+ // -race job, IDE runs, etc. But it is brittle under `go test -shuffle`:
117+ // the upstream case names buckets from a process-global counter
118+ // (test-bucket-<N>) and compares pages position-by-position, expecting
119+ // creation order, while ingot returns buckets lexicographically (matching
120+ // versitygw's own backend). Shuffle randomizes how far that counter has
121+ // advanced, and when a page straddles a digit boundary (…98, 99, 100)
122+ // lexical order ("100" < "98") diverges from the expected numeric order.
123+ // So we run it whenever order is deterministic and skip only under
124+ // shuffle. See CLAUDE.md "Testing".
125+ t .Run ("truncated" , func (t * testing.T ) {
126+ if shuffleEnabled () {
127+ t .Skip ("ListBuckets_truncated assumes creation-order pagination; brittle under -shuffle (see comment above)" )
128+ }
129+ if err := integration .ListBuckets_truncated (s3conf ); err != nil {
130+ t .Fatalf ("%v" , err )
131+ }
132+ })
103133}
104134
105135func TestSmoke_DeleteBucket (t * testing.T ) {
0 commit comments