From 264f8240f2cdfea22fda7275edfbfbfceb51bfb6 Mon Sep 17 00:00:00 2001 From: Jack Phillips Date: Thu, 12 Dec 2024 20:11:55 -0500 Subject: [PATCH] User@domain.com Test (#31972) --- .../tests/windows/domain-test/domain_test.go | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/test/new-e2e/tests/windows/domain-test/domain_test.go b/test/new-e2e/tests/windows/domain-test/domain_test.go index 698d45fd0c138..134dc68d30683 100644 --- a/test/new-e2e/tests/windows/domain-test/domain_test.go +++ b/test/new-e2e/tests/windows/domain-test/domain_test.go @@ -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 ( @@ -32,8 +35,9 @@ const ( func TestInstallsOnDomainController(t *testing.T) { suites := []e2e.Suite[environments.WindowsHost]{ - &testInstallSuite{}, + &testBasicInstallSuite{}, &testUpgradeSuite{}, + &testInstallUserSyntaxSuite{}, } for _, suite := range suites { @@ -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), @@ -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] }