Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the tests requiring FIPS into the same folder #32849

Merged
merged 7 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .gitlab/e2e_install_packages/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
- E2E_MSI_TEST: TestNPMInstallWithAddLocal
- E2E_MSI_TEST: TestNPMUpgradeFromBeta
- E2E_MSI_TEST: TestUpgradeFromV6
- E2E_MSI_TEST: TestFIPSAgentDoesNotInstallOverAgent
- E2E_MSI_TEST: TestAgentDoesNotInstallOverFIPSAgent

new-e2e_windows_powershell_module_test:
extends: .new_e2e_template
Expand Down Expand Up @@ -116,7 +114,13 @@ new-e2e-windows-agent-a7-x86_64-fips:
- .new-e2e_agent_a7
needs:
- !reference [.needs_new_e2e_template]
- deploy_windows_testing-a7
- deploy_windows_testing-a7-fips
parallel:
matrix:
- EXTRA_PARAMS: --run "TestFIPSAgent$"
- EXTRA_PARAMS: --run "TestFIPSAgentDoesNotInstallOverAgent$"
- EXTRA_PARAMS: --run "TestAgentDoesNotInstallOverFIPSAgent$"
rules:
- !reference [.on_deploy]
- !reference [.on_e2e_or_windows_installer_changes]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

package installtest
package fipstest

import (
"os"
"path/filepath"
"strings"

"github.com/DataDog/datadog-agent/pkg/util/testutil/flake"
installtest "github.com/DataDog/datadog-agent/test/new-e2e/tests/windows/install-test"

"github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments"
"github.com/DataDog/datadog-agent/test/new-e2e/tests/windows"
windowsCommon "github.com/DataDog/datadog-agent/test/new-e2e/tests/windows/common"
Expand All @@ -37,7 +38,7 @@ func TestFIPSAgentDoesNotInstallOverAgent(t *testing.T) {
require.NoError(t, err, "should get last stable agent package from env")
s.previousAgentPackage = previousAgentPackage
os.Setenv(windowsAgent.PackageFlavorEnvVar, "fips")
run(t, s)
installtest.Run[environments.WindowsHost](t, s)
}

// TestAgentDoesNotInstallOverFIPSAgent tests that the base Agent cannot be installed over the FIPS agent
Expand All @@ -51,7 +52,7 @@ func TestAgentDoesNotInstallOverFIPSAgent(t *testing.T) {
require.NoError(t, err, "should get Agent package from env")
s.previousAgentPackage = previousAgentPackage
os.Setenv(windowsAgent.PackageFlavorEnvVar, "base")
run(t, s)
installtest.Run[environments.WindowsHost](t, s)
}

func (s *mutuallyExclusiveInstallSuite) SetupSuite() {
Expand All @@ -68,7 +69,6 @@ func (s *mutuallyExclusiveInstallSuite) SetupSuite() {
}

func (s *mutuallyExclusiveInstallSuite) TestMutuallyExclusivePackage() {
flake.Mark(s.T())
host := s.Env().RemoteHost

// Install second Agent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestAgentUser(t *testing.T) {
tc: tc,
}
t.Run(tc.TC().name, func(t *testing.T) {
run(t, s)
Run(t, s)
})
}
}
3 changes: 2 additions & 1 deletion test/new-e2e/tests/windows/install-test/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ func isCI() bool {
return os.Getenv("CI") != ""
}

