mesh/merge-gate head 696300b9e280 merged into trunk f973cefd7fd3 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head 696300b9e280 merged into trunk f973cefd7fd3 — pass: its merge-check.sh passed
mesh/delivery delivered
A dropped duplicate left the in-hand marker, so every later claim failed and every ask spent its deliveries.
29 lines
1.0 KiB
Go
29 lines
1.0 KiB
Go
package link
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/nats-io/nats.go"
|
|
)
|
|
|
|
// 1768/AC1: a request dropped as a duplicate of one another builder runs marks nothing in hand: the claim is not made,
|
|
// so no mark is left behind to fail every later claim.
|
|
func TestADuplicateDropIsJudgedBeforeTheClaimSoLeavesNoMark(t *testing.T) {
|
|
claims := 0
|
|
m := &natsMachine{
|
|
opts: MachineOptions{Claim: func() bool { claims++; return true }},
|
|
duplicate: func(context.Context, BuildRequest) string { return "ace is running it" },
|
|
}
|
|
if m.admit(context.Background(), &nats.Msg{}, BuildRequest{ID: "build-1"}) {
|
|
t.Fatal("a duplicate was admitted")
|
|
}
|
|
if claims != 0 {
|
|
t.Fatalf("a dropped duplicate was claimed %d times, which leaves the in-hand mark behind", claims)
|
|
}
|
|
m.duplicate = func(context.Context, BuildRequest) string { return "" }
|
|
if !m.admit(context.Background(), &nats.Msg{}, BuildRequest{ID: "build-2"}) || claims != 1 {
|
|
t.Fatalf("a request that is no duplicate was not claimed once: claims=%d", claims)
|
|
}
|
|
}
|