Test chains start laid out; two tests follow delivery 2's meaning (issues 1121, 1108, 1109)
mesh/merge-gate head cbc6bac8c070 merged into trunk da6d038e07c0 — error: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; the m…
mesh/repo-check head cbc6bac8c070 merged into trunk da6d038e07c0 — fail: its merge-check.sh failed: --- FAIL: TestTheGrantsStepSendsTheUserListAndNothingEl…
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate head cbc6bac8c070 merged into trunk da6d038e07c0 — error: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; the m…
mesh/repo-check head cbc6bac8c070 merged into trunk da6d038e07c0 — fail: its merge-check.sh failed: --- FAIL: TestTheGrantsStepSendsTheUserListAndNothingEl…
mesh/delivery superseded: a newer head of the same pull request
The fixtures' fresh chain writes the layout marker, as the controller's start leaves a mesh, so the gate stays for the live start. A pending wait that ended unanswered is carried by the next one, so both are known. A hand send forgets what each assignment runs, so the test writes its build and commit after the send.
This commit is contained in:
@@ -53,8 +53,9 @@ func TestAPendingAssignmentIsAKeyOfTheAssignmentsBucket(t *testing.T) {
|
|||||||
if err != nil || next.ID == p.ID {
|
if err != nil || next.ID == p.ID {
|
||||||
t.Fatalf("a wait after one ended: %+v %v", next, err)
|
t.Fatalf("a wait after one ended: %+v %v", next, err)
|
||||||
}
|
}
|
||||||
if known, _ := inv.PendingKnown(ctx, []string{p.ID, next.ID}); known[p.ID] || !known[next.ID] {
|
// The earlier wait ended unmade and nobody answered its condition, so the new wait carries it (issue 1108): both are on record.
|
||||||
t.Fatalf("known %v: the key holds the newer one now", known)
|
if known, _ := inv.PendingKnown(ctx, []string{p.ID, next.ID}); !known[p.ID] || !known[next.ID] {
|
||||||
|
t.Fatalf("known %v: the key holds the newer one and carries the unanswered earlier one", known)
|
||||||
}
|
}
|
||||||
if history, _ := inv.chain.Assignments.History(ctx, "anchor.sensors"); len(history) != 2 {
|
if history, _ := inv.chain.Assignments.History(ctx, "anchor.sensors"); len(history) != 2 {
|
||||||
t.Fatalf("the earlier wait is in the key's history: %d values", len(history))
|
t.Fatalf("the earlier wait is in the key's history: %d values", len(history))
|
||||||
|
|||||||
@@ -289,12 +289,6 @@ func TestThePlansAreKeptInTheAssignmentsValuesAndNothingElseOfThemMoves(t *testi
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// A build and a commit put in the value by another write.
|
|
||||||
cur, _, _ := inv.chain.Assignments.Get(ctx, "anchor.dunst")
|
|
||||||
cur.Value.Build, cur.Value.Commit = "build-1", "c1"
|
|
||||||
if _, err := inv.chain.Assignments.Update(ctx, "anchor.dunst", cur.Value, cur.Revision); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
record, _ := inv.NodeByName(ctx, node)
|
record, _ := inv.NodeByName(ctx, node)
|
||||||
digest := "sha256:" + strings.Repeat("d", 64)
|
digest := "sha256:" + strings.Repeat("d", 64)
|
||||||
plan := Provisioning{Templates: TemplatesArchive{Source: "http://store:5000/v2/dunst/files/blobs/" + digest,
|
plan := Provisioning{Templates: TemplatesArchive{Source: "http://store:5000/v2/dunst/files/blobs/" + digest,
|
||||||
@@ -304,6 +298,13 @@ func TestThePlansAreKeptInTheAssignmentsValuesAndNothingElseOfThemMoves(t *testi
|
|||||||
if err := inv.RecordSentWith(ctx, record.ID, "first", nil, 0, 0, Send{Digest: "first", Provisioning: raw}); err != nil {
|
if err := inv.RecordSentWith(ctx, record.ID, "first", nil, 0, 0, Send{Digest: "first", Provisioning: raw}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
// A build and a commit put in the value by another write, after the send: a send that carries no builds (a hand send, as this
|
||||||
|
// one) forgets what each assignment of its machine runs (issue 1109), so they are written once it is recorded.
|
||||||
|
cur, _, _ := inv.chain.Assignments.Get(ctx, "anchor.dunst")
|
||||||
|
cur.Value.Build, cur.Value.Commit = "build-1", "c1"
|
||||||
|
if _, err := inv.chain.Assignments.Update(ctx, "anchor.dunst", cur.Value, cur.Revision); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
inv.SetProvisioningPlans(inv.SentProvisioningPlans)
|
inv.SetProvisioningPlans(inv.SentProvisioningPlans)
|
||||||
written, removed, err := inv.KeepAssignmentPlans(ctx)
|
written, removed, err := inv.KeepAssignmentPlans(ctx)
|
||||||
if err != nil || written != 2 || removed != 0 {
|
if err != nil || written != 2 || removed != 0 {
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ func ForTest(t *testing.T) *Inventory {
|
|||||||
}
|
}
|
||||||
// The chain is on the bus in a mesh; in a test it is in memory (ADR 0408).
|
// The chain is on the bus in a mesh; in a test it is in memory (ADR 0408).
|
||||||
c := chain.InMemory(nil)
|
c := chain.InMemory(nil)
|
||||||
|
// A fresh test chain has nothing to lay out: it is laid out already, as the controller's start leaves a mesh (issue 1121).
|
||||||
|
if _, err := c.Builds.CreateRaw(t.Context(), chain.LayoutMarkerKey, []byte(`{}`)); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
inv.UseChain(c)
|
inv.UseChain(c)
|
||||||
testChains.Store(os.Getenv(store.Variable(Name)), c)
|
testChains.Store(os.Getenv(store.Variable(Name)), c)
|
||||||
t.Cleanup(func() { testChains.Delete(os.Getenv(store.Variable(Name))) })
|
t.Cleanup(func() { testChains.Delete(os.Getenv(store.Variable(Name))) })
|
||||||
@@ -129,6 +133,10 @@ func ForTestBefore(t *testing.T, number int) (*Inventory, func()) {
|
|||||||
}
|
}
|
||||||
// The chain is in memory, for what a test of the store before a migration reads of it.
|
// The chain is in memory, for what a test of the store before a migration reads of it.
|
||||||
c := chain.InMemory(nil)
|
c := chain.InMemory(nil)
|
||||||
|
// A fresh test chain has nothing to lay out: it is laid out already, as the controller's start leaves a mesh (issue 1121).
|
||||||
|
if _, err := c.Builds.CreateRaw(t.Context(), chain.LayoutMarkerKey, []byte(`{}`)); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
inv.UseChain(c)
|
inv.UseChain(c)
|
||||||
testChains.Store(os.Getenv(store.Variable(Name)), c)
|
testChains.Store(os.Getenv(store.Variable(Name)), c)
|
||||||
t.Cleanup(func() { testChains.Delete(os.Getenv(store.Variable(Name))) })
|
t.Cleanup(func() { testChains.Delete(os.Getenv(store.Variable(Name))) })
|
||||||
|
|||||||
Reference in New Issue
Block a user