From 1319432e55ab03dd43f3e1836d8bf37aca980463 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 21 Oct 2026 21:49:37 +0200 Subject: [PATCH] Test that the integration level gets MESH_CHECK_BESIDE only when siblings were placed (issue 1677) --- .../cmd/mesh-build-go/preview_test.go | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/modules/mesh-build-go/cmd/mesh-build-go/preview_test.go b/modules/mesh-build-go/cmd/mesh-build-go/preview_test.go index 78b19943..2fcee7ea 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/preview_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/preview_test.go @@ -272,3 +272,46 @@ func TestPackagesRunOnlyInTheModuleThatHoldsThem(t *testing.T) { } func sha256Hex(b []byte) string { h := sha256.Sum256(b); return hex.EncodeToString(h[:]) } + +// 1677/AC (integration level): the integration level's go test is given MESH_CHECK_BESIDE when the workspace has siblings +// beside it, with the store's and the bus's addresses, and is given none when it has not. +func TestTheIntegrationLevelIsGivenTheBesideDirectoryOnlyWhenSiblingsWerePlaced(t *testing.T) { + for _, siblings := range []bool{true, false} { + f := newIntegFake(t, "slow") + m, states := integModule(t, f) + beside := filepath.Join(m.Work, "ws1", "beside") + if siblings { + if err := os.MkdirAll(filepath.Join(beside, "mesh-catalog"), 0o755); err != nil { + t.Fatal(err) + } + } + if _, st := runLevelTool(t, m, states, "integration"); st.State != delivery.StepPassed { + t.Fatalf("the step ended %s: %s", st.State, st.Reason) + } + tested := 0 + for _, c := range f.calls { + if !strings.HasPrefix(c.line, "go ") || !strings.Contains(c.line, "-tags integration") { + continue + } + tested++ + got := "" + hasNATS := false + for _, e := range c.env { + if strings.HasPrefix(e, "MESH_CHECK_BESIDE=") { + got = strings.TrimPrefix(e, "MESH_CHECK_BESIDE=") + } + hasNATS = hasNATS || strings.HasPrefix(e, "MESH_TEST_NATS=") + } + want := "" + if siblings { + want = beside + } + if got != want || !hasNATS { + t.Errorf("siblings %v: %s was given MESH_CHECK_BESIDE=%q (want %q), MESH_TEST_NATS present %v", siblings, c.line, got, want, hasNATS) + } + } + if tested == 0 { + t.Errorf("siblings %v: no integration go test ran", siblings) + } + } +}