mesh/merge-gate head c79591531575 merged into trunk aa02e7bf4e78 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head c79591531575 merged into trunk aa02e7bf4e78 — pass: its merge-check.sh passed
mesh/delivery delivered
Milestone 5 moved 8,599 build records onto the bus under bare build ids, each carrying its module's whole manifest. Every build lookup then read the whole bucket, and a delivery plan's send did that per module per machine while it held the plans and the machine's declaration: the send of build-agent never finished, and every other act and the status waited behind it. Builds now live under <module>.build.<id> (requests under req.<id>, id.<id> names a build's module), with pointer keys newest, worked, held, commit.<sha> and source.<reuse key> that move only to a newer build and are read as hints, repaired when wrong. Manifests are kept once in the same bucket under manifest.sha256-<hex>, so no grant the running bus lacks is needed. The old keys are laid out once at start, idempotently, and left unread. The calls a plan look makes on the silent clocks while it holds the plans are bounded, since the vendored kv.Keys ignores its context.
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package chain
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestSubjectsMatchAsTheBusFiltersThem(t *testing.T) {
|
|
for _, c := range []struct {
|
|
pattern, key string
|
|
want bool
|
|
}{
|
|
{"alpha.>", "alpha.build-1", true}, {"alpha.>", "alpha.commit.c1", true}, {"alpha.>", "beta.build-1", false},
|
|
{"alpha.>", "alpha", false}, {"*.newest", "alpha.newest", true}, {"*.newest", "alpha.commit.newest", false},
|
|
{"*", "build-1", true}, {"*", "alpha.build-1", false}, {">", "a.b.c", true}, {"req.*", "req.build-1", true},
|
|
} {
|
|
if got := SubjectMatches(c.pattern, c.key); got != c.want {
|
|
t.Errorf("SubjectMatches(%q, %q) = %v", c.pattern, c.key, got)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestOnlyTheKeysOfAFilterAreWatched(t *testing.T) {
|
|
ctx := context.Background()
|
|
c := InMemory(nil)
|
|
for _, k := range []string{"alpha.build.b1", "alpha.build.b2", "beta.build.b3", "alpha.newest"} {
|
|
if _, err := c.Builds.CreateRaw(ctx, k, []byte(`{"id":"x"}`)); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
got, err := c.Builds.FilteredRaw(ctx, ModuleFilter("alpha"))
|
|
if err != nil || len(got) != 2 {
|
|
t.Fatalf("alpha.> gave %v: %v", got, err)
|
|
}
|
|
if !IsRecordKey("alpha.build.b1") || IsRecordKey("alpha.newest") || IsRecordKey("alpha.commit.c") || IsRecordKey("manifest.build.x") || IsRecordKey("req.b1") || IsRecordKey("id.b1") {
|
|
t.Error("IsRecordKey tells a record from a pointer wrongly")
|
|
}
|
|
}
|