Skip to content

Commit

Permalink
enhancement(4889): update command execution in integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaanyalti committed Dec 16, 2024
1 parent 28740c3 commit 340cd78
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions testing/integration/enroll_unprivileged_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ package integration
import (
"context"
"os"
"os/exec"
"runtime"
"testing"

"github.com/gofrs/uuid/v5"
Expand Down Expand Up @@ -73,14 +71,8 @@ func TestEnrollUnprivileged(t *testing.T) {

enrollArgs := []string{"enroll", "--url", enrollUrl, "--enrollment-token", enrollmentApiKey.APIKey, "--force"}

if runtime.GOOS != "windows" {
out, err := exec.CommandContext(ctx, "elastic-agent", enrollArgs...).CombinedOutput()
require.Error(t, err)
require.Contains(t, string(out), cmd.UserOwnerMismatchError.Error())
} else {
out, err := exec.CommandContext(ctx, "C:\\Program Files\\Elastic\\Agent\\elastic-agent.exe", enrollArgs...).CombinedOutput()
require.Error(t, err)
require.Contains(t, string(out), cmd.UserOwnerMismatchError.Error())
}
out, err := fixture.Exec(ctx, enrollArgs)
require.Error(t, err)
require.Contains(t, string(out), cmd.UserOwnerMismatchError.Error())
})
}

0 comments on commit 340cd78

Please sign in to comment.