Documentation
¶
Index ¶
- Constants
- func CleanOutput(stdOutput string) string
- func GetCurrentServiceRevision(t *testing.T, serviceName string) string
- func GetFuncBinaryPath() string
- func GetKnativeServiceRevisionAndUrl(t *testing.T, serviceName string) (revision string, url string)
- func GetOsEnvOrDefault(env string, dflt string) string
- func GetRegistry() string
- func GetRuntime() string
- func IsUseKnFunc() bool
- func RetrieveKnativeServiceResource(t *testing.T, serviceName string) *unstructured.Unstructured
- func WaitForFunctionReady(t *testing.T, functionName string) (revisionName string, functionUrl string)
- func WaitForNewRevisionReady(t *testing.T, previousRevision string, functionName string) (newRevision string)
- type GitProvider
- type GitRemoteRepo
- type GitTestServerKnativeProvider
- type TestExecCmd
- type TestExecCmdResult
- type TestInteractiveCmd
Constants ¶
const (
DefaultRegistry = "localhost:50000/user"
)
Intended to provide setup configuration for E2E tests
Variables ¶
This section is empty.
Functions ¶
func CleanOutput ¶ added in v0.37.0
CleanOutput Some commands, such as deploy command, spans spinner chars and cursor shifts at output which are captured and merged regular output messages. This functions is meant to remove these chars in order to facilitate tests assertions and data extraction from output
func GetCurrentServiceRevision ¶ added in v0.37.0
GetCurrentServiceRevision retrieves current revision name for the deployed function
func GetFuncBinaryPath ¶ added in v0.37.0
func GetFuncBinaryPath() string
GetFuncBinaryPath should return the Path of 'func' binary under test
func GetKnativeServiceRevisionAndUrl ¶ added in v0.37.0
func GetOsEnvOrDefault ¶ added in v0.37.0
func GetRuntime ¶ added in v0.37.0
func GetRuntime() string
GetRuntime returns the runtime that should be tested.
func IsUseKnFunc ¶ added in v0.37.0
func IsUseKnFunc() bool
IsUseKnFunc indicates that tests should be run against "kn func" instead of "func" binary
func RetrieveKnativeServiceResource ¶ added in v0.37.0
func RetrieveKnativeServiceResource(t *testing.T, serviceName string) *unstructured.Unstructured
RetrieveKnativeServiceResource wraps the logic to query knative serving resources in current namespace
func WaitForFunctionReady ¶ added in v0.37.0
Types ¶
type GitProvider ¶
type GitProvider interface { Init(T *testing.T) CreateRepository(repoName string) *GitRemoteRepo DeleteRepository(repoName string) }
var DefaultGitServer GitProvider
func GetGitServer ¶
func GetGitServer(T *testing.T) GitProvider
type GitRemoteRepo ¶
type GitTestServerKnativeProvider ¶ added in v0.41.0
type GitTestServerKnativeProvider struct { PodName string ServiceUrl string Kubectl *TestExecCmd // contains filtered or unexported fields }
func (*GitTestServerKnativeProvider) CreateRepository ¶ added in v0.41.0
func (g *GitTestServerKnativeProvider) CreateRepository(repoName string) *GitRemoteRepo
func (*GitTestServerKnativeProvider) DeleteRepository ¶ added in v0.41.0
func (g *GitTestServerKnativeProvider) DeleteRepository(repoName string)
func (*GitTestServerKnativeProvider) Init ¶ added in v0.41.0
func (g *GitTestServerKnativeProvider) Init(T *testing.T)
type TestExecCmd ¶
type TestExecCmd struct { // binary to invoke // Example: "func", "kn", "kubectl", "/usr/bin/sh" Binary string // Binary args to append before actual args. Examples: // when 'kn' binary binaryArgs should be ["func"] BinaryArgs []string // Run commands from Dir SourceDir string // Indicates shell should dump command line args during execution ShouldDumpCmdLine bool // Indicates shell should dump ShouldDumpOnSuccess bool // Fail Test on Error ShouldFailOnError bool // Environment variable to be used with the command Env []string // Optional function to be used to dump stdout command results DumpLogger func(out string) // Access to Running or Latest command ExecCmd *exec.Cmd // Function to be executed while the command is running. This function is executed only once OnWaitCallback func(stdout *bytes.Buffer) // Function to be executed after the command is completed (before error and cmd stdout logic is executed) OnFinishCallback func(result *TestExecCmdResult) T *testing.T }
func NewKnFuncShellCli ¶
func NewKnFuncShellCli(t *testing.T) *TestExecCmd
func NewShellCmd ¶
func NewShellCmd(t *testing.T, fromDirectory string) *TestExecCmd
func (*TestExecCmd) Exec ¶
func (f *TestExecCmd) Exec(args ...string) TestExecCmdResult
Exec invokes go exec library and runs a shell command combining the binary args with args from method signature
func (*TestExecCmd) FromDir ¶
func (f *TestExecCmd) FromDir(dir string) *TestExecCmd
func (*TestExecCmd) Run ¶
func (f *TestExecCmd) Run(oneArgs string) TestExecCmdResult
func (*TestExecCmd) WithEnv ¶
func (f *TestExecCmd) WithEnv(envKey string, envValue string) *TestExecCmd
type TestExecCmdResult ¶
TestExecCmdResult stored command result
type TestInteractiveCmd ¶ added in v0.37.0
type TestInteractiveCmd struct { TestCmd *TestExecCmd T *testing.T // Sleep interval before first command input StartSleepInterval time.Duration // Sleep interval between each subcommand CommandSleepInterval time.Duration // Sleep interval after last command completion. // Required time to give to process to complete before EOF CompletionSleepInterval time.Duration // Timeout before kill the cmd in case of some failure CompletionTimeout time.Duration }
func NewTestShellInteractiveCmd ¶ added in v0.37.0
func NewTestShellInteractiveCmd(t *testing.T) *TestInteractiveCmd
func (*TestInteractiveCmd) PrepareRun ¶ added in v0.37.0
func (f *TestInteractiveCmd) PrepareRun(funcCommand ...string) func(args ...string) TestExecCmdResult
PrepareRun creates a go function used to start kn func (binary) that requires user interaction such as `func config command`