Make the pure loader regression test detect bootstrap
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user