MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestShouldRejectLockContentionImmediately

Function TestShouldRejectLockContentionImmediately

cmd/workers_test.go:36–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestShouldRejectLockContentionImmediately(t *testing.T) {
37 cfg := &config.Configuration{
38 Queue: config.QueueConfig{
39 RejectLockContentionImmediately: true,
40 },
41 }
42
43 if !shouldRejectLockContentionImmediately(cfg, fmt.Errorf("failed to acquire lock: already held")) {
44 t.Fatal("expected lock contention to reject immediately when enabled")
45 }
46
47 if shouldRejectLockContentionImmediately(cfg, fmt.Errorf("random transient database error")) {
48 t.Fatal("expected non-lock error not to reject immediately")
49 }
50
51 cfg.Queue.RejectLockContentionImmediately = false
52 if shouldRejectLockContentionImmediately(cfg, fmt.Errorf("failed to acquire lock: already held")) {
53 t.Fatal("expected lock contention not to reject immediately when disabled")
54 }
55}

Callers

nothing calls this directly

Calls 2

FatalMethod · 0.45

Tested by

no test coverage detected