Accept the gate's recheck status mesh/repo-check among the owed contexts, so a pinned recheck is not refused (issue 1673)
This commit is contained in:
@@ -516,3 +516,29 @@ func TestCheckerOwedIsReadableByTheGatesReaderAndAnOldOwedReaderIgnoresNewFields
|
||||
t.Errorf("a preview with a field of tomorrow: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 1673/AC2 (review): the gate's recheck owes a pending status=mesh/repo-check (mesh-catalog mesh-delivery-gate owed.go,
|
||||
// checks.go ctxRepo); its key and value round trip, and the checker's bucket still refuses it.
|
||||
func TestTheGatesRecheckStatusRoundTripsAndTheCheckersBucketRefusesIt(t *testing.T) {
|
||||
key, err := OwedKey("novox/mesh-sdk", 36, "aaaa", "status=mesh/repo-check")
|
||||
if err != nil || key != "novox/mesh-sdk.36.aaaa.status=mesh/repo-check" {
|
||||
t.Fatalf("key = %q, %v", key, err)
|
||||
}
|
||||
if _, _, _, act, err := ParseOwedKey(key); err != nil || act != "status=mesh/repo-check" {
|
||||
t.Errorf("parse = %q, %v", act, err)
|
||||
}
|
||||
o := Owed{Act: OwedStatus, Context: StatusContextRepoCheck, State: "pending", Target: "https://mesh.example/delivery/36", Text: "checking again"}
|
||||
data, err := EncodeOwed(o)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got, err := DecodeOwed(data); err != nil || !SameOwed(got, o) && got.Context != o.Context {
|
||||
t.Errorf("round trip = %+v, %v", got, err)
|
||||
}
|
||||
if _, err := EncodeCheckerOwed(o); err == nil {
|
||||
t.Error("the checker's bucket takes the gate's recheck status")
|
||||
}
|
||||
if _, _, _, err := ParseCheckerOwedKey(key); err == nil {
|
||||
t.Error("a checker owed key of the recheck status accepted")
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -34,10 +34,11 @@ const (
|
||||
StatusContextMergeGate = "mesh/merge-gate"
|
||||
StatusContextDelivery = "mesh/delivery"
|
||||
StatusContextDeliveryGroup = "mesh/delivery-group"
|
||||
StatusContextRepoCheck = "mesh/repo-check" // the gate's pending status of a recheck (mesh-delivery.recheck)
|
||||
StatusContextCheck = "mesh/check"
|
||||
)
|
||||
|
||||
var statusContexts = []string{StatusContextMergeGate, StatusContextDelivery, StatusContextDeliveryGroup, StatusContextCheck}
|
||||
var statusContexts = []string{StatusContextMergeGate, StatusContextDelivery, StatusContextDeliveryGroup, StatusContextRepoCheck, StatusContextCheck}
|
||||
|
||||
// AskKindMerge is the kind of the gate's ask for a group's merge, the first part of its key.
|
||||
const AskKindMerge = "merge"
|
||||
|
||||
Reference in New Issue
Block a user