Documentation
¶
Index ¶
- func GetNonEmptyLines(output string) []string
- func InsertCode(filename, target, code string) error
- func UncommentCode(filename, target, prefix string) error
- type CmdContext
- 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) Wait(inNamespace bool, cmdOptions ...string) (string, error)
- func (k *Kubectl) WithInput(stdinInput string) *Kubectl
- type TestContext
- func (tc *TestContext) CleanupManifests(dir string)
- func (tc *TestContext) CreateAPI(resourceOptions ...string) error
- func (tc *TestContext) CreateWebhook(resourceOptions ...string) error
- func (tc *TestContext) Destroy()
- func (tc *TestContext) Init(initOptions ...string) error
- func (tc *TestContext) LoadImageToKindCluster() error
- func (tc *TestContext) Make(makeOptions ...string) error
- func (tc *TestContext) Prepare() error
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 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
type TestContext ¶
type TestContext struct {
*CmdContext
TestSuffix string
Domain string
Group string
Version string
Kind string
Resources string
ImageName string
BinName string
Kubectl *Kubectl
}
TestContext specified to run e2e tests
func NewTestContext ¶
func NewTestContext(binName string, env ...string) (*TestContext, error)
NewTestContext init with a random suffix for test TestContext stuff, to avoid conflict when running tests synchronously.
func (*TestContext) CleanupManifests ¶
func (tc *TestContext) CleanupManifests(dir string)
CleanupManifests is a helper func to run kustomize build and pipe the output to kubectl delete -f -
func (*TestContext) CreateAPI ¶
func (tc *TestContext) CreateAPI(resourceOptions ...string) error
CreateAPI is for running `<tc.BinName> create api`
func (*TestContext) CreateWebhook ¶
func (tc *TestContext) CreateWebhook(resourceOptions ...string) error
CreateWebhook is for running `<tc.BinName> create webhook`
func (*TestContext) Destroy ¶
func (tc *TestContext) Destroy()
Destroy is for cleaning up the docker images for testing
func (*TestContext) Init ¶
func (tc *TestContext) Init(initOptions ...string) error
Init is for running `<tc.BinName> init`
func (*TestContext) LoadImageToKindCluster ¶
func (tc *TestContext) LoadImageToKindCluster() error
LoadImageToKindCluster loads a local docker image to the kind cluster
func (*TestContext) Make ¶
func (tc *TestContext) Make(makeOptions ...string) error
Make is for running `make` with various targets
func (*TestContext) Prepare ¶
func (tc *TestContext) Prepare() error
Prepare prepare a work directory for testing