Skip to content

Commit

Permalink
Domain User Syntax Test
Browse files Browse the repository at this point in the history
  • Loading branch information
jack0x2 committed Dec 10, 2024
1 parent 40a840d commit 9116302
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions test/new-e2e/tests/windows/domain-test/domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@ package domain

import (
"fmt"
awsHostWindows "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host/windows"
"github.com/DataDog/datadog-agent/test/new-e2e/tests/windows"
"github.com/DataDog/test-infra-definitions/components/activedirectory"
"path/filepath"
"reflect"
"testing"
"time"

"github.com/DataDog/test-infra-definitions/components/activedirectory"

awsHostWindows "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host/windows"
"github.com/DataDog/datadog-agent/test/new-e2e/tests/windows"

"github.com/stretchr/testify/assert"

"github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e"
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments"
platformCommon "github.com/DataDog/datadog-agent/test/new-e2e/tests/agent-platform/common"
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"
"github.com/DataDog/datadog-agent/test/new-e2e/tests/windows/install-test"
"github.com/stretchr/testify/assert"
installtest "github.com/DataDog/datadog-agent/test/new-e2e/tests/windows/install-test"
)

const (
Expand All @@ -32,8 +35,9 @@ const (

func TestInstallsOnDomainController(t *testing.T) {
suites := []e2e.Suite[environments.WindowsHost]{
&testInstallSuite{},
&testBasicInstallSuite{},
&testUpgradeSuite{},
&testInstallUserSyntaxSuite{},
}

for _, suite := range suites {
Expand All @@ -53,12 +57,12 @@ type testInstallSuite struct {
windows.BaseAgentInstallerSuite[environments.WindowsHost]
}

func (suite *testInstallSuite) TestGivenDomainUserCanInstallAgent() {
func (suite *testInstallSuite) testGivenDomainUserCanInstallAgent(username string) {
host := suite.Env().RemoteHost

_, err := suite.InstallAgent(host,
windowsAgent.WithPackage(suite.AgentPackage),
windowsAgent.WithAgentUser(fmt.Sprintf("%s\\%s", TestDomain, TestUser)),
windowsAgent.WithAgentUser(username),
windowsAgent.WithAgentUserPassword(fmt.Sprintf("\"%s\"", TestPassword)),
windowsAgent.WithValidAPIKey(),
windowsAgent.WithFakeIntake(suite.Env().FakeIntake),
Expand All @@ -81,6 +85,22 @@ func (suite *testInstallSuite) TestGivenDomainUserCanInstallAgent() {
}, 5*time.Minute, 10*time.Second)
}

type testBasicInstallSuite struct {
testInstallSuite
}

func (suite *testBasicInstallSuite) TestGivenDomainUserCanInstallAgent() {
suite.testGivenDomainUserCanInstallAgent(fmt.Sprintf("%s\\%s", TestDomain, TestUser))
}

type testInstallUserSyntaxSuite struct {
testInstallSuite
}

func (suite *testInstallUserSyntaxSuite) TestGivenDomainUserCanInstallAgent() {
suite.testGivenDomainUserCanInstallAgent(fmt.Sprintf("%s@%s", TestUser, TestDomain))
}

type testUpgradeSuite struct {
windows.BaseAgentInstallerSuite[environments.WindowsHost]
}
Expand Down

0 comments on commit 9116302

Please sign in to comment.