Documentation
¶
Index ¶
- func GetNonEmptyLines(output string) []string
- func InsertCode(filename, target, code string) error
- func UncommentCode(filename, target, prefix string) error
- type CmdContext
- type KBTestContext
- func (kc *KBTestContext) CleanupManifests(dir string)
- func (kc *KBTestContext) CreateAPI(resourceOptions ...string) error
- func (kc *KBTestContext) CreateWebhook(resourceOptions ...string) error
- func (kc *KBTestContext) Destroy()
- func (kc *KBTestContext) Init(initOptions ...string) error
- func (kc *KBTestContext) InstallCertManager() error
- func (kc *KBTestContext) InstallPrometheusOperManager() error
- func (kc *KBTestContext) LoadImageToKindCluster() error
- func (kc *KBTestContext) Make(makeOptions ...string) error
- func (kc *KBTestContext) Prepare() error
- func (kc *KBTestContext) UninstallCertManager()
- func (kc *KBTestContext) UninstallPrometheusOperManager()
- type Kubectl
- func (k *Kubectl) Apply(inNamespace bool, cmdOptions ...string) (string, error)
- func (k *Kubectl) Command(cmdOptions ...string) (string, error)
- func (k *Kubectl) CommandInNamespace(cmdOptions ...string) (string, error)
- func (k *Kubectl) Delete(inNamespace bool, cmdOptions ...string) (string, error)
- func (k *Kubectl) Get(inNamespace bool, cmdOptions ...string) (string, error)
- func (k *Kubectl) Logs(cmdOptions ...string) (string, error)
- func (k *Kubectl) WithInput(stdinInput string) *Kubectl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNonEmptyLines ¶
GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.
func InsertCode ¶
InsertCode searches target content in the file and insert `toInsert` after the target.
func UncommentCode ¶
UncommentCode searches for target in the file and remove the comment prefix of the target content. The target content may span multiple lines.
Types ¶
type CmdContext ¶
type CmdContext struct { // environment variables in k=v format. Env []string Dir string Stdin io.Reader }
CmdContext provides context for command execution
type KBTestContext ¶
type KBTestContext struct { *CmdContext TestSuffix string Domain string Group string Version string Kind string Resources string ImageName string Kubectl *Kubectl }
KBTestContext specified to run e2e tests
func TestContext ¶
func TestContext(env ...string) (*KBTestContext, error)
TestContext init with a random suffix for test KBTestContext stuff, to avoid conflict when running tests synchronously.
func (*KBTestContext) CleanupManifests ¶
func (kc *KBTestContext) CleanupManifests(dir string)
CleanupManifests is a helper func to run kustomize build and pipe the output to kubectl delete -f -
func (*KBTestContext) CreateAPI ¶
func (kc *KBTestContext) CreateAPI(resourceOptions ...string) error
CreateAPI is for running `kubebuilder create api`
func (*KBTestContext) CreateWebhook ¶
func (kc *KBTestContext) CreateWebhook(resourceOptions ...string) error
CreateWebhook is for running `kubebuilder create webhook`
func (*KBTestContext) Destroy ¶
func (kc *KBTestContext) Destroy()
Destroy is for cleaning up the docker images for testing
func (*KBTestContext) Init ¶
func (kc *KBTestContext) Init(initOptions ...string) error
Init is for running `kubebuilder init`
func (*KBTestContext) InstallCertManager ¶
func (kc *KBTestContext) InstallCertManager() error
InstallCertManager installs the cert manager bundle.
func (*KBTestContext) InstallPrometheusOperManager ¶
func (kc *KBTestContext) InstallPrometheusOperManager() error
InstallPrometheusOperManager installs the prometheus manager bundle.
func (*KBTestContext) LoadImageToKindCluster ¶
func (kc *KBTestContext) LoadImageToKindCluster() error
LoadImageToKindCluster loads a local docker image to the kind cluster
func (*KBTestContext) Make ¶
func (kc *KBTestContext) Make(makeOptions ...string) error
Make is for running `make` with various targets
func (*KBTestContext) Prepare ¶
func (kc *KBTestContext) Prepare() error
Prepare prepare a work directory for testing
func (*KBTestContext) UninstallCertManager ¶
func (kc *KBTestContext) UninstallCertManager()
UninstallCertManager uninstalls the cert manager bundle.
func (*KBTestContext) UninstallPrometheusOperManager ¶
func (kc *KBTestContext) UninstallPrometheusOperManager()
UninstallPrometheusOperManager uninstalls the prometheus manager bundle.
type Kubectl ¶
type Kubectl struct { *CmdContext Namespace string }
Kubectl contains context to run kubectl commands
func (*Kubectl) CommandInNamespace ¶
CommandInNamespace is a general func to run kubectl commands in the namespace