Skip to content

Commit

Permalink
fix when fixture.Install logs 'ignoring AGENT_KEEP_INSTALLED...' (#3380)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3372e6f)
  • Loading branch information
AndersonQ committed Sep 18, 2023
1 parent 7f2684b commit 2081796
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/testing/fixture_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"time"

"github.com/stretchr/testify/require"

"github.com/elastic/elastic-agent/internal/pkg/agent/application/paths"
"github.com/elastic/elastic-agent/pkg/control/v2/client"
"github.com/elastic/elastic-agent/pkg/core/process"
Expand Down Expand Up @@ -129,12 +126,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})
Expand Down

0 comments on commit 2081796

Please sign in to comment.