Skip to content

Commit

Permalink
Fleet - tidy tests after bootstrap migration (#29670)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelgavache authored Oct 1, 2024
1 parent 86d8c29 commit 7082e7f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
8 changes: 5 additions & 3 deletions test/new-e2e/tests/installer/all_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
package installer

import (
"fmt"
"os"
"testing"
)

// InstallMethodOption is the type for the install method to use for the tests
Expand All @@ -24,7 +24,7 @@ const (
)

// GetInstallMethodFromEnv returns the install method to use for the tests
func GetInstallMethodFromEnv() InstallMethodOption {
func GetInstallMethodFromEnv(t *testing.T) InstallMethodOption {
supportedValues := []string{string(InstallMethodAnsible), string(InstallMethodInstallScript), string(InstallMethodWindows)}
envValue := os.Getenv("FLEET_INSTALL_METHOD")
switch envValue {
Expand All @@ -35,6 +35,8 @@ func GetInstallMethodFromEnv() InstallMethodOption {
case "windows":
return InstallMethodWindows
default:
panic(fmt.Sprintf("unsupported install method: %s. Supported values are: %v", envValue, supportedValues))
t.Logf("FLEET_INSTALL_METHOD is not set or has an unsupported value. Supported values are: %v", supportedValues)
t.Log("Using default install method: install_script")
return InstallMethodInstallScript
}
}
2 changes: 1 addition & 1 deletion test/new-e2e/tests/installer/all_packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestPackages(t *testing.T) {
t.FailNow()
}

method := GetInstallMethodFromEnv()
method := GetInstallMethodFromEnv(t)
if method == InstallMethodWindows {
t.Skip("Windows install method - skipping")
}
Expand Down
7 changes: 3 additions & 4 deletions test/new-e2e/tests/installer/package_installer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,22 @@ func (s *packageInstallerSuite) TestReInstall() {
}

func (s *packageInstallerSuite) TestUpdateInstallerOCI() {
s.T().Skip("Skipping this test until an installer is released with the setup method")
// Install prod
err := s.RunInstallScriptProdOci(
envForceVersion("datadog-installer", "7.55.0-installer-0.2.1-1"),
envForceVersion("datadog-installer", "7.58.0-installer-0.5.1-1"),
)
defer s.Purge()
assert.NoError(s.T(), err)

version := s.Env().RemoteHost.MustExecute("/opt/datadog-packages/datadog-installer/stable/bin/installer/installer version")
assert.Equal(s.T(), "7.55.0-installer-0.2.1\n", version)
assert.Equal(s.T(), "7.58.0-installer-0.5.1\n", version)

// Install from QA registry
err = s.RunInstallScriptWithError()
assert.NoError(s.T(), err)

version = s.Env().RemoteHost.MustExecute("/opt/datadog-packages/datadog-installer/stable/bin/installer/installer version")
assert.NotEqual(s.T(), "7.55.0-installer-0.2.1\n", version)
assert.NotEqual(s.T(), "7.58.0-installer-0.5.1\n", version)
}

func (s *packageInstallerSuite) TestInstallWithUmask() {
Expand Down
2 changes: 1 addition & 1 deletion test/new-e2e/tests/installer/windows/base_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *BaseInstallerSuite) StableAgentVersion() PackageVersion {
func (s *BaseInstallerSuite) SetupSuite() {
s.BaseSuite.SetupSuite()

if instlr.GetInstallMethodFromEnv() != instlr.InstallMethodWindows {
if instlr.GetInstallMethodFromEnv(s.T()) != instlr.InstallMethodWindows {
s.T().Skip("Skipping Windows-only tests as the install method isn't Windows")
}

Expand Down

0 comments on commit 7082e7f

Please sign in to comment.