Do not ask the operator to stop a delivery that is already stopped; say what ends it (issue 1581)
This commit is contained in:
@@ -498,3 +498,24 @@ func TestAnUnansweredMergeCheckOnAReadyOrRejectedDeliveryOffersARecheck(t *testi
|
||||
t.Fatalf("a line with no delivery held says to %q", o.Needs)
|
||||
}
|
||||
}
|
||||
|
||||
// **A delivery already stopped is not asked to be stopped** (novox/hq issue 1581): mesh-delivery.stop refuses a
|
||||
// stopped delivery, so the condition offers no Stop and says what ends it, in the stalled line's own words. Any
|
||||
// other held state keeps its Stop.
|
||||
func TestAStoppedDeliveryIsNotAskedToBeStopped(t *testing.T) {
|
||||
l := stalledLine{ID: "novox/mesh-catalog@2f6086120c46", State: "stopped", For: "12h19m36s",
|
||||
H2: "none: a merge that delivers its modules ends it — the operator's",
|
||||
Says: "a merged change never reached the machines"}
|
||||
_, _, _, needs, actions := stalledWords(l, conditions.Observation{Resolver: conditions.ResolverOperator})
|
||||
if len(actions) != 0 {
|
||||
t.Fatalf("a stopped delivery offers %v, want no action", actions)
|
||||
}
|
||||
if strings.Contains(needs, "stop it") || !strings.Contains(needs, "a merge that delivers its modules ends it") {
|
||||
t.Fatalf("needs = %q, want what ends it and no ask to stop", needs)
|
||||
}
|
||||
l.State = "failing"
|
||||
_, _, _, needs, actions = stalledWords(l, conditions.Observation{Resolver: conditions.ResolverOperator})
|
||||
if len(actions) != 1 || actions[0].Label != "Stop" || !strings.HasPrefix(needs, "stop it") {
|
||||
t.Fatalf("another held state changed: needs %q, actions %v", needs, actions)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user