common

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package common contains basic test operation for agent-platform tests

Index

Constants

View Source
const (
	// ExpectedPythonVersion2 is the expected python 2 version
	// Bump this version when the version in omnibus/config/software/python2.rb changes
	ExpectedPythonVersion2 = "2.7.18"
	// ExpectedPythonVersion3 is the expected python 3 version
	// Bump this version when the version in omnibus/config/software/python3.rb changes
	ExpectedPythonVersion3 = "3.12.6"
)

Variables

This section is empty.

Functions

func AgentProcessIsRunning added in v0.52.0

func AgentProcessIsRunning(client *TestClient, processName string) bool

AgentProcessIsRunning returns true if the agent process is running

func AssertPortBoundByService added in v0.52.0

func AssertPortBoundByService(t assert.TestingT, client *TestClient, port int, service string) (boundport.BoundPort, bool)

AssertPortBoundByService accepts a port and a service name and returns true if the port is bound by the service

func CheckAgentBehaviour

func CheckAgentBehaviour(t *testing.T, client *TestClient)

CheckAgentBehaviour runs test to check the agent is behaving as expected

func CheckAgentPython

func CheckAgentPython(t *testing.T, client *TestClient, expectedVersion string)

CheckAgentPython runs tests to check the agent use the correct python version

func CheckAgentRestarts

func CheckAgentRestarts(t *testing.T, client *TestClient)

CheckAgentRestarts runs tests to check the agent can restart properly

func CheckAgentStops

func CheckAgentStops(t *testing.T, client *TestClient)

CheckAgentStops runs tests to check the agent can stop properly

func CheckApmDisabled

func CheckApmDisabled(t *testing.T, client *TestClient)

CheckApmDisabled runs tests to check the agent behave properly when APM is disabled

func CheckApmEnabled

func CheckApmEnabled(t *testing.T, client *TestClient)

CheckApmEnabled runs tests to check the agent behave properly with APM enabled

func CheckCWSBehaviour

func CheckCWSBehaviour(t *testing.T, client *TestClient)

CheckCWSBehaviour runs tests to check the agent behave correctly when CWS is enabled

func CheckDogstatdAgentBehaviour added in v0.51.0

func CheckDogstatdAgentBehaviour(t *testing.T, client *TestClient)

CheckDogstatdAgentBehaviour runs tests to check the agent behave properly with dogstatsd

func CheckDogstatsdAgentRestarts added in v0.51.0

func CheckDogstatsdAgentRestarts(t *testing.T, client *TestClient)

CheckDogstatsdAgentRestarts runs tests to check the agent can restart properly

func CheckDogstatsdAgentStops added in v0.51.0

func CheckDogstatsdAgentStops(t *testing.T, client *TestClient)

CheckDogstatsdAgentStops runs tests to check the agent can stop properly

func CheckInstallation

func CheckInstallation(t *testing.T, client *TestClient)

CheckInstallation run tests to check the installation of the agent

func CheckInstallationInstallScript

func CheckInstallationInstallScript(t *testing.T, client *TestClient)

CheckInstallationInstallScript run tests to check the installation of the agent with the install script

func CheckInstallationMajorAgentVersion added in v0.51.0

func CheckInstallationMajorAgentVersion(t *testing.T, client *TestClient, expectedVersion string) bool

CheckInstallationMajorAgentVersion run tests to check the installation of an agent has the correct major version

func CheckIntegrationInstall

func CheckIntegrationInstall(t *testing.T, client *TestClient)

CheckIntegrationInstall run test to test installation of integrations

func CheckSigningKeys added in v0.52.0

func CheckSigningKeys(t *testing.T, client *TestClient)

CheckSigningKeys ensures datadog-signing-keys package is installed

func CheckSystemProbeBehavior added in v0.56.0

func CheckSystemProbeBehavior(t *testing.T, client *TestClient)

CheckSystemProbeBehavior runs tests to check the agent behave correctly when system-probe is enabled

func CheckUninstallation

func CheckUninstallation(t *testing.T, client *TestClient)

CheckUninstallation runs check to see if the agent uninstall properly

func GetBoundPort added in v0.52.0

func GetBoundPort(host *components.RemoteHost, port int) (boundport.BoundPort, error)

GetBoundPort returns a port that is bound on the host, or nil if the port is not bound

