e2e

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CONF = "conf.json"
View Source
const ENV = "env"
View Source
const IGNORE = "ignore"
View Source
const INPUT = "input"
View Source
const STDERR = "stderr"
View Source
const STDOUT = "stdout"
View Source
const TEST_SUITES_DIR = "test_suites"
View Source
const TEST_WORKSPACE = "test_kpm_workspace"

Variables

View Source
var KEYS = []string{"<workspace>", "<ignore>", "<un_ordered>", "<user_home>"}

Functions

func CleanUpTestWorkspace

func CleanUpTestWorkspace() string

CleanUpTestWorkspace will do 'rm -rf' to the "($pwd)/test_kpm_workspace".

func Copy

func Copy(srcPath, dstPath string)

Copy will copy file from 'srcPath' to 'dstPath'.

func CopyDir

func CopyDir(srcDir, dstDir string)

CopyDir will copy dir from 'srcDir' to 'dstDir'.

func CreateTestWorkspace

func CreateTestWorkspace() string

CreateTestWorkspace create an empty dir "($pwd)/test_kpm_workspace" for test kpm cli.

func Exec

func Exec(cli string) (string, string, error)

Exec execute common command

func ExecKpm

func ExecKpm(cli string) (string, error)

ExecKpm executes kusion command

func ExecKpmWithInDirWithEnv

func ExecKpmWithInDirWithEnv(cli, dir, env string) (string, string, error)

ExecKpmWithInDirWithEnv executes kpm command in work directory with env.

func ExecKpmWithStdin

func ExecKpmWithStdin(cli, dir, input string) (string, error)

ExecKpmWithStdin executes kpm command in work directory with stdin

func ExecKpmWithWorkDir

func ExecKpmWithWorkDir(cli, dir string) (string, string, error)

ExecKpmWithWorkDir executes kpm command in work directory

func ExecWithWorkDir

func ExecWithWorkDir(cli, dir string) (string, error)

Exec execute common command

func GetKpmCLIBin

func GetKpmCLIBin() string

GetKpmCLIBin return kusion binary path in e2e test

func GetWorkDir

func GetWorkDir() string

GetWrokDir return work directory

func GetWorkspace

func GetWorkspace() string

GetWorkspace return the path of test workspace.

func IsIgnore

func IsIgnore(expectedStr string) bool

IsIgnore will reture whether the expected result in 'expectedStr' should be ignored.

func LoadFile

func LoadFile(path string) string

LoadFile will read the file from 'path' and return the content.

func RemoveLineOrder

func RemoveLineOrder(str1 string) string

RemoveLineOrder will remove the line order in 'str1'.

func ReplaceAllKeyByValue

func ReplaceAllKeyByValue(originStr, key, value string) string

ReplaceAllKeyByValue will replace all 'key's by 'value' in 'originStr'.

func SplitCommand

func SplitCommand(command string) []string

SplitCommand will spilt command string into []string, but the string in quotes will not be cut. If 'command' is 'aaa bbb "ccc ddd"', SplitCommand will return ["aaa", "bbb", "ccc ddd"].

Types

type TestConf

type TestConf struct {
	Cwd string
}

type TestSuite

type TestSuite struct {
	Name         string
	Envs         string
	Input        string
	ExpectStdout string
	ExpectStderr string

	Conf TestConf
	// contains filtered or unexported fields
}

func LoadAllTestSuites

func LoadAllTestSuites(testSuitesDir string) []TestSuite

LoadAllTestSuites load all test suites from 'getWorkDir()/test_suites'.

func LoadTestSuite

func LoadTestSuite(testSuitePath, name string) *TestSuite

LoadTestSuite load test suite from 'getWorkDir()/test_suites/name'.

func (*TestSuite) GetTestSuiteInfo

func (ts *TestSuite) GetTestSuiteInfo() string

GetTestSuiteInfo return a info for a test suite "<name>:<info>:<env>"

func (*TestSuite) ReplaceStringVar

func (ts *TestSuite) ReplaceStringVar(testSuitePath string) *TestSuite

Jump to

Keyboard shortcuts

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