evetestkit

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppDefaultSSHPass is a default ssh password for the VM running on the EVE node
	AppDefaultSSHPass = "passw0rd"
	// AppDefaultSSHUser is a default ssh user for the VM running on the EVE node
	AppDefaultSSHUser = "ubuntu"
	// AppDefaultCloudConfig is a default cloud-init configuration for the VM which just
	// enables ssh password authentication and sets the password to "passw0rd".
	AppDefaultCloudConfig = "#cloud-config\npassword: " + AppDefaultSSHPass + "\nchpasswd: { expire: False }\nssh_pwauth: True\n"
)

Variables

This section is empty.

Functions

func GetDefaultVMConfig

func GetDefaultVMConfig(appName, cloudConfig string, portPub []string) openevec.PodConfig

GetDefaultVMConfig returns a default configuration for a VM

func GetRandomAppName

func GetRandomAppName(prefix string) string

GetRandomAppName generates a random app name

func NewTestContextFromConfig

func NewTestContextFromConfig(cfg *openevec.EdenSetupArgs) (*testcontext.TestContext, error)

Types

type AppOption

type AppOption func(n *EveNode, appName string)

AppOption is a function that sets the configuration for the app running on the EVE node

func WithSSH

func WithSSH(user, pass, port string) AppOption

WithSSH is an option that sets the SSH configuration for the app running on the EVE node, this should be use with DeployVM function.

type EveNode

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

EveNode is a struct that holds the information about the remote node

func InitializeTest

func InitializeTest(projectName string, options ...TestOption) (*EveNode, error)

InitializeTest is used to provide setup and teardown for the rest of the tests. As part of setup we make sure that context has a slice of EVE instances that we can operate on. It grabs the first one in the slice for running tests.

func InitializeTestFromConfig

func InitializeTestFromConfig(projectName string, cfg *openevec.EdenSetupArgs, options ...TestOption) (*EveNode, error)

func (*EveNode) AppGetState

func (node *EveNode) AppGetState(appName string) (string, error)

AppGetState gets the state of an app running on the EVE node

func (*EveNode) AppSCPCopy

func (node *EveNode) AppSCPCopy(appName, localFile, remoteFile string) error

AppSCPCopy copies a file from the local machine to the app VM running on the EVE node.

func (*EveNode) AppSSHExec

func (node *EveNode) AppSSHExec(appName, command string) (string, error)

AppSSHExec executes a command on the app VM running on the EVE node.

func (*EveNode) AppStopAndRemove

func (node *EveNode) AppStopAndRemove(appName string) error

AppStopAndRemove stops and removes an app from the EVE node

func (*EveNode) AppWaitForRunningState

func (node *EveNode) AppWaitForRunningState(appName string, timeoutSeconds uint) error

AppWaitForRunningState waits for an app to start and become running on the EVE node

func (*EveNode) AppWaitForSSH

func (node *EveNode) AppWaitForSSH(appName string, timeoutSeconds uint) error

AppWaitForSSH waits for the SSH connection to be established to the app VM that is running on the EVE node

func (*EveNode) CopyTestScripts

func (node *EveNode) CopyTestScripts(appName, basetPath string, scripts *[]TestScript) error

CopyTestScripts copies the test scripts to the app VM running on the EVE node, makes them executable and sets the path to the copied script in the input.

func (*EveNode) EveDeleteFile

func (node *EveNode) EveDeleteFile(fileName string) error

EveDeleteFile deletes a file from EVE node

func (*EveNode) EveDeployApp

func (node *EveNode) EveDeployApp(appLink string, destructiveUse bool, pc openevec.PodConfig, options ...AppOption) error

EveDeployApp deploys a VM/App on the EVE node

func (*EveNode) EveDeployUbuntu

func (node *EveNode) EveDeployUbuntu(version, name string, destructiveUse bool) (string, error)

EveDeployUbuntu deploys an Ubuntu VM on the EVE node

func (*EveNode) EveFileExists

func (node *EveNode) EveFileExists(fileName string) (bool, error)

EveFileExists checks if a file exists on EVE node

func (*EveNode) EveIsTpmEnabled

func (node *EveNode) EveIsTpmEnabled() bool

EveIsTpmEnabled checks if EVE node is running with (SW)TPM enabled

func (*EveNode) EveReadFile

func (node *EveNode) EveReadFile(fileName string) ([]byte, error)

EveReadFile reads a file from EVE node

func (*EveNode) EveRebootAndWait

func (node *EveNode) EveRebootAndWait(timeoutSeconds uint) error

EveRebootAndWait reboots the EVE node and waits for it to come back.

func (*EveNode) EveRebootNode

func (node *EveNode) EveRebootNode() error

EveRebootNode reboots the EVE node.

func (*EveNode) EveRunCommand

func (node *EveNode) EveRunCommand(command string) ([]byte, error)

EveRunCommand runs a command on the EVE node

func (*EveNode) GetAppNames

func (node *EveNode) GetAppNames() []string

GetAppNames returns the names of the apps running on the EVE node

func (*EveNode) GetCopiedScriptPath

func (node *EveNode) GetCopiedScriptPath(scriptName string) string

GetCopiedScriptPath returns the path to the copied script on the app VM running on the EVE node.

func (*EveNode) LogTimeFatalf

func (node *EveNode) LogTimeFatalf(format string, args ...interface{})

LogTimeFatalf logs a message with a timestamp, if it is called in the context of a test function it will call t.Fatal, otherwise it will call os.Exit(1)

func (*EveNode) LogTimeInfof

func (node *EveNode) LogTimeInfof(format string, args ...interface{})

LogTimeInfof logs a message with a timestamp, if it is called in the context of a test function it will call t.Logf, otherwise it will call fmt.Print

type TestOption

type TestOption func()

TestOption is a function that sets the configuration for the test

func WithControllerVerbosity

func WithControllerVerbosity(verbosity string) TestOption

WithControllerVerbosity sets the verbosity level of the controller, possible values are: panic, fatal, error, debug, info, trace, warn This is an option for InitializeTest.

func WithEdenConfigEnv

func WithEdenConfigEnv(env string) TestOption

WithEdenConfigEnv sets the environment variable that holds the path to the eden configuration file. This is an option for InitializeTest.

type TestScript

type TestScript struct {
	Name           string
	DstPath        string
	Content        string
	MakeExecutable bool
}

TestScript is a struct that holds the information about the test scripts that are copied to the app VM running on the EVE node.

Jump to

Keyboard shortcuts

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