mesh-delivery takes an empty answer to a check ask as a refusal (issue 1115)
mesh/merge-gate head 5f002441b7f0 merged into trunk 580fadb63ecb — pass: builds mesh-delivery → novox; no bus step; every machine composes with the change …
mesh/repo-check head 5f002441b7f0 merged into trunk 580fadb63ecb — fail: its merge-check.sh failed: --- FAIL: TestAGroupOfTwoWithGreenChecksGetsOneAskAndOn…
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate head 5f002441b7f0 merged into trunk 580fadb63ecb — pass: builds mesh-delivery → novox; no bus step; every machine composes with the change …
mesh/repo-check head 5f002441b7f0 merged into trunk 580fadb63ecb — fail: its merge-check.sh failed: --- FAIL: TestAGroupOfTwoWithGreenChecksGetsOneAskAndOn…
mesh/delivery superseded: a newer head of the same pull request
This commit is contained in:
@@ -109,6 +109,8 @@ type fakeController struct {
|
||||
moves map[string][]string
|
||||
plans int
|
||||
down bool
|
||||
// emptyCheck makes Check answer with no id and no error, as the port does when the answer holds none.
|
||||
emptyCheck bool
|
||||
// walkReads counts the reads of the controller's walks (Walks).
|
||||
walkReads int
|
||||
// checkReady is the ready flag of each member of each check asked.
|
||||
@@ -185,6 +187,9 @@ func (c *fakeController) Check(group string, ms []Member) (string, error) {
|
||||
}
|
||||
c.asked++
|
||||
id := fmt.Sprintf("check-%d", c.asked)
|
||||
if c.emptyCheck {
|
||||
id = ""
|
||||
}
|
||||
var heads []string
|
||||
for _, m := range ms {
|
||||
heads = append(heads, m.ID)
|
||||
|
||||
@@ -1942,6 +1942,10 @@ func (h *Holder) askOwnCheck(id string, m Member, why string) {
|
||||
h.Logf("[mesh-delivery] %s's check cannot be asked yet: %v", id, err)
|
||||
return
|
||||
}
|
||||
if asked == "" {
|
||||
h.Logf("[mesh-delivery] %s's check was asked and the controller's answer held no id: taken as refused, asked again in a minute at most", id)
|
||||
return
|
||||
}
|
||||
delete(h.askTried, id)
|
||||
d := h.deliveries[id]
|
||||
if d == nil || d.State != Proposed || d.Check != nil || askedCheck(d) {
|
||||
|
||||
@@ -192,3 +192,20 @@ func TestAKeptAskWithNoIdAndNoStandingVerdictIsAskedAgainAtOnce(t *testing.T) {
|
||||
t.Fatalf("not asked again: %+v %v", d.CheckAsk, w.ctl.checks)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAnEmptyAnswerToACheckAskIsARefusalAskedAtMostOnceAMinute(t *testing.T) {
|
||||
w := newWorld(t)
|
||||
w.ctl.emptyCheck = true
|
||||
w.h.PullUpdated(pr("novox/app", 7, readyHead, "feat/x", "src/a.go"))
|
||||
id := IDOf("novox/app", readyHead)
|
||||
w.settleAll()
|
||||
w.settleAll()
|
||||
if len(w.ctl.checks) != 1 || w.delivery(id).CheckAsk != nil || len(w.forge.notesOn(readyHead)) > 1 {
|
||||
t.Fatalf("asked %v, ask kept %v; wanted one ask and none kept", w.ctl.checks, w.delivery(id).CheckAsk)
|
||||
}
|
||||
w.later(time.Minute)
|
||||
w.settleAll()
|
||||
if len(w.ctl.checks) != 2 {
|
||||
t.Fatalf("not asked again after the minute: %v", w.ctl.checks)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user