e2e

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ENV_EXT = ".env"
View Source
const INPUT_EXT = ".input"
View Source
const JSON_EXT = ".json"
View Source
const STDERR_EXT = ".stderr"
View Source
const STDOUT_EXT = ".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 CheckTestSuite

func CheckTestSuite(testSuitePath string, name string)

/ checkTestSuite Check that the file corresponding to each suffix can appear only once

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 LoadFirstFileWithExt

func LoadFirstFileWithExt(dir string, ext string) string

LoadFirstFileWithExt read the first file with extention 'ext' in 'dir' 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 TestSuite

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

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>"

Jump to

Keyboard shortcuts

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