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:
+1
-1
@@ -107,7 +107,7 @@ services:
|
||||
# `ps` inside this container, unlike the zenmoney and IMAP secrets which are
|
||||
# read from files.
|
||||
command: ["mavweb", "-addr", ":9201", "-voice", "mavend:9100", "-core", "/run/maven/mavend.sock",
|
||||
"-ambient-enabled", "${MAVEN_AMBIENT_ENABLED:-false}",
|
||||
"-ambient-enabled=${MAVEN_AMBIENT_ENABLED:-false}",
|
||||
"-ambient-token", "${MAVEN_AMBIENT_TOKEN:-}",
|
||||
"-nexus", "http://nexus:9740", "-praxis", "http://praxis:8989", "-hexis", "http://hexis:9741"]
|
||||
depends_on: [mavend]
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user