client

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package client contains clients used to communicate with the remote service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallStackInitializers

func CallStackInitializers[Env any](t *testing.T, env *Env, upResult auto.UpResult) error

CallStackInitializers validate an environment struct and initialise a stack

func CheckEnvStructValid

func CheckEnvStructValid[Env any]() error

CheckEnvStructValid validates an environment struct

Types

type Agent

type Agent struct {
	*UpResultDeserializer[agent.ClientData]

	*AgentCommandRunner
	// contains filtered or unexported fields
}

An Agent that is connected to an agent.Installer.

func NewAgent

func NewAgent(installer *agent.Installer, agentClientOptions ...agentclientparams.Option) *Agent

NewAgent creates a new instance of an Agent connected to an agent.Installer.

func (*Agent) IsReady

func (a *Agent) IsReady() bool

IsReady runs status command and returns true if the command returns a zero exit code. This function should rarely be used.

func (*Agent) WaitAgentLogs

func (a *Agent) WaitAgentLogs(agentName string, pattern string) error

WaitAgentLogs waits for the agent log corresponding to the pattern agent-name can be: datadog-agent, system-probe, security-agent pattern: is the log that we are looking for Retries every 500 ms up to timeout. Returns error on failure.

type AgentArgsOption

type AgentArgsOption = func(*agentArgs)

AgentArgsOption is an optional function parameter type for Agent arguments

func WithArgs

func WithArgs(args []string) AgentArgsOption

WithArgs sets the Agent arguments

type AgentCommandRunner

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

AgentCommandRunner provides high level methods to run commands on the Agent.

func (*AgentCommandRunner) Config

func (agent *AgentCommandRunner) Config(commandArgs ...AgentArgsOption) string

Config runs config command and returns the runtime agent config

func (*AgentCommandRunner) ConfigCheck

func (agent *AgentCommandRunner) ConfigCheck(commandArgs ...AgentArgsOption) string

ConfigCheck runs configcheck command and returns the runtime agent configcheck

func (*AgentCommandRunner) Flare

func (agent *AgentCommandRunner) Flare(commandArgs ...AgentArgsOption) string

Flare runs flare command and returns the output. You should use the FakeIntake client to fetch the flare archive

func (*AgentCommandRunner) Health

func (agent *AgentCommandRunner) Health() (string, error)

Health runs health command and returns the runtime agent health

func (*AgentCommandRunner) Hostname

func (agent *AgentCommandRunner) Hostname(commandArgs ...AgentArgsOption) string

Hostname runs hostname command and returns the runtime Agent hostname

func (*AgentCommandRunner) Secret

func (agent *AgentCommandRunner) Secret(commandArgs ...AgentArgsOption) string

Secret runs the secret command

func (*AgentCommandRunner) Status

func (agent *AgentCommandRunner) Status(commandArgs ...AgentArgsOption) *Status

Status runs status command and returns a Status struct

func (*AgentCommandRunner) Version

func (agent *AgentCommandRunner) Version(commandArgs ...AgentArgsOption) string

Version runs version command returns the runtime Agent version

type Docker

type Docker struct {
	*UpResultDeserializer[docker.ClientData]
	// contains filtered or unexported fields
}

A Docker client that is connected to an docker.Deamon.

func NewDocker

func NewDocker(daemon *docker.Daemon) *Docker

NewDocker creates a new instance of Docker

func (*Docker) ExecuteCommand

func (docker *Docker) ExecuteCommand(containerName string, commands ...string) string

ExecuteCommand executes a command on containerName and returns the output.

func (*Docker) ExecuteCommandStdoutStdErr

func (docker *Docker) ExecuteCommandStdoutStdErr(containerName string, commands ...string) (string, string, error)

ExecuteCommandStdoutStdErr executes a command on containerName and returns the output, the error output and an error.

func (*Docker) ExecuteCommandWithErr

func (docker *Docker) ExecuteCommandWithErr(containerName string, commands ...string) (string, error)

ExecuteCommandWithErr executes a command on containerName and returns the output and an error.

func (*Docker) GetAgentCommandRunner

func (docker *Docker) GetAgentCommandRunner() *AgentCommandRunner

GetAgentCommandRunner gets a runner that provides high level methods to run Agent commands.

func (*Docker) GetAgentContainerName

func (docker *Docker) GetAgentContainerName() string

GetAgentContainerName gets the agent container name

func (*Docker) GetClient

func (docker *Docker) GetClient() *client.Client

GetClient gets the docker client.

type EC2Metadata

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

EC2Metadata contains a pointer to a VM and its AWS token

func NewEC2Metadata

func NewEC2Metadata(vm *VM) *EC2Metadata

NewEC2Metadata creates a new EC2Metadata given an EC2 VM

func (*EC2Metadata) Get

func (m *EC2Metadata) Get(name string) string

Get returns EC2 instance name

type Fakeintake

A Fakeintake client that is connected to a fakeintake ECS task defined in test-infra-definition.

func NewFakeintake

func NewFakeintake(exporter *infraFakeintake.ConnectionExporter) *Fakeintake

NewFakeintake creates a new instance of

type Status

type Status struct {
	Content string
}

Status contains the Agent status content

type UpResultDeserializer

type UpResultDeserializer[T any] struct {
	// contains filtered or unexported fields
}

UpResultDeserializer is an helper to build a new type that can be used in an environment. It is designed to be used as an embedded field. See VM type in this package for an example of usage.

func NewUpResultDeserializer

func NewUpResultDeserializer[T any](
	deserializer utils.RemoteServiceDeserializer[T],
	initializer clientServiceInitializer[T]) *UpResultDeserializer[T]

NewUpResultDeserializer creates a new instance of UpResultDeserializer. deserializer is a function that deserializes the output of a stack init is a function that initializes the parent struct.

type VM

type VM struct {
	*UpResultDeserializer[commonvm.ClientData]
	// contains filtered or unexported fields
}

VM is a client VM that is connected to a VM defined in test-infra-definition.

func NewVM

func NewVM(infraVM commonvm.VM) *VM

NewVM creates a new instance of VM

func (VM) CopyFile

func (vmClient VM) CopyFile(src string, dst string)

CopyFile copy file to the remote host

func (VM) CopyFolder

func (vmClient VM) CopyFolder(srcFolder string, dstFolder string)

CopyFolder copy a folder to the remote host

func (VM) Execute

func (vmClient VM) Execute(command string) string

Execute executes a command and returns its output.

func (VM) ExecuteWithError

func (vmClient VM) ExecuteWithError(command string) (string, error)

ExecuteWithError executes a command and returns an error if any.

Directories

Path Synopsis
Package agentclientparams implements function parameters for [e2e.Agent]
Package agentclientparams implements function parameters for [e2e.Agent]

Jump to

Keyboard shortcuts

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