From 5a033ddaa917c4c7b13e4b9145275110d8a28674 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 14:00:49 +0200 Subject: [PATCH] fix when fixture.Install logs 'ignoring AGENT_KEEP_INSTALLED...' (#3380) (#3388) (cherry picked from commit 3372e6f8f15b1fb8807c68f075ae9da71910ed6d) Co-authored-by: Anderson Queiroz --- pkg/testing/fixture_install.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/testing/fixture_install.go b/pkg/testing/fixture_install.go index 5fe62009512..81ca7025e3a 100644 --- a/pkg/testing/fixture_install.go +++ b/pkg/testing/fixture_install.go @@ -131,12 +131,14 @@ func (f *Fixture) Install(ctx context.Context, installOpts *InstallOpts, opts .. // environment variable AGENT_KEEP_INSTALLED=true will skip the uninstall // useful to debug the issue with the Elastic Agent - if keepInstalled() && f.t.Failed() { - f.t.Logf("skipping uninstall; AGENT_KEEP_INSTALLED=true") + if f.t.Failed() && keepInstalled() { + f.t.Logf("skipping uninstall; test failed and AGENT_KEEP_INSTALLED=true") return - } else { + } + + if keepInstalled() { f.t.Logf("ignoring AGENT_KEEP_INSTALLED=true as test succeeded, " + - "keeping the agent installed will jeperdise other tests") + "keeping the agent installed will jeopardise other tests") } out, err := f.Uninstall(ctx, &UninstallOpts{Force: true, UninstallToken: f.uninstallToken})