host

package
v0.84.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package host contains host-level test helpers for fleet tests.

Index

Constants

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

type FilePermissions struct {
	Mode  string
	Owner string
	Group string
}

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 New

func New(host *environments.Host) *Host

New creates a new Host wrapper.

func (*Host) AssertProcessNotLoaded added in v0.84.0

func (h *Host) AssertProcessNotLoaded(t *testing.T, name, installDir string)

AssertProcessNotLoaded fails the test unless dd-procmgrd no longer has name registered.

func (*Host) AssertProcessNotRunning added in v0.84.0

func (h *Host) AssertProcessNotRunning(t *testing.T, name, installDir string)

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

func (h *Host) AssertProcessRunning(t *testing.T, name, installDir string)

AssertProcessRunning fails the test unless dd-procmgrd reports name as stably Running.

func (*Host) AssertProcmgrTelemetry added in v0.84.0

func (h *Host) AssertProcmgrTelemetry(t *testing.T, serviceID, processName string)

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

func (h *Host) AssertSystemdUnitNotActive(t *testing.T, units ...string)

AssertSystemdUnitNotActive fails the test unless every given systemd unit is not active. Linux only.

func (*Host) AssertWindowsServiceNotRunning added in v0.84.0

func (h *Host) AssertWindowsServiceNotRunning(t *testing.T, serviceName string)

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

func (h *Host) DirExists(path string) (bool, error)

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

func (h *Host) ProcmgrEnabled(installDir string) bool

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.

type ProcmgrProcess added in v0.84.0

type ProcmgrProcess struct {
	Name         string
	UUID         string
	State        string
	PID          int
	Command      string
	Args         []string
	RestartCount int
	AutoStart    bool
}

ProcmgrProcess is the state of a single process supervised by dd-procmgrd, as reported by `dd-procmgr describe --json`.

Jump to

Keyboard shortcuts

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