diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go index 93f7a489..d08ee790 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go @@ -42,7 +42,6 @@ import ( occ "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient" oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel" "git.novox.be/novox/mesh-contracts/provisioning/go/clients/meshprovisionerclient" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-teller/tellerevents" stdio "git.novox.be/novox/mesh-sdk/go" "git.novox.be/novox/mesh-sdk/go/announce" "git.novox.be/novox/mesh-sdk/go/buscompose" @@ -1038,25 +1037,21 @@ func TestABackupAnswerIsWrittenIntoTheNodesWant(t *testing.T) { if w2.Words == w1.Words { t.Errorf("the second answer left the want as it was: %+v", w2) } - // Issue 1966 note 165 (AC165-1, AC165-4): the move is superseded, the trunk and then the want naming another build; the pass takes the backup - // ask away, and the teller's ask-ended for it, said after, writes nothing. + // Issue 1966 note 165 (AC165-1): the move is superseded, the trunk and then the want naming another build; the pass takes + // the backup ask away and clears the condition of the failed backup. fOther := meshcatalogclient.SourcePrefix2 + strings.Repeat("c", 64) b.fixture(t, "web", fOther, `{"module":"web","version":"2"}`) // the trunk moves on: the want follows - for deadline := time.Now().Add(15 * time.Second); b.hasKey(buckets.Asks, akey); time.Sleep(50 * time.Millisecond) { + for deadline := time.Now().Add(15 * time.Second); ; time.Sleep(50 * time.Millisecond) { + cleared := false + for k, c := range b.conditionsSaid(t) { + cleared = cleared || (strings.Contains(k, "backup") && c.State == occ.StateCleared) + } + if !b.hasKey(buckets.Asks, akey) && cleared { + break + } if time.Now().After(deadline) { - t.Fatal("the backup ask of a move the want left behind was not taken away") + t.Fatalf("the backup of a move the want left behind: ask there %v, condition cleared %v", b.hasKey(buckets.Asks, akey), cleared) } - } - body, err := tellerevents.EncodeEnded(tellerevents.Ended{Key: akey, Ask: a2.Ask.ID, Outcome: occ.OutcomeExpired}) - if err != nil { - t.Fatal(err) - } - if _, err := b.js.Publish(b.ctx, askEndedSubject, body); err != nil { - t.Fatal(err) - } - time.Sleep(time.Second) - if b.hasKey(buckets.Asks, akey) { - t.Error("an ended backup ask whose want moved on was written again") } } diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go index 73ac607e..477ec9c2 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go @@ -774,7 +774,7 @@ func (p *passer) fingerprintsOf(node, module, trunkFP string) []string { return out } -// staleAsks takes away, at every pass, each hold, restore and record ask that staleAsk names (issue 1906, note 28): an ask +// staleAsks takes away, at every pass, each hold, restore, record and backup ask that staleAsk names (issue 1906, note 28): an ask // outlived its fingerprint, and the teller takes its router ask back from the operator when the key goes. With the trunk not // read at all (no module), nothing is taken away. func (p *passer) staleAsks(ctx context.Context, trunk map[string]meshcatalog.ModulesByModuleValue) {