Documentation
¶
Overview ¶
Package client contains clients used to communicate with the remote service
Index ¶
- func CallStackInitializers[Env any](t *testing.T, env *Env, upResult auto.UpResult) error
- func CheckEnvStructValid[Env any]() error
- type Agent
- type AgentArgsOption
- type AgentClient
- func (agent AgentClient) Config(commandArgs ...AgentArgsOption) string
- func (agent AgentClient) ConfigCheck(commandArgs ...AgentArgsOption) string
- func (agent AgentClient) ConfigWithError(commandArgs ...AgentArgsOption) (string, error)
- func (agent AgentClient) Diagnose(commandArgs ...AgentArgsOption) string
- func (agent AgentClient) Flare(commandArgs ...AgentArgsOption) string
- func (agent AgentClient) Health() (string, error)
- func (agent AgentClient) Hostname(commandArgs ...AgentArgsOption) string
- func (agent AgentClient) Integration(commandArgs ...AgentArgsOption) string
- func (agent AgentClient) IntegrationWithError(commandArgs ...AgentArgsOption) (string, error)
- func (agent AgentClient) IsReady() bool
- func (agent AgentClient) Secret(commandArgs ...AgentArgsOption) string
- func (agent AgentClient) Status(commandArgs ...AgentArgsOption) *Status
- func (agent AgentClient) StatusWithError(commandArgs ...AgentArgsOption) (*Status, error)
- func (agent AgentClient) Version(commandArgs ...AgentArgsOption) string
- type Docker
- func (docker *Docker) ExecuteCommand(containerName string, commands ...string) string
- func (docker *Docker) ExecuteCommandStdoutStdErr(containerName string, commands ...string) (string, string, error)
- func (docker *Docker) ExecuteCommandWithErr(containerName string, commands ...string) (string, error)
- func (docker *Docker) GetAgent() Agent
- func (docker *Docker) GetAgentContainerName() string
- func (docker *Docker) GetClient() *client.Client
- type EC2Metadata
- type Fakeintake
- type PulumiStackAgent
- type PulumiStackVM
- type Status
- type VM
- type VMClient
- func (vmClient *VMClient) CopyFile(src string, dst string)
- func (vmClient *VMClient) CopyFolder(srcFolder string, dstFolder string)
- func (vmClient *VMClient) Execute(command string, options ...executeparams.Option) string
- func (vmClient *VMClient) ExecuteWithError(command string, options ...executeparams.Option) (string, error)
- func (vmClient *VMClient) FileExists(path string) (bool, error)
- func (vmClient *VMClient) GetFile(src string, dst string) error
- func (vmClient *VMClient) GetOSType() componentos.Type
- func (vmClient *VMClient) Lstat(path string) (fs.FileInfo, error)
- func (vmClient *VMClient) MkdirAll(path string) error
- func (vmClient *VMClient) ReadDir(path string) ([]fs.DirEntry, error)
- func (vmClient *VMClient) ReadFile(path string) ([]byte, error)
- func (vmClient *VMClient) ReconnectSSH() error
- func (vmClient *VMClient) Remove(path string) error
- func (vmClient *VMClient) RemoveAll(path string) error
- func (vmClient *VMClient) WriteFile(path string, content []byte) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallStackInitializers ¶
CallStackInitializers validates an environment struct and initialise a stack. If a field of Env implements [pulumiStackInitializer], then [initFromPulumiStack] is called for this field.
func CheckEnvStructValid ¶
CheckEnvStructValid validates an environment struct
Types ¶
type Agent ¶
type Agent interface { // Version runs version command returns the runtime Agent version Version(commandArgs ...AgentArgsOption) string // Hostname runs hostname command and returns the runtime Agent hostname Hostname(commandArgs ...AgentArgsOption) string // Config runs config command and returns the runtime agent config Config(commandArgs ...AgentArgsOption) string // ConfigWithError runs config command and returns the runtime agent config or an error ConfigWithError(commandArgs ...AgentArgsOption) (string, error) // Diagnose runs diagnose command and returns its output Diagnose(commandArgs ...AgentArgsOption) string // Flare runs flare command and returns the output. You should use the FakeIntake client to fetch the flare archive Flare(commandArgs ...AgentArgsOption) string // Health runs health command and returns the runtime agent health Health() (string, error) // ConfigCheck runs configcheck command and returns the runtime agent configcheck ConfigCheck(commandArgs ...AgentArgsOption) string // Integration run integration command and returns the output Integration(commandArgs ...AgentArgsOption) string // IntegrationWithError run integration command and returns the output IntegrationWithError(commandArgs ...AgentArgsOption) (string, error) // Secret runs the secret command Secret(commandArgs ...AgentArgsOption) string // IsReady runs status command and returns true if the command returns a zero exit code. // This function should rarely be used. IsReady() bool // Status runs status command and returns a Status struct Status(commandArgs ...AgentArgsOption) *Status // StatusWithError runs status command and returns a Status struct and error StatusWithError(commandArgs ...AgentArgsOption) (*Status, error) // contains filtered or unexported methods }
Agent is an interface to run Agent command.
type AgentArgsOption ¶
type AgentArgsOption = func(*agentArgs)
AgentArgsOption is an optional function parameter type for Agent arguments
type AgentClient ¶ added in v0.50.0
type AgentClient struct {
// contains filtered or unexported fields
}
AgentClient is a type that provides methods to run remote commands on a test-infra-definition Agent.
func NewAgentClient ¶ added in v0.50.0
NewAgentClient creates a new instance of AgentClient
func (AgentClient) Config ¶ added in v0.50.0
func (agent AgentClient) Config(commandArgs ...AgentArgsOption) string
Config runs config command and returns the runtime agent config
func (AgentClient) ConfigCheck ¶ added in v0.50.0
func (agent AgentClient) ConfigCheck(commandArgs ...AgentArgsOption) string
ConfigCheck runs configcheck command and returns the runtime agent configcheck
func (AgentClient) ConfigWithError ¶ added in v0.50.0
func (agent AgentClient) ConfigWithError(commandArgs ...AgentArgsOption) (string, error)
ConfigWithError runs config command and returns the runtime agent config or an error
func (AgentClient) Diagnose ¶
func (agent AgentClient) Diagnose(commandArgs ...AgentArgsOption) string
Diagnose runs diagnose command and returns its output
func (AgentClient) Flare ¶ added in v0.50.0
func (agent AgentClient) Flare(commandArgs ...AgentArgsOption) string
Flare runs flare command and returns the output. You should use the FakeIntake client to fetch the flare archive
func (AgentClient) Health ¶ added in v0.50.0
Health runs health command and returns the runtime agent health
func (AgentClient) Hostname ¶ added in v0.50.0
func (agent AgentClient) Hostname(commandArgs ...AgentArgsOption) string
Hostname runs hostname command and returns the runtime Agent hostname
func (AgentClient) Integration ¶ added in v0.50.0
func (agent AgentClient) Integration(commandArgs ...AgentArgsOption) string
Integration run integration command and returns the output
func (AgentClient) IntegrationWithError ¶ added in v0.50.0
func (agent AgentClient) IntegrationWithError(commandArgs ...AgentArgsOption) (string, error)
IntegrationWithError run integration command and returns the output
func (AgentClient) IsReady ¶ added in v0.50.0
func (agent AgentClient) IsReady() bool
IsReady runs status command and returns true if the command returns a zero exit code. This function should rarely be used.
func (AgentClient) Secret ¶ added in v0.50.0
func (agent AgentClient) Secret(commandArgs ...AgentArgsOption) string
Secret runs the secret command
func (AgentClient) Status ¶ added in v0.50.0
func (agent AgentClient) Status(commandArgs ...AgentArgsOption) *Status
Status runs status command and returns a Status struct
func (AgentClient) StatusWithError ¶ added in v0.50.0
func (agent AgentClient) StatusWithError(commandArgs ...AgentArgsOption) (*Status, error)
StatusWithError runs status command and returns a Status struct and error
func (AgentClient) Version ¶ added in v0.50.0
func (agent AgentClient) Version(commandArgs ...AgentArgsOption) string
Version runs version command returns the runtime Agent version
type Docker ¶
type Docker struct {
// contains filtered or unexported fields
}
A Docker client that is connected to an docker.Deamon.
func (*Docker) ExecuteCommand ¶
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) GetAgent ¶ added in v0.50.0
GetAgent gets an instance that implements the Agent interface. This function panics, if there is no agent container.
func (*Docker) GetAgentContainerName ¶
GetAgentContainerName gets the agent container name
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 ¶
type Fakeintake struct { *fakeintake.Client // contains filtered or unexported fields }
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 PulumiStackAgent ¶ added in v0.50.0
type PulumiStackAgent struct { Agent // contains filtered or unexported fields }
PulumiStackAgent is a type that implements Agent and uses the pulumi stack filled by agent.Installer to setup the connection with the Agent.
func NewPulumiStackAgent ¶ added in v0.50.0
func NewPulumiStackAgent(installer *agent.Installer, agentClientOptions ...agentclientparams.Option) *PulumiStackAgent
NewPulumiStackAgent creates a new instance of an Agent connected to an agent.Installer.
type PulumiStackVM ¶ added in v0.50.0
type PulumiStackVM struct { VM // contains filtered or unexported fields }
PulumiStackVM is a type that implements VM and uses the pulumi stack filled by component.VM to setup the connection with the VM.
func NewPulumiStackVM ¶ added in v0.50.0
func NewPulumiStackVM(infraVM commonvm.VM) *PulumiStackVM
NewPulumiStackVM creates a new instance of PulumiStackVM
func (*PulumiStackVM) GetOS ¶ added in v0.50.0
func (vm *PulumiStackVM) GetOS() commonos.OS
GetOS is a temporary method while NewVMClient and AgentNewClient require an instance of OS.
type VM ¶
type VM interface { // ExecuteWithError executes a command and returns an error if any. ExecuteWithError(command string, options ...executeparams.Option) (string, error) // Execute executes a command and returns its output. Execute(command string, options ...executeparams.Option) string // CopyFile copy file to the remote host CopyFile(src string, dst string) // CopyFolder copy a folder to the remote host CopyFolder(srcFolder string, dstFolder string) // GetOSType returns the OS type of the VM. GetOSType() componentos.Type // GetFile copy file from the remote host GetFile(src string, dst string) error // FileExists returns true if the file exists and is a regular file and returns an error if any FileExists(path string) (bool, error) // ReadFile reads the content of the file, return bytes read and error if any ReadFile(path string) ([]byte, error) // WriteFile write content to the file and returns the number of bytes written and error if any WriteFile(path string, content []byte) (int64, error) // ReadDir returns list of directory entries in path ReadDir(path string) ([]fs.DirEntry, error) // Lstat returns a FileInfo structure describing path. // if path is a symbolic link, the FileInfo structure describes the symbolic link. Lstat(path string) (fs.FileInfo, error) // MkdirAll creates the specified directory along with any necessary parents. // If the path is already a directory, does nothing and returns nil. // Otherwise returns an error if any. MkdirAll(path string) error // Remove removes the specified file or directory. // Returns an error if file or directory does not exist, or if the directory is not empty. Remove(path string) error // RemoveAll recursively removes all files/folders in the specified directory. // Returns an error if the directory does not exist. RemoveAll(path string) error // ReconnectSSH recreate the SSH connection to the VM. Should be used only after VM reboot to restore the SSH connection. // Returns an error if the VM is not reachable after retries. ReconnectSSH() error }
VM is an interface that provides methods to run commands on a virtual machine.
type VMClient ¶ added in v0.50.0
type VMClient struct {
// contains filtered or unexported fields
}
VMClient is a type that implements VM interface to interact with a remote VM.
func NewVMClient ¶ added in v0.50.0
func NewVMClient(t *testing.T, connection *utils.Connection, osType componentos.Type) (*VMClient, error)
NewVMClient creates a new instance of VMClient.
func (*VMClient) CopyFolder ¶ added in v0.50.0
CopyFolder copy a folder to the remote host
func (*VMClient) Execute ¶ added in v0.50.0
func (vmClient *VMClient) Execute(command string, options ...executeparams.Option) string
Execute executes a command and returns its output.
func (*VMClient) ExecuteWithError ¶ added in v0.50.0
func (vmClient *VMClient) ExecuteWithError(command string, options ...executeparams.Option) (string, error)
ExecuteWithError executes a command and returns an error if any.
func (*VMClient) FileExists ¶
FileExists returns true if the file exists and is a regular file and returns an error if any
func (*VMClient) GetOSType ¶
func (vmClient *VMClient) GetOSType() componentos.Type
GetOSType returns the operating system type of the VMClient instance.
func (*VMClient) Lstat ¶
Lstat returns a FileInfo structure describing path. if path is a symbolic link, the FileInfo structure describes the symbolic link.
func (*VMClient) MkdirAll ¶
MkdirAll creates the specified directory along with any necessary parents. If the path is already a directory, does nothing and returns nil. Otherwise returns an error if any.
func (*VMClient) ReadFile ¶
ReadFile reads the content of the file, return bytes read and error if any
func (*VMClient) ReconnectSSH ¶
ReconnectSSH recreate the SSH connection to the VM. Should be used only after VM reboot to restore the SSH connection.
func (*VMClient) Remove ¶
Remove removes the specified file or directory. Returns an error if file or directory does not exist, or if the directory is not empty.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package agentclientparams implements function parameters for [e2e.Agent]
|
Package agentclientparams implements function parameters for [e2e.Agent] |
Package executeparams implements function parameters for [client.vmClient]
|
Package executeparams implements function parameters for [client.vmClient] |