Say a waiting provider in the operator's words, and which state it is when a consumer is held (issue 405 review)
mesh/merge-gate pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without …
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery failed: its walk failed, carrying its own commit: a gate on a first machine (what it carried put back), a build, a machine
mesh/merge-gate pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without …
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery failed: its walk failed, carrying its own commit: a gate on a first machine (what it carried put back), a build, a machine
This commit is contained in:
@@ -216,7 +216,7 @@ func TestAConsumerOfAnotherPartIsRaisedOnItsOwn(t *testing.T) {
|
||||
if consumer == nil || conditionOf(open, needsOperatorKey("db", "anchor")) == nil {
|
||||
t.Fatalf("raised %v; want shop's own unhealthy beside db's needs-operator", openKeysOf(open))
|
||||
}
|
||||
if said := consumer.Evidence[0].Said; !strings.Contains(said, "its provider db on anchor waits for the operator") {
|
||||
if said := consumer.Evidence[0].Said; !strings.Contains(said, "db on anchor waits for you, but not for anything shop is known to need, so shop's fault is said on its own") {
|
||||
t.Fatalf("the consumer's condition does not say its provider waits: %s", said)
|
||||
}
|
||||
}
|
||||
@@ -326,3 +326,50 @@ func openKeysOf(cs []conditions.Condition) []string {
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// A consumer raised on its own, whose provider then waits for the operator for the part it needs, is cleared saying
|
||||
// which the provider is: it waits for you, not that it is unhealthy (novox/hq issue 405 review).
|
||||
func TestAConsumerHeldOnceItsProviderWaitsSaysWhichItIs(t *testing.T) {
|
||||
k, _ := withConditionsInMemory(t)
|
||||
ctx := t.Context()
|
||||
start := time.Now().Add(-time.Second)
|
||||
healthy := waitingDatabase()
|
||||
healthy.State, healthy.Waits = link.StateHealthy, nil
|
||||
healths := shopFailingBeside(healthy)
|
||||
was := readHoldingFor
|
||||
t.Cleanup(func() { readHoldingFor = was })
|
||||
readHoldingFor = func(_ context.Context, _ *inventory.Inventory, open []conditions.Condition) (*holding, error) {
|
||||
return holdingOf(open, healths, shopOnTheDatabase), nil
|
||||
}
|
||||
shop := map[string][]inventory.ResourceHealth{"shop": {failingConsumer("shop")}}
|
||||
for look := 1; look <= 2; look++ {
|
||||
if err := judgeModuleHealth(ctx, nil, k, "laptop", shop, map[string]int{"shop": look}, time.Now()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if open, _ := k.Open(ctx); conditionOf(open, moduleUnhealthyKey("shop", "laptop")) == nil {
|
||||
t.Fatalf("shop beside a healthy provider is not raised: %v", openKeysOf(open))
|
||||
}
|
||||
healths = shopFailingBeside(waitingDatabase())
|
||||
if err := judgeModuleHealth(ctx, nil, k, "laptop", shop, map[string]int{"shop": 3}, time.Now()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var why string
|
||||
for deadline := time.Now().Add(2 * time.Second); why == "" && time.Now().Before(deadline); {
|
||||
events, err := k.HistorySince(ctx, start)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, e := range events {
|
||||
if e.Key == moduleUnhealthyKey("shop", "laptop") && e.Change == conditions.ChangeCleared {
|
||||
why = e.Why
|
||||
}
|
||||
}
|
||||
if why == "" {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
if !strings.Contains(why, "waits on db on anchor, which waits for you") {
|
||||
t.Fatalf("shop's clearing says %q; want it to say db on anchor waits for you", why)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user