Documentation ¶
Overview ¶
Package installer contains code for the E2E tests for the Datadog installer on Windows
Index ¶
- Constants
- Variables
- func GetExperimentDirFor(packageName string) string
- func GetStableDirFor(packageName string) string
- type BaseInstallerSuite
- func (s *BaseInstallerSuite) BeforeTest(suiteName, testName string)
- func (s *BaseInstallerSuite) CurrentAgentVersion() *agentVersion.Version
- func (s *BaseInstallerSuite) Installer() *DatadogInstaller
- func (s *BaseInstallerSuite) OutputDir() string
- func (s *BaseInstallerSuite) Require() *suiteasserts.SuiteAssertions
- func (s *BaseInstallerSuite) SetupSuite()
- func (s *BaseInstallerSuite) StableAgentVersion() PackageVersion
- func (s *BaseInstallerSuite) StableInstallerVersion() PackageVersion
- type DatadogInstaller
- func (d *DatadogInstaller) Install(opts ...Option) error
- func (d *DatadogInstaller) InstallExperiment(packageName string, opts ...installer.PackageOption) (string, error)
- func (d *DatadogInstaller) InstallPackage(packageName string, opts ...installer.PackageOption) (string, error)
- func (d *DatadogInstaller) Purge() (string, error)
- func (d *DatadogInstaller) RemoveExperiment(packageName string) (string, error)
- func (d *DatadogInstaller) RemovePackage(packageName string) (string, error)
- func (d *DatadogInstaller) RunInstallScript(extraEnvVars map[string]string) (string, error)
- func (d *DatadogInstaller) Status() (string, error)
- func (d *DatadogInstaller) Uninstall(opts ...Option) error
- func (d *DatadogInstaller) Version() (string, error)
- type Option
- type PackageVersion
- type Params
Constants ¶
const ( // AgentPackage is the name of the Datadog Agent package // We use a constant to make it easier for calling code, because depending on the context // the Agent package can be referred to as "agent-package" (like in the OCI registry) or "datadog-agent" (in the // local database once the Agent is installed). AgentPackage string = "datadog-agent" // Path is the path where the Datadog Installer is installed on disk Path string = "C:\\Program Files\\Datadog\\Datadog Installer" // BinaryName is the name of the Datadog Installer binary on disk BinaryName string = "datadog-installer.exe" // ServiceName the installer service name ServiceName string = "Datadog Installer" // ConfigPath is the location of the Datadog Installer's configuration on disk ConfigPath string = "C:\\ProgramData\\Datadog\\datadog.yaml" // RegistryKeyPath is the root registry key that the Datadog Installer uses to store some state RegistryKeyPath string = `HKLM:\SOFTWARE\Datadog\Datadog Installer` // NamedPipe is the name of the named pipe used by the Datadog Installer NamedPipe string = `\\.\pipe\dd_installer` )
Variables ¶
var ( // BinaryPath is the path of the Datadog Installer binary on disk BinaryPath = path.Join(Path, BinaryName) )
Functions ¶
func GetExperimentDirFor ¶
GetExperimentDirFor is the path to the experiment symbolic link on disk
func GetStableDirFor ¶
GetStableDirFor is the path to the stable symbolic link on disk
Types ¶
type BaseInstallerSuite ¶
type BaseInstallerSuite struct { e2e.BaseSuite[environments.WindowsHost] // contains filtered or unexported fields }
BaseInstallerSuite the base suite for all installer tests on Windows. To run the test suites locally, pick a pipeline and define the following environment variables: E2E_PIPELINE_ID: the ID of the pipeline CURRENT_AGENT_VERSION: pull it from one of the jobs that builds the Agent STABLE_INSTALLER_VERSION_PACKAGE: use `crane ls public.ecr.aws/datadog/installer-package | sort | tail -n 2 | head -n 1` STABLE_AGENT_VERSION_PACKAGE: use `crane ls public.ecr.aws/datadog/agent-package | sort | tail -n 2 | head -n 1` or pick any other version from that registry.
For example:
E2E_PIPELINE_ID=40537701; CURRENT_AGENT_VERSION=7.57.0-devel+git.370.d429ae3; STABLE_INSTALLER_VERSION_PACKAGE=7.56.0-installer-0.4.6-1-1 STABLE_AGENT_VERSION_PACKAGE=7.55.2-1
func (*BaseInstallerSuite) BeforeTest ¶
func (s *BaseInstallerSuite) BeforeTest(suiteName, testName string)
BeforeTest creates a new Datadog Installer and sets the output logs directory for each tests
func (*BaseInstallerSuite) CurrentAgentVersion ¶
func (s *BaseInstallerSuite) CurrentAgentVersion() *agentVersion.Version
CurrentAgentVersion the version of the Agent in the current pipeline
func (*BaseInstallerSuite) Installer ¶
func (s *BaseInstallerSuite) Installer() *DatadogInstaller
Installer the Datadog Installer for testing.
func (*BaseInstallerSuite) OutputDir ¶ added in v0.59.0
func (s *BaseInstallerSuite) OutputDir() string
OutputDir returns the output directory for the test
func (*BaseInstallerSuite) Require ¶
func (s *BaseInstallerSuite) Require() *suiteasserts.SuiteAssertions
Require instantiates a suiteAssertions for the current suite. This allows writing assertions in a "natural" way, i.e.:
suite.Require().HasAService(...).WithUserSid(...)
Ideally this suite assertion would exist at a higher level of abstraction so that it could be shared by multiple suites, but for now it exists only on the Windows Datadog installer `BaseInstallerSuite` object.
func (*BaseInstallerSuite) SetupSuite ¶
func (s *BaseInstallerSuite) SetupSuite()
SetupSuite checks that the environment variables are correctly setup for the test
func (*BaseInstallerSuite) StableAgentVersion ¶
func (s *BaseInstallerSuite) StableAgentVersion() PackageVersion
StableAgentVersion the version of the last published stable agent
func (*BaseInstallerSuite) StableInstallerVersion ¶
func (s *BaseInstallerSuite) StableInstallerVersion() PackageVersion
StableInstallerVersion the version of the last published stable installer
type DatadogInstaller ¶
type DatadogInstaller struct {
// contains filtered or unexported fields
}
DatadogInstaller represents an interface to the Datadog Installer on the remote host.
func NewDatadogInstaller ¶
func NewDatadogInstaller(env *environments.WindowsHost, outputDir string) *DatadogInstaller
NewDatadogInstaller instantiates a new instance of the Datadog Installer running on a remote Windows host.
func (*DatadogInstaller) Install ¶
func (d *DatadogInstaller) Install(opts ...Option) error
Install will attempt to install the Datadog Installer on the remote host. By default, it will use the installer from the current pipeline.
func (*DatadogInstaller) InstallExperiment ¶
func (d *DatadogInstaller) InstallExperiment(packageName string, opts ...installer.PackageOption) (string, error)
InstallExperiment will attempt to use the Datadog Installer to start an experiment for the package given in parameter.
func (*DatadogInstaller) InstallPackage ¶
func (d *DatadogInstaller) InstallPackage(packageName string, opts ...installer.PackageOption) (string, error)
InstallPackage will attempt to use the Datadog Installer to install the package given in parameter. version: A function that returns the version of the package to install. By default, it will install the package matching the current pipeline. This is a function so that it can be combined with Note that this command is a direct command and won't go through the Daemon.
func (*DatadogInstaller) Purge ¶
func (d *DatadogInstaller) Purge() (string, error)
Purge runs the purge command, removing all packages
func (*DatadogInstaller) RemoveExperiment ¶
func (d *DatadogInstaller) RemoveExperiment(packageName string) (string, error)
RemoveExperiment requests that the Datadog Installer removes a package on the remote host.
func (*DatadogInstaller) RemovePackage ¶
func (d *DatadogInstaller) RemovePackage(packageName string) (string, error)
RemovePackage requests that the Datadog Installer removes a package on the remote host.
func (*DatadogInstaller) RunInstallScript ¶
func (d *DatadogInstaller) RunInstallScript(extraEnvVars map[string]string) (string, error)
RunInstallScript runs the Datadog Installer install script on the remote host.
func (*DatadogInstaller) Status ¶
func (d *DatadogInstaller) Status() (string, error)
Status returns the status provided by the running daemon
func (*DatadogInstaller) Uninstall ¶
func (d *DatadogInstaller) Uninstall(opts ...Option) error
Uninstall will attempt to uninstall the Datadog Installer on the remote host.
func (*DatadogInstaller) Version ¶
func (d *DatadogInstaller) Version() (string, error)
Version returns the version of the Datadog Installer on the host.
type Option ¶
Option is an optional function parameter type for the Datadog Installer Install command
func WithInstallerURL ¶
WithInstallerURL uses a specific URL for the Datadog Installer Install command instead of using the pipeline URL.
func WithInstallerURLFromInstallersJSON ¶
WithInstallerURLFromInstallersJSON uses a specific URL for the Datadog Installer from an installers_v2.json file. jsonURL: The URL of the installers_v2.json file, i.e. pipeline.StableURL version: The artifact version to retrieve, i.e. "7.56.0-installer-0.4.5-1"
Example: WithInstallerURLFromInstallersJSON(pipeline.StableURL, "7.56.0-installer-0.4.5-1") will look into "https://s3.amazonaws.com/ddagent-windows-stable/stable/installers_v2.json" for the Datadog Installer version "7.56.0-installer-0.4.5-1"
func WithMSIArg ¶
WithMSIArg uses a specific URL for the Datadog Installer Install command instead of using the pipeline URL.
func WithMSILogFile ¶ added in v0.58.0
WithMSILogFile sets the filename for the MSI log file, to be stored in the output directory.
type PackageVersion ¶
type PackageVersion struct {
// contains filtered or unexported fields
}
PackageVersion is a helper type to store both the version and the package version of a binary. The package version has the "-1" suffix, whereas the binary's "version" command does not contain the "-1" suffix.
func (PackageVersion) PackageVersion ¶
func (v PackageVersion) PackageVersion() string
PackageVersion the version with the package suffix
func (PackageVersion) Version ¶
func (v PackageVersion) Version() string
Version the version without the package suffix
Directories ¶
Path | Synopsis |
---|---|
Package assertions provide custom assertions for Windows tests
|
Package assertions provide custom assertions for Windows tests |
Package suiteasserts extends require.Assertions with custom assertions
|
Package suiteasserts extends require.Assertions with custom assertions |
suites
|
|