From 8ba3327de7f76636c9fcc25c28b2a56834b83bf9 Mon Sep 17 00:00:00 2001 From: Justyna Betkier Date: Wed, 24 Apr 2024 11:50:33 +0200 Subject: [PATCH] Append both env variables instead of fetching twice and overriding them. Previously the second line would fetch the clean environment variables and drop the changes from the first line. --- test/e2e/framework/util.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 2a7bd470e0c..493cbfb264f 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -615,8 +615,9 @@ func CoreDump(dir string) { Logf("Dumping logs locally to: %s", dir) cmd = exec.Command(path.Join(TestContext.RepoRoot, "cluster", "log-dump", "log-dump.sh"), dir) } - cmd.Env = append(os.Environ(), fmt.Sprintf("LOG_DUMP_SYSTEMD_SERVICES=%s", parseSystemdServices(TestContext.SystemdServices))) - cmd.Env = append(os.Environ(), fmt.Sprintf("LOG_DUMP_SYSTEMD_JOURNAL=%v", TestContext.DumpSystemdJournal)) + env := os.Environ() + env = append(env, fmt.Sprintf("LOG_DUMP_SYSTEMD_SERVICES=%s", parseSystemdServices(TestContext.SystemdServices))) + cmd.Env = append(env, fmt.Sprintf("LOG_DUMP_SYSTEMD_JOURNAL=%v", TestContext.DumpSystemdJournal)) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr