test

package
v1.44.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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

func TempDirWithFile(dir string, file string) string

TempDirWithFile creates a temporary directory dir with a temporary file

func TempDirWithSubDir

func TempDirWithSubDir(dir string, subDir string) string

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

Jump to

Keyboard shortcuts

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