func run[Env any](t *testing.T, s e2e.Suite[Env]) {
// Run sets some options and runs an install test.
func Run[Env any](t *testing.T, s e2e.Suite[Env]) {
opts := []e2e.SuiteOption{e2e.WithProvisioner(awsHostWindows.ProvisionerNoAgentNoFakeIntake())}

agentPackage, err := windowsAgent.GetPackageFromEnv()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestSubServicesOpts(t *testing.T) {
tc: tc,
}
t.Run(tc.name, func(t *testing.T) {
run(t, s)
Run(t, s)
})
// clean the host between test runs
s.cleanupOnSuccessInDevMode()
Expand Down
14 changes: 7 additions & 7 deletions test/new-e2e/tests/windows/install-test/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

func TestInstall(t *testing.T) {
s := &testInstallSuite{}
run(t, s)
Run(t, s)
}

type testInstallSuite struct {
Expand Down Expand Up @@ -127,7 +127,7 @@ func (s *testInstallSuite) testCodeSignatures(t *Tester, remoteMSIPath string) {
// checks that the files are not removed
func TestInstallExistingAltDir(t *testing.T) {
s := &testInstallExistingAltDirSuite{}
run(t, s)
Run(t, s)
}

type testInstallExistingAltDirSuite struct {
Expand Down Expand Up @@ -189,7 +189,7 @@ func (s *testInstallExistingAltDirSuite) TestInstallExistingAltDir() {

func TestInstallAltDir(t *testing.T) {
s := &testInstallAltDirSuite{}
run(t, s)
Run(t, s)
}

type testInstallAltDirSuite struct {
Expand Down Expand Up @@ -224,7 +224,7 @@ func (s *testInstallAltDirSuite) TestInstallAltDir() {

func TestInstallAltDirAndCorruptForUninstall(t *testing.T) {
s := &testInstallAltDirAndCorruptForUninstallSuite{}
run(t, s)
Run(t, s)
}

type testInstallAltDirAndCorruptForUninstallSuite struct {
Expand Down Expand Up @@ -261,7 +261,7 @@ func (s *testInstallAltDirAndCorruptForUninstallSuite) TestInstallAltDirAndCorru

func TestRepair(t *testing.T) {
s := &testRepairSuite{}
run(t, s)
Run(t, s)
}

type testRepairSuite struct {
Expand Down Expand Up @@ -313,7 +313,7 @@ func (s *testRepairSuite) TestRepair() {

func TestInstallOpts(t *testing.T) {
s := &testInstallOptsSuite{}
run(t, s)
Run(t, s)
}

type testInstallOptsSuite struct {
Expand Down Expand Up @@ -420,7 +420,7 @@ func (s *testInstallOptsSuite) TestInstallOpts() {

func TestInstallFail(t *testing.T) {
s := &testInstallFailSuite{}
run(t, s)
Run(t, s)
}

type testInstallFailSuite struct {
Expand Down
8 changes: 4 additions & 4 deletions test/new-e2e/tests/windows/install-test/npm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func TestNPMUpgradeToNPM(t *testing.T) {
s := &testNPMUpgradeToNPMSuite{}
s.previousVersion = "7.42.0-1"
run(t, s)
Run(t, s)
}

type testNPMUpgradeToNPMSuite struct {
Expand All @@ -55,7 +55,7 @@ func (s *testNPMUpgradeToNPMSuite) TestNPMUgpradeToNPM() {
func TestNPMUpgradeNPMToNPM(t *testing.T) {
s := &testNPMUpgradeNPMToNPMSuite{}
s.previousVersion = "7.42.0-1"
run(t, s)
Run(t, s)
}

type testNPMUpgradeNPMToNPMSuite struct {
Expand Down Expand Up @@ -84,7 +84,7 @@ func (s *testNPMUpgradeNPMToNPMSuite) TestNPMUpgradeNPMToNPM() {
// Old name: Scenario 9
func TestNPMInstallWithAddLocal(t *testing.T) {
s := &testNPMInstallWithAddLocalSuite{}
run(t, s)
Run(t, s)
}

type testNPMInstallWithAddLocalSuite struct {
Expand Down Expand Up @@ -113,7 +113,7 @@ func TestNPMUpgradeFromBeta(t *testing.T) {
s := &testNPMUpgradeFromBeta{}
s.previousVersion = "7.23.2-beta1-1"
s.url = "https://ddagent-windows-unstable.s3.amazonaws.com/datadog-agent-7.23.2-beta1-1-x86_64.msi"
run(t, s)
Run(t, s)
}

type testNPMUpgradeFromBeta struct {
Expand Down
14 changes: 7 additions & 7 deletions test/new-e2e/tests/windows/install-test/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestUpgrade(t *testing.T) {
previousAgentPackage, err := windowsAgent.GetLastStablePackageFromEnv()
require.NoError(t, err, "should get last stable agent package from env")
s.previousAgentPackge = previousAgentPackage
run(t, s)
Run(t, s)
}

type testUpgradeSuite struct {
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestUpgradeFromLatest(t *testing.T) {
upgradeAgentPackge, err := windowsAgent.GetUpgradeTestPackageFromEnv()
require.NoError(t, err, "should get last stable agent package from env")
s.upgradeAgentPackge = upgradeAgentPackge
run(t, s)
Run(t, s)
}

type testUpgradeFromLatestSuite struct {
Expand Down Expand Up @@ -140,7 +140,7 @@ func (s *testUpgradeFromLatestSuite) TestUpgradeFromLatest() {

func TestUpgradeRollback(t *testing.T) {
s := &testUpgradeRollbackSuite{}
run(t, s)
Run(t, s)
}

type testUpgradeRollbackSuite struct {
Expand Down Expand Up @@ -186,7 +186,7 @@ func (s *testUpgradeRollbackSuite) TestUpgradeRollback() {
// rolls back, that the ddprocmon service is not installed.
func TestUpgradeRollbackWithoutCWS(t *testing.T) {
s := &testUpgradeRollbackWithoutCWSSuite{}
run(t, s)
Run(t, s)
}

type testUpgradeRollbackWithoutCWSSuite struct {
Expand Down Expand Up @@ -259,7 +259,7 @@ func (s *testUpgradeRollbackWithoutCWSSuite) TestUpgradeRollbackWithoutCWS() {

func TestUpgradeChangeUser(t *testing.T) {
s := &testUpgradeChangeUserSuite{}
run(t, s)
Run(t, s)
}

type testUpgradeChangeUserSuite struct {
Expand Down Expand Up @@ -349,7 +349,7 @@ func TestUpgradeFromV5(t *testing.T) {
}
s.agent5Package.URL, err = windowsAgent.GetStableMSIURL(s.agent5Package.Version, "x86_64", "")
require.NoError(t, err)
run(t, s)
Run(t, s)
}

type testUpgradeFromV5Suite struct {
Expand Down Expand Up @@ -442,5 +442,5 @@ func TestUpgradeFromV6(t *testing.T) {
}
s.previousAgentPackge.URL, err = windowsAgent.GetStableMSIURL(s.previousAgentPackge.Version, s.previousAgentPackge.Arch, "")
require.NoError(t, err)
run(t, s)
Run(t, s)
}
Loading