Pass the ambient boolean as one flag argument

Go flag parsing stops at the separate boolean value before ambient-token. Use -ambient-enabled=value and pin the deployed argv contract discovered during live V-691 verification. Owner explicitly requested direct commits to master.
This commit is contained in:
2026-08-13 03:07:52 +04:00
parent 28c2ffb84f
commit 06576b406c
2 changed files with 21 additions and 1 deletions
+20
View File
@@ -108,3 +108,23 @@ func TestCanonicalDeployEnvExampleNamesEverySecret(t *testing.T) {
}
}
}
// Go's flag package treats a bare boolean flag as true and does not consume a
// following "true"/"false" argument. That following value becomes the first
// positional argument and stops parsing, so every flag after it silently keeps
// its default. Keep the Compose boolean in -name=value form (V-691 live QA).
func TestComposeAmbientBooleanDoesNotStopFlagParsing(t *testing.T) {
path := filepath.Join("..", "..", "docker-compose.yml")
b, err := os.ReadFile(path)
if err != nil {
t.Fatalf("read %s: %v", path, err)
}
compose := string(b)
const joined = `"-ambient-enabled=${MAVEN_AMBIENT_ENABLED:-false}"`
if !strings.Contains(compose, joined) {
t.Fatalf("mavweb ambient boolean must be one argv element %s", joined)
}
if strings.Contains(compose, `"-ambient-enabled",`) {
t.Fatal("bare -ambient-enabled leaves its value positional and prevents -ambient-token from being parsed")
}
}