Documentation ¶
Overview ¶
Package client contains the definitions of the different clients that can be used in a test.
Index ¶
- func NewDockerAgentClient(context e2e.Context, dockerAgentOutput agent.DockerAgentOutput, ...) (agentclient.Agent, error)
- func NewHostAgentClient(context e2e.Context, hostOutput remote.HostOutput, waitForAgentReady bool) (agentclient.Agent, error)
- func NewHostAgentClientWithParams(context e2e.Context, hostOutput remote.HostOutput, ...) (agentclient.Agent, error)
- 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) GetClient() *client.Client
- type EC2Metadata
- type EnvVar
- type ExecuteOption
- type ExecuteParams
- type Host
- func (h *Host) AppendFile(os, path string, content []byte) (int64, error)
- func (h *Host) CopyFile(src string, dst string)
- func (h *Host) CopyFolder(srcFolder string, dstFolder string) error
- func (h *Host) DialPort(port uint16) (net.Conn, error)
- func (h *Host) Execute(command string, options ...ExecuteOption) (string, error)
- func (h *Host) FileExists(path string) (bool, error)
- func (h *Host) GetFile(src string, dst string) error
- func (h *Host) Lstat(path string) (fs.FileInfo, error)
- func (h *Host) MkdirAll(path string) error
- func (h *Host) MustExecute(command string, options ...ExecuteOption) string
- func (h *Host) ReadDir(path string) ([]fs.DirEntry, error)
- func (h *Host) ReadFile(path string) ([]byte, error)
- func (h *Host) Reconnect() error
- func (h *Host) Remove(path string) error
- func (h *Host) RemoveAll(path string) error
- func (h *Host) WriteFile(path string, content []byte) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDockerAgentClient ¶ added in v0.51.0
func NewDockerAgentClient(context e2e.Context, dockerAgentOutput agent.DockerAgentOutput, options ...agentclientparams.Option) (agentclient.Agent, error)
NewDockerAgentClient creates an Agent client for a Docker install
func NewHostAgentClient ¶ added in v0.51.0
func NewHostAgentClient(context e2e.Context, hostOutput remote.HostOutput, waitForAgentReady bool) (agentclient.Agent, error)
NewHostAgentClient creates an Agent client for host install
func NewHostAgentClientWithParams ¶ added in v0.54.0
func NewHostAgentClientWithParams(context e2e.Context, hostOutput remote.HostOutput, options ...agentclientparams.Option) (agentclient.Agent, error)
NewHostAgentClientWithParams creates an Agent client for host install with custom parameters
Types ¶
type Docker ¶
type Docker struct {
// contains filtered or unexported fields
}
A Docker client that is connected to an docker.Deamon.
func NewDocker ¶
NewDocker creates a new instance of Docker NOTE: docker+ssh does not support password protected SSH keys.
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.
type EC2Metadata ¶
type EC2Metadata struct {
// contains filtered or unexported fields
}
EC2Metadata contains a pointer to a VM and its AWS token
func NewEC2Metadata ¶
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 ExecuteOption ¶ added in v0.55.0
type ExecuteOption func(*ExecuteParams) error
ExecuteOption alias to a functional option changing a given Params instance
func WithEnvVariables ¶ added in v0.55.0
func WithEnvVariables(env EnvVar) ExecuteOption
WithEnvVariables allows to set env variable for the command that will be executed
type ExecuteParams ¶ added in v0.55.0
type ExecuteParams struct {
EnvVariables EnvVar
}
ExecuteParams contains parameters for VM.Execute commands
type Host ¶ added in v0.55.0
type Host struct {
// contains filtered or unexported fields
}
A Host client that is connected to an ssh.Client.
func NewHost ¶ added in v0.55.0
NewHost creates a new ssh client to connect to a remote host with reconnect retry logic
func (*Host) AppendFile ¶ added in v0.55.0
AppendFile append content to the file and returns the number of bytes appened and error if any
func (*Host) CopyFile ¶ added in v0.55.0
CopyFile create a sftp session and copy a single file to the remote host through SSH
func (*Host) CopyFolder ¶ added in v0.55.0
CopyFolder create a sftp session and copy a folder to remote host through SSH
func (*Host) DialPort ¶ added in v0.55.0
DialPort creates a connection from the remote host to its `port`.
func (*Host) Execute ¶ added in v0.55.0
func (h *Host) Execute(command string, options ...ExecuteOption) (string, error)
Execute executes a command and returns an error if any.
func (*Host) FileExists ¶ added in v0.55.0
FileExists create a sftp session to and returns true if the file exists and is a regular file
func (*Host) GetFile ¶ added in v0.55.0
GetFile create a sftp session and copy a single file from the remote host through SSH
func (*Host) Lstat ¶ added in v0.55.0
Lstat returns a FileInfo structure describing path. if path is a symbolic link, the FileInfo structure describes the symbolic link.
func (*Host) MkdirAll ¶ added in v0.55.0
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 (*Host) MustExecute ¶ added in v0.55.0
func (h *Host) MustExecute(command string, options ...ExecuteOption) string
MustExecute executes a command and requires no error.
func (*Host) ReadFile ¶ added in v0.55.0
ReadFile reads the content of the file, return bytes read and error if any
func (*Host) Reconnect ¶ added in v0.55.0
Reconnect closes the current ssh client and creates a new one, with retries.
func (*Host) Remove ¶ added in v0.55.0
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 agentclient provides an interface to run Agent commands.
|
Package agentclient provides an interface to run Agent commands. |
Package agentclientparams implements function parameters for [e2e.Agent]
|
Package agentclientparams implements function parameters for [e2e.Agent] |