Skip to content

Commit 6cfb5df

Browse files
committed
test: skip test flakes under shuffle
1 parent eae8299 commit 6cfb5df

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ The `testing/` package exercises ingot end-to-end without Postgres/piri/indexer:
150150
- **`smoke_test.go`**`TestSmoke_<Group>` (passing) + `TestSmokeXFail_<Group>`
151151
(known-failing; per-case failures are Skipped and the test FAILs only on an
152152
*unexpected pass* — the cue to promote the row). ~66 pass / ~53 xfail.
153+
- **Shuffle-brittle upstream cases** — CI runs `go test -shuffle=on ./...` (the
154+
ipdxco unified `go-test` workflow enables shuffle unless `go-test-config.json`
155+
sets `shuffle: false`; the `-race` job runs in fixed order). A few versitygw
156+
cases name buckets from a process-global counter and assert *creation-order*
157+
pagination, while ingot returns buckets lexicographically (matching
158+
versitygw's own backend) — so shuffle can straddle a digit boundary
159+
(…98,99,100) and flip them (see `ListBuckets_truncated`). Such a case is gated
160+
behind `shuffleEnabled()`: it runs and must pass in fixed order, but is
161+
`Skip`ped under `-shuffle`, keeping coverage everywhere except the one
162+
nondeterministic environment. Don't add these to the XFail group — that group
163+
fails on an *unexpected pass*, so a shuffle-dependent case would flip there too.
153164
- **`module_test.go`** (root), **`logstore/store_test.go`**,
154165
**`blockstore/{cache,staging}_test.go`**, **`forgeclient/accounts_test.go`**,
155166
**`cmd/space_test.go`** — unit tests.

testing/smoke_test.go

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package testing
22

33
import (
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

105135
func TestSmoke_DeleteBucket(t *testing.T) {

0 commit comments

Comments
 (0)