Make the pure loader regression test detect bootstrap
All checks were successful
ci/woodpecker/push/verify Pipeline was successful

This commit is contained in:
2026-11-23 17:24:16 +00:00
parent 7f7033779c
commit abaa3c78df
2 changed files with 22 additions and 7 deletions

View File

@@ -96,7 +96,11 @@ func TestPipelineSourceRetainsPreparedMainAndPureLoading(t *testing.T) {
t.Fatal(err)
}
const name = "NARRATIO_SOURCE_HANDOFF_TEST"
// Register cleanup for the original value and presence before unsetting it.
t.Setenv(name, "")
if err := os.Unsetenv(name); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(secretDir, name), []byte("synthetic-secret"), 0600); err != nil {
t.Fatal(err)
}
@@ -107,13 +111,16 @@ func TestPipelineSourceRetainsPreparedMainAndPureLoading(t *testing.T) {
if _, err := LoadPipelineWithOptions(path, PipelineLoadOptions{}); err != nil {
t.Fatal(err)
}
if got := os.Getenv(name); got != "" {
if _, present := os.LookupEnv(name); present {
t.Fatal("pure loading changed environment")
}
_, prepared, err := configkit.LoadSecretsIntoEnvironmentFromConfig(PipelineSource(path, PipelineLoadOptions{}))
if err != nil {
t.Fatal(err)
}
if got := os.Getenv(name); got != "synthetic-secret" {
t.Fatal("explicit bootstrap did not populate the test credential")
}
if err := os.WriteFile(path, []byte("invalid: ["), 0600); err != nil {
t.Fatal(err)
}