Tell mesh-config what a head declares at every head, so a head that reverts a key drops its held value (issue 1826)
mesh/check failed: integration: github.com/novox/mesh-controller/internal/identity.TestACertificateChainsToTheMeshsOwnAuthority: authority_test.go:45:…
mesh/repo-check head 4357b3688f58 merged into trunk 3d4ad6fefb7c — pass: its merge-check.sh passed
mesh/merge-gate head 4357b3688f58 merged into trunk 3d4ad6fefb7c — pass: group fix/1826-held-config composed: every machine composes with the change as it …
mesh/delivery delivered
mesh/delivery-group group fix/1826-held-config delivered: every member is delivered
mesh/check failed: integration: github.com/novox/mesh-controller/internal/identity.TestACertificateChainsToTheMeshsOwnAuthority: authority_test.go:45:…
mesh/repo-check head 4357b3688f58 merged into trunk 3d4ad6fefb7c — pass: its merge-check.sh passed
mesh/merge-gate head 4357b3688f58 merged into trunk 3d4ad6fefb7c — pass: group fix/1826-held-config composed: every machine composes with the change as it …
mesh/delivery delivered
mesh/delivery-group group fix/1826-held-config delivered: every member is delivered
This commit is contained in:
@@ -98,8 +98,9 @@ func TestAnUnchangedKeyIsNotToldAndAChangedOneIs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// 1826/AC1: a pull request that changes no module.json, or removes it, tells mesh-config nothing.
|
||||
func TestAPullRequestThatDeclaresNothingSendsNothing(t *testing.T) {
|
||||
// 1826/AC1: a head that changes no module.json, or removes it, is still told, with declares {}: mesh-config re-judges at every
|
||||
// head, so a head that reverts the change drops the value held for it (review round 1, finding 1).
|
||||
func TestAHeadThatDeclaresNothingIsToldAsEmpty(t *testing.T) {
|
||||
fakeManifests(t, map[string]*catalogue.Manifest{baseSHA: manifest("n8n", nil), headSHA: manifest("n8n", nil)})
|
||||
calls := fakeConfig(t, nil)
|
||||
p := thePull()
|
||||
@@ -108,9 +109,25 @@ func TestAPullRequestThatDeclaresNothingSendsNothing(t *testing.T) {
|
||||
p = thePull()
|
||||
p.Removed = p.Paths
|
||||
tellPullDeclares(context.Background(), io.Discard, []pullAt{p})
|
||||
if len(*calls) != 0 {
|
||||
if len(*calls) != 2 {
|
||||
t.Fatalf("mesh-config was told %v", *calls)
|
||||
}
|
||||
for _, c := range *calls {
|
||||
if d, _ := json.Marshal(c["declares"]); string(d) != "{}" || c["head"] != headSHA {
|
||||
t.Fatalf("told %v", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1826/AC1: a head whose paths are cut, or whose base is unknown, cannot be read: nothing is told, never an empty set.
|
||||
func TestAHeadThatCannotBeReadIsNotToldAsEmpty(t *testing.T) {
|
||||
calls := fakeConfig(t, nil)
|
||||
p := thePull()
|
||||
p.Truncated = true
|
||||
tellPullDeclares(context.Background(), io.Discard, []pullAt{p})
|
||||
if len(*calls) != 0 {
|
||||
t.Fatalf("told %v", *calls)
|
||||
}
|
||||
}
|
||||
|
||||
// 1826/AC1: a module.json changed without a declaration changing is told as an empty set, so mesh-config re-judges what it holds.
|
||||
@@ -182,3 +199,11 @@ func TestTheCheckRequestCarriesTheHeldValues(t *testing.T) {
|
||||
t.Fatalf("a composed member carries %+v", request.Check.HeldConfig)
|
||||
}
|
||||
}
|
||||
|
||||
// 1826/AC1: a repository that builds a module of the mesh holds modules; another does not.
|
||||
func TestARepositoryThatBuildsAModuleHoldsModules(t *testing.T) {
|
||||
entries := []inventory.Entry{{Manifest: catalogue.Manifest{Module: "a"}, Source: inventory.Source{Repository: "novox/mesh-catalog", Path: "modules/a"}}}
|
||||
if !holdsModules(entries, "novox", "mesh-catalog") || holdsModules(entries, "novox", "hq") {
|
||||
t.Fatal("wrong")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user