Documentation
¶
Overview ¶
Package host contains host-level test helpers for fleet tests.
Index ¶
- Constants
- type FilePermissions
- type Host
- func (h *Host) AssertProcessNotLoaded(t *testing.T, name, installDir string)
- func (h *Host) AssertProcessNotRunning(t *testing.T, name, installDir string)
- func (h *Host) AssertProcessRunning(t *testing.T, name, installDir string)
- func (h *Host) AssertProcmgrTelemetry(t *testing.T, serviceID, processName string)
- func (h *Host) AssertSystemdUnitNotActive(t *testing.T, units ...string)
- func (h *Host) AssertWindowsServiceNotRunning(t *testing.T, serviceName string)
- func (h *Host) DescribeProcess(name, installDir string) (info ProcmgrProcess, ok bool, err error)
- func (h *Host) DirExists(path string) (bool, error)
- func (h *Host) GetFilePermissions(filePath string) (*FilePermissions, error)
- func (h *Host) ProcmgrEnabled(installDir string) bool
- type ProcmgrProcess
Constants ¶
const ( LinuxStableInstallDir = "/opt/datadog-packages/datadog-agent/stable" LinuxExperimentInstallDir = "/opt/datadog-packages/datadog-agent/experiment" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilePermissions ¶
FilePermissions represents the permissions of a file on Unix systems.
type Host ¶
type Host struct {
*environments.Host
}
Host wraps an environments.Host with helper methods for fleet tests.
func (*Host) AssertProcessNotLoaded ¶ added in v0.84.0
AssertProcessNotLoaded fails the test unless dd-procmgrd no longer has name registered.
func (*Host) AssertProcessNotRunning ¶ added in v0.84.0
AssertProcessNotRunning fails the test unless dd-procmgrd reports name as not running. A process that is not registered at all also counts as not running: on Windows the DDOT processes.d entry is deleted on extension removal, while on Linux that entry belongs to the agent package's static process set and stays registered, gated by condition_path_exists.
func (*Host) AssertProcessRunning ¶ added in v0.84.0
AssertProcessRunning fails the test unless dd-procmgrd reports name as stably Running.
func (*Host) AssertProcmgrTelemetry ¶ added in v0.84.0
AssertProcmgrTelemetry verifies the agent's COAT gauges report serviceID/processName as managed by dd-procmgrd. Linux only. Call AssertProcessRunning first so procmgr is reachable and the process is running.
func (*Host) AssertSystemdUnitNotActive ¶ added in v0.84.0
AssertSystemdUnitNotActive fails the test unless every given systemd unit is not active. Linux only.
func (*Host) AssertWindowsServiceNotRunning ¶ added in v0.84.0
AssertWindowsServiceNotRunning fails the test if the given Windows SCM service is Running. A service that doesn't exist counts as not running.
func (*Host) DescribeProcess ¶ added in v0.84.0
func (h *Host) DescribeProcess(name, installDir string) (info ProcmgrProcess, ok bool, err error)
DescribeProcess returns the dd-procmgrd-reported state of a supervised process. ok is false if the process is not registered with dd-procmgrd (including when dd-procmgr itself isn't present).
func (*Host) DirExists ¶ added in v0.77.0
DirExists checks if a directory exists on the remote host. Returns true if the path exists and is a directory, false if it doesn't exist or isn't a directory. Only returns an error for actual failures (e.g., permission issues).
func (*Host) GetFilePermissions ¶
func (h *Host) GetFilePermissions(filePath string) (*FilePermissions, error)
GetFilePermissions returns the permissions of a file on Unix systems. Returns an error on Windows as POSIX permissions don't apply.
func (*Host) ProcmgrEnabled ¶ added in v0.84.0
ProcmgrEnabled reports whether dd-procmgr is the active service manager on the host, i.e. whether the dd-procmgr CLI is present under the current datadog-agent install. This is a presence check, not an opt-out check: hosts running an agent version or install method that predates procmgr correctly report false here.