testing

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InfraSetupWait = time.Second * 11
)

Functions

func NextPortValue added in v0.3.0

func NextPortValue() string

NextPortValue returns a pseudo-rando test [2200 .. 2290]

func NextResourceName added in v0.3.0

func NextResourceName() string

NextResourceName returns crashd-test-XXXX name

func Username added in v0.3.0

func Username() (string, error)

Username returns current username

func WriteKeys added in v0.3.0

func WriteKeys(rootPath string) error

WriteKeys copies the static private key in variable privateKey to a local file.

Types

type KindCluster

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

func NewKindCluster

func NewKindCluster(config, name, tmpRootDir string) *KindCluster

func (*KindCluster) Create

func (k *KindCluster) Create() error

func (*KindCluster) Destroy

func (k *KindCluster) Destroy() error

func (*KindCluster) GetKubeCtlContext

func (k *KindCluster) GetKubeCtlContext() string

func (*KindCluster) MakeKubeConfigFile

func (k *KindCluster) MakeKubeConfigFile(path string) error

func (*KindCluster) SimulateTerminatingPod added in v0.4.0

func (k *KindCluster) SimulateTerminatingPod() error

func (*KindCluster) StartNginxPod added in v0.4.1

func (k *KindCluster) StartNginxPod() error

type SSHServer

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

func NewSSHServer

func NewSSHServer(serverName, username, port, sshMountDir string) (*SSHServer, error)

func (*SSHServer) MountedDir added in v0.3.0

func (s *SSHServer) MountedDir() string

func (*SSHServer) PrivateKey added in v0.3.0

func (s *SSHServer) PrivateKey() string

func (*SSHServer) Start

func (s *SSHServer) Start() error

StartSSHServer starts starts sshd process using image linuxserver/openssh-server.DockerRunSSH The server opnes up port 2222 with the following command

docker create \
  --name=test-sshd \
  -e PUBLIC_KEY_FILE=$HOME/.ssh/id_rsa.pub \
  -e USER_NAME=$USER \
  -e SUDO_ACCESS=true \
  -p 2222:2222 \
  -v ./testing/server-name:/config
  linuxserver/openssh-server

func (*SSHServer) Stop

func (s *SSHServer) Stop() error

type TestSupport added in v0.3.0

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

func Init

func Init() (*TestSupport, error)

Init initializes and returns TestSupport instance

func (*TestSupport) CurrentUsername added in v0.3.0

func (t *TestSupport) CurrentUsername() string

CurrentUsername returns the current username or error

func (*TestSupport) KindClusterContextName added in v0.3.4

func (t *TestSupport) KindClusterContextName() string

func (*TestSupport) KindKubeConfigFile added in v0.3.0

func (t *TestSupport) KindKubeConfigFile() string

func (*TestSupport) MaxConnectionRetries added in v0.3.0

func (t *TestSupport) MaxConnectionRetries() int

func (*TestSupport) PortValue added in v0.3.0

func (t *TestSupport) PortValue() string

PortValue returns a string with a random value that can be used as port

func (*TestSupport) PrivateKeyPath added in v0.3.0

func (t *TestSupport) PrivateKeyPath() string

func (*TestSupport) ResourceName added in v0.3.0

func (t *TestSupport) ResourceName() string

ResourceName resturns string that can be used to name resource

func (*TestSupport) SetupKindCluster added in v0.3.0

func (t *TestSupport) SetupKindCluster() error

func (*TestSupport) SetupKindKubeConfig added in v0.3.0

func (t *TestSupport) SetupKindKubeConfig() (string, error)

func (*TestSupport) SetupSSHServer added in v0.3.0

func (t *TestSupport) SetupSSHServer() error

func (*TestSupport) SimulateTerminatingPod added in v0.4.0

func (t *TestSupport) SimulateTerminatingPod() error

func (*TestSupport) StartNginxPod added in v0.4.1

func (t *TestSupport) StartNginxPod() error

func (*TestSupport) TearDown added in v0.3.0

func (t *TestSupport) TearDown() error

func (*TestSupport) TmpDirRoot added in v0.3.0

func (t *TestSupport) TmpDirRoot() string

func (*TestSupport) WorkDirRoot added in v0.3.0

func (t *TestSupport) WorkDirRoot() string

Jump to

Keyboard shortcuts

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