func ReadJournalCtl added in v0.52.0

func ReadJournalCtl(t *testing.T, client *TestClient, grepPattern string) string

ReadJournalCtl returns the output of journalctl with an optional grep pattern

func RunningAgentProcesses added in v0.52.0

func RunningAgentProcesses(client *TestClient) ([]string, error)

RunningAgentProcesses returns the list of running agent processes

func SetAgentPythonMajorVersion added in v0.52.0

func SetAgentPythonMajorVersion(t *testing.T, client *TestClient, majorVersion string)

SetAgentPythonMajorVersion set the python major version in the agent config and restarts the agent

Types

type DockerTestClient added in v0.58.0

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

DockerTestClient is a helper to run commands on a docker container for tests

func NewDockerTestClient added in v0.58.0

func NewDockerTestClient(host *components.RemoteHost, containerName string) *DockerTestClient

NewDockerTestClient creates a client to help write tests that run on a docker container

func (*DockerTestClient) Cleanup added in v0.58.0

func (c *DockerTestClient) Cleanup() error

Cleanup force-removes the docker container associated to the client

func (*DockerTestClient) Execute added in v0.58.0

func (c *DockerTestClient) Execute(command string) (output string, err error)

Execute runs commands on a Docker remote host

func (*DockerTestClient) ExecuteWithRetry added in v0.58.0

func (c *DockerTestClient) ExecuteWithRetry(cmd string) (output string, err error)

ExecuteWithRetry execute the command with retry

func (*DockerTestClient) RunContainer added in v0.58.0

func (c *DockerTestClient) RunContainer(image string) error

RunContainer starts the docker container in the background based on the given image reference

type TestClient

type TestClient struct {
	Host        *components.RemoteHost
	AgentClient agentclient.Agent
	Helper      helpers.Helper
	FileManager filemanager.FileManager
	SvcManager  svcmanager.ServiceManager
	PkgManager  pkgmanager.PackageManager
}

TestClient contain the Agent Env and SvcManager and PkgManager for tests

func NewTestClient

func NewTestClient(host *components.RemoteHost, agentClient agentclient.Agent, fileManager filemanager.FileManager, helper helpers.Helper) *TestClient

NewTestClient create a an ExtendedClient from VMClient and AgentCommandRunner, includes svcManager and pkgManager to write agent-platform tests

func NewWindowsTestClient added in v0.52.0

func NewWindowsTestClient(context e2e.Context, host *components.RemoteHost) *TestClient

NewWindowsTestClient create a TestClient for Windows VM

func (*TestClient) CheckAgentVersion added in v0.53.0

func (client *TestClient) CheckAgentVersion(t *testing.T, expected string) bool

CheckAgentVersion run tests to check that the agent has the correct version

func (*TestClient) ExecuteWithRetry

func (c *TestClient) ExecuteWithRetry(cmd string) (string, error)

ExecuteWithRetry execute the command with retry

func (*TestClient) GetAgentVersion added in v0.52.0

func (c *TestClient) GetAgentVersion() (string, error)

GetAgentVersion returns agent version from the Agent status

func (*TestClient) GetJSONStatus added in v0.56.0

func (c *TestClient) GetJSONStatus() (map[string]any, error)

GetJSONStatus returns the status of the Agent in JSON format

func (*TestClient) GetPythonVersion

func (c *TestClient) GetPythonVersion() (string, error)

GetPythonVersion returns python version from the Agent status

func (*TestClient) SetConfig

func (c *TestClient) SetConfig(confPath string, key string, value string) error

SetConfig set config given a key and a path to a yaml config file, support key nested twice at most

Directories

Path Synopsis
Package boundport provides utilies for getting bound port information
Package boundport provides utilies for getting bound port information
Package filemanager implement interfaces to run install-script tests
Package filemanager implement interfaces to run install-script tests
Package helper implement interfaces to get some information that can be OS specific
Package helper implement interfaces to get some information that can be OS specific
Package pkgmanager contains pkgmanager implementations
Package pkgmanager contains pkgmanager implementations
Package process provides utilities for testing processes
Package process provides utilities for testing processes
Package svcmanager contains svcmanager implementations
Package svcmanager contains svcmanager implementations

Jump to

Keyboard shortcuts

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