Skip to content

Commit 5b39ecc

Browse files
authored
Merge pull request #104 from hyp3rd/feat/modernize
test: replace t.Skip with t.Fatalf for replication-factor assertions
2 parents b78468e + 6758a19 commit 5b39ecc

3 files changed

Lines changed: 26 additions & 15 deletions

File tree

tests/hypercache_distmemory_remove_readrepair_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ func TestDistMemoryReadRepair(t *testing.T) {
6464

6565
const key = "rr-key"
6666

67+
// Setup uses RF=2 with 2 nodes registered — Lookup must return both.
68+
// A <2 result indicates a test-environment regression rather than a
69+
// benign condition.
6770
owners := dc.Ring.Lookup(key)
6871
if len(owners) < 2 {
69-
t.Skip("replication factor <2")
72+
t.Fatalf("expected >=2 owners with RF=2 setup, got %d", len(owners))
7073
}
7174

7275
item := &cache.Item{Key: key, Value: "val"}

tests/hypercache_distmemory_stale_quorum_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ func TestDistMemoryStaleQuorum(t *testing.T) {
3232

3333
const key = "sq-key"
3434

35+
// Setup uses RF=3 with 3 nodes registered — Lookup must return all
36+
// three. A non-3 result indicates a test-environment regression
37+
// (e.g., a node failed to join membership), not a benign condition
38+
// to skip past.
3539
owners := dc.Ring.Lookup(key)
3640
if len(owners) != 3 {
37-
t.Skip("replication factor !=3")
41+
t.Fatalf("expected 3 owners with RF=3 setup, got %d", len(owners))
3842
}
3943

4044
item := &cache.Item{Key: key, Value: "v1"}

tests/integration/dist_phase1_test.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,14 @@ func awaitNodeReplication(ctx context.Context, node *backend.DistMemory, key str
7575
return false
7676
}
7777

78-
// TestDistPhase1BasicQuorum is a scaffolding test verifying three-node quorum Set/Get over HTTP transport.
78+
// TestDistPhase1BasicQuorum verifies three-node quorum Set/Get over the
79+
// HTTP transport. Originally a scaffolding test that t.Skipf'd when
80+
// replication hadn't propagated to the third node ("hint replay not yet
81+
// observable" — true at the time the test was written). Hint replay is
82+
// now fully wired (TestHintedHandoffReplay, TestDistFailureRecovery),
83+
// so the test now asserts strictly: every owner must hold the value
84+
// within the 3 s deadline. A failure here means the HTTP-transport
85+
// replication path regressed.
7986
func TestDistPhase1BasicQuorum(t *testing.T) {
8087
t.Parallel()
8188

@@ -112,19 +119,16 @@ func TestDistPhase1BasicQuorum(t *testing.T) {
112119

113120
assertValue(t, got.Value)
114121

115-
if awaitNodeReplication(ctx, nodeC, "k1", 3*time.Second) {
116-
return
117-
}
118-
119-
it, ok := nodeC.Get(ctx, "k1")
120-
if !ok {
121-
t.Skipf("hint replay not yet observable; will be validated after full wiring (missing item)")
122-
123-
return
124-
}
122+
// Replication must reach C within deadline; the previous skip-on-miss
123+
// branches were placeholders for pre-hint-replay behavior. Locally
124+
// this completes in ~500 ms across 20 runs.
125+
if !awaitNodeReplication(ctx, nodeC, "k1", 3*time.Second) {
126+
it, present := nodeC.Get(ctx, "k1")
127+
if !present {
128+
t.Fatalf("nodeC never received replicated value within 3s")
129+
}
125130

126-
if !valueOK(it.Value) {
127-
t.Skipf("value mismatch after wait")
131+
t.Fatalf("nodeC has wrong value after wait: %T %v", it.Value, it.Value)
128132
}
129133
}
130134

0 commit comments

Comments
 (0)