With the hand rebuild gone, a retry of a plan failed past the bus's bound read the waiting modules while the plan still said failed, named none, and answered "asked" with nothing after it.
24 lines
954 B
Go
24 lines
954 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/novox/mesh-controller/internal/inventory"
|
|
)
|
|
|
|
// A retry of a plan failed past the bus's bound, whose module the bus still does not answer, names that module as waiting:
|
|
// read while the plan still says failed, it was named nowhere, and the retry said "asked" with nothing after it (issue
|
|
// 1403, met again once the hand rebuild no longer resumed the plan first).
|
|
func TestARetryNamesTheModulesStillWaitingForTheBus(t *testing.T) {
|
|
since := time.Now().UTC()
|
|
p := inventory.Plan{ID: "plan-bus", State: inventory.PlanFailed, Tiers: [][]string{{"a"}},
|
|
Modules: map[string]*inventory.PlanModule{"a": {BusWaitFrom: &since}}}
|
|
waiting := busWaitingOnRetry(p)
|
|
_, said := retryWords(p, []string{"a"}, nil, waiting)
|
|
if !strings.Contains(said, "a not asked yet: the bus did not answer") || strings.Contains(said, "asked ;") {
|
|
t.Fatalf("a retry left for the bus is said as %q", said)
|
|
}
|
|
}
|