client

package
v0.61.0-devel Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Overview

Package client contains the definitions of the different clients that can be used in a test.

Index

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

func NewDocker(t *testing.T, dockerOutput docker.ManagerOutput) (*Docker, error)

NewDocker creates a new instance of Docker NOTE: docker+ssh does not support password protected SSH keys.

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) (stdout string, stderr string, err 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) ListContainers added in v0.57.0

func (docker *Docker) ListContainers() ([]string, error)

ListContainers returns a list of container names.

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(t *testing.T, h *Host, osFamily os.Family) *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 EnvVar added in v0.55.0

type EnvVar map[string]string

EnvVar alias to map representing env variables

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

func NewHost(context e2e.Context, hostOutput remote.HostOutput) (*Host, error)

NewHost creates a new ssh client to connect to a remote host with reconnect retry logic

func (*Host) AppendFile added in v0.55.0

func (h *Host) AppendFile(os, path string, content []byte) (int64, error)

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

func (h *Host) CopyFile(src string, dst string)

CopyFile creates a sftp session and copy a single file to the remote host through SSH

func (*Host) CopyFileFromFS added in v0.57.0

func (h *Host) CopyFileFromFS(fs fs.FS, src, dst string)

CopyFileFromFS creates a sftp session and copy a single embedded file to the remote host through SSH

func (*Host) CopyFolder added in v0.55.0

func (h *Host) CopyFolder(srcFolder string, dstFolder string) error

CopyFolder create a sftp session and copy a folder to remote host through SSH

func (*Host) DialPort added in v0.55.0

func (h *Host) DialPort(port uint16) (net.Conn, error)

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

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

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

func (h *Host) GetFile(src string, dst string) error

GetFile create a sftp session and copy a single file from the remote host through SSH

func (*Host) GetLogsFolder added in v0.56.0

func (h *Host) GetLogsFolder() (string, error)

GetLogsFolder returns the logs folder path for the host

func (*Host) GetTmpFolder added in v0.56.0

func (h *Host) GetTmpFolder() (string, error)

GetTmpFolder returns the temporary folder path for the host

func (*Host) HTTPTransport added in v0.57.0

func (h *Host) HTTPTransport() http.RoundTripper

HTTPTransport returns an http.RoundTripper which dials the remote host. This transport can only reach the host.

func (*Host) Lstat added in v0.55.0

func (h *Host) Lstat(path string) (fs.FileInfo, error)

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

func (h *Host) MkdirAll(path string) 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.

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) NewHTTPClient added in v0.57.0

func (h *Host) NewHTTPClient() *http.Client

NewHTTPClient returns an *http.Client which dials the remote host. This client can only reach the host.

func (*Host) ReadDir added in v0.55.0

func (h *Host) ReadDir(path string) ([]fs.DirEntry, error)

ReadDir returns list of directory entries in path

func (*Host) ReadFile added in v0.55.0

func (h *Host) ReadFile(path string) ([]byte, error)

ReadFile reads the content of the file, return bytes read and error if any

func (*Host) Reconnect added in v0.55.0

func (h *Host) Reconnect() error

Reconnect closes the current ssh client and creates a new one, with retries.

func (*Host) Remove added in v0.55.0

func (h *Host) Remove(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.

func (*Host) RemoveAll added in v0.55.0

func (h *Host) RemoveAll(path string) error

RemoveAll recursively removes all files/folders in the specified directory. Returns an error if the directory does not exist.

func (*Host) WriteFile added in v0.55.0

func (h *Host) WriteFile(path string, content []byte) (int64, error)

WriteFile write content to the file and returns the number of bytes written and error if any

type KubernetesClient added in v0.56.0

type KubernetesClient struct {
	K8sConfig *rest.Config
	K8sClient kubeClient.Interface
}

KubernetesClient is a wrapper around the k8s client library and provides convenience methods for interacting with a k8s cluster

func NewKubernetesClient added in v0.56.0

func NewKubernetesClient(config *rest.Config) (*KubernetesClient, error)

NewKubernetesClient creates a new KubernetesClient

func (*KubernetesClient) PodExec added in v0.56.0

func (k *KubernetesClient) PodExec(namespace, pod, container string, cmd []string) (stdout, stderr string, err error)

PodExec execs into a given namespace/pod and returns the output for the given command

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]

Jump to

Keyboard shortcuts

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