Skip to content

Commit

Permalink
Mark windows security agent test as flaky and log output (#29029)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinFairise2 authored Sep 4, 2024
1 parent 4137724 commit 77e6fad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ import (
"testing"
"time"

componentsos "github.com/DataDog/test-infra-definitions/components/os"
"github.com/DataDog/test-infra-definitions/scenarios/aws/ec2"
"github.com/stretchr/testify/require"

"github.com/DataDog/datadog-agent/pkg/util/testutil/flake"
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e"
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments"
awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host"
"github.com/DataDog/datadog-agent/test/new-e2e/tests/windows"
windowsCommon "github.com/DataDog/datadog-agent/test/new-e2e/tests/windows/common"
windowsAgent "github.com/DataDog/datadog-agent/test/new-e2e/tests/windows/common/agent"
componentsos "github.com/DataDog/test-infra-definitions/components/os"
"github.com/DataDog/test-infra-definitions/scenarios/aws/ec2"
"github.com/stretchr/testify/require"
)

type vmSuite struct {
Expand All @@ -34,6 +36,7 @@ var (
)

func TestVMSuite(t *testing.T) {
flake.Mark(t)
suiteParams := []e2e.SuiteOption{e2e.WithProvisioner(awshost.ProvisionerNoAgentNoFakeIntake(awshost.WithEC2InstanceOptions(ec2.WithOS(componentsos.WindowsDefault))))}
if *devMode {
suiteParams = append(suiteParams, e2e.WithDevMode())
Expand Down
17 changes: 11 additions & 6 deletions test/new-e2e/tests/windows/remoteexecutable.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import (
"strings"
"testing"

"github.com/DataDog/datadog-agent/test/new-e2e/pkg/components"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/DataDog/datadog-agent/test/new-e2e/pkg/components"
)

// RemoteExecutable is a helper struct to run tests on a remote host
Expand Down Expand Up @@ -138,15 +140,18 @@ func executeAndLogOutput(t *testing.T, vm *components.RemoteHost, command string
outfilename := command + ".out"
fullcommand := "cd " + cmdDir + ";"
fullcommand += command + " " + strings.Join(args, " ") + " | Out-File -Encoding ASCII -FilePath " + outfilename
_, err := vm.Execute(fullcommand)
require.NoError(t, err)
_, testErr := vm.Execute(fullcommand)

// get the output
outbytes, err := vm.ReadFile(outfilename)
require.NoError(t, err)

// log the output
for _, line := range strings.Split(string(outbytes[:]), "\n") {
t.Logf("TestSuite: %s", line)
if assert.NoError(t, err) {
for _, line := range strings.Split(string(outbytes[:]), "\n") {
t.Logf("TestSuite: %s", line)
}
}

require.NoError(t, testErr)

}

0 comments on commit 77e6fad

Please sign in to comment.