Documentation ¶
Index ¶
- func Mkdir(dir string)
- func OverrideKubeConfig() (teardown func())
- func OverrideKubeConfigAndCreateContextInNamespace(namespace string) (teardown func())
- func OverrideKubeConfigAndCreateDefaultContext() (teardown func())
- func TempDirWithFile(dir string, file string) string
- func TempDirWithSubDir(dir string, subDir string) string
- type CLITestContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mkdir ¶
func Mkdir(dir string)
Mkdir creates directory dir, including non-existing parent directories.
func OverrideKubeConfig ¶
func OverrideKubeConfig() (teardown func())
OverrideKubeConfig overrides the default KUBECONFIG location to a temporary one
func OverrideKubeConfigAndCreateContextInNamespace ¶
func OverrideKubeConfigAndCreateContextInNamespace(namespace string) (teardown func())
OverrideKubeConfigAndCreateContextInNamespace overrides the default KUBECONFIG location to a temporary one and creates a mock context in the given namespace
func OverrideKubeConfigAndCreateDefaultContext ¶
func OverrideKubeConfigAndCreateDefaultContext() (teardown func())
OverrideKubeConfigAndCreateDefaultContext initializes the default KUBECONFIG location to a temporary one and creates a mock context in the "default" namespace
func TempDirWithFile ¶
TempDirWithFile creates a temporary directory dir with a temporary file
func TempDirWithSubDir ¶
TempDirWithSubDir creates a temporary directory dir with a temporary subDir
Types ¶
type CLITestContext ¶ added in v1.8.0
type CLITestContext interface { ExecuteCli() (string, string, error) ExecuteCliCmd(cmd string) (string, string, error) GetClient() *client.Client }
CLITestContext holds the text context for the CLI Unit Tests. Use SetupCliTest or SetupCliTestWithKubeClient to get a reference for your test cases
func SetupCliTest ¶
func SetupCliTest(cli string, factory context.CommandFactory, kubeObjects ...runtime.Object) CLITestContext
SetupCliTest creates the CLI default test environment. The mocked Kubernetes client does not support OpenShift.
func SetupCliTestWithKubeClient ¶
func SetupCliTestWithKubeClient(cmd string, factory context.CommandFactory, kubeCli *client.Client) CLITestContext
SetupCliTestWithKubeClient Setup a CLI test environment with the given Kubernetes client