installer

package
v0.57.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package installer contains code for the E2E tests for the Datadog installer on Windows

Index

Constants

View Source
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"
)

Variables

View Source
var (
	// BinaryPath is the path of the Datadog Installer binary on disk
	BinaryPath = path.Join(Path, BinaryName)
)

Functions

func GetExperimentDirFor

func GetExperimentDirFor(packageName string) string

GetExperimentDirFor is the path to the experiment symbolic link on disk

func GetStableDirFor

func GetStableDirFor(packageName string) string

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) 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, logPath 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) 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) Uninstall

func (d *DatadogInstaller) Uninstall() 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

type Option func(*Params) error

Option is an optional function parameter type for the Datadog Installer Install command

func WithInstallerURL

func WithInstallerURL(installerURL string) Option

WithInstallerURL uses a specific URL for the Datadog Installer Install command instead of using the pipeline URL.

func WithInstallerURLFromInstallersJSON

func WithInstallerURLFromInstallersJSON(bucket, channel, version string) Option

WithInstallerURLFromInstallersJSON uses a specific URL for the Datadog Installer from an installers_v2.json file. bucket: The S3 bucket to look for the installers_v2.json file, i.e. "dd-agent-mstesting" channel: The channel in the bucket, i.e. "stable" version: The artifact version to retrieve, i.e. "7.56.0-installer-0.4.5-1"

Example: WithInstallerURLFromInstallersJSON("dd-agent-mstesting", "stable", "7.56.0-installer-0.4.5-1") will look into "https://s3.amazonaws.com/dd-agent-mstesting/builds/stable/installers_v2.json" for the Datadog Installer version "7.56.0-installer-0.4.5-1"

func WithMSIArg

func WithMSIArg(arg string) Option

WithMSIArg uses a specific URL for the Datadog Installer Install command instead of using the pipeline URL.

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

type Params

type Params struct {
	// contains filtered or unexported fields
}

Params contains the optional parameters for the Datadog Installer Install command

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL