testutils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplaceInFile

func ReplaceInFile(path, old, new string) error

ReplaceInFile replaces all instances of old with new in the file at path. todo(camilamacedo86): this func can be pushed to upstream/kb

func ReplaceRegexInFile

func ReplaceRegexInFile(path, match, replace string) error

ReplaceRegexInFile finds all strings that match `match` and replaces them with `replace` in the file at path. todo(camilamacedo86): this func can be pushed to upstream/kb

func UncommentCode

func UncommentCode(filename, target, prefix string) error

UncommentCode searches for target in the file and remove the comment prefix of the target content. The target content may span multiple lines. todo(camilamacedo86): this func exists in upstream/kb but there the error is not thrown. We need to push this change. See: https://github.com/kubernetes-sigs/kubebuilder/blob/master/test/e2e/utils/util.go

Types

type TestContext

type TestContext struct {
	*kbtestutils.TestContext
	// BundleImageName store the image to use to build the bundle
	BundleImageName string
	// ProjectName store the project name
	ProjectName string
	// contains filtered or unexported fields
}

TestContext wraps kubebuilder's e2e TestContext. Note: Though the testcontext has options to enable OLM and prometheus while starting test suite, we currently aren't using it for hybrid helm plugin.

func NewPartialTestContext

func NewPartialTestContext(binaryName, dir string, env ...string) (TestContext, error)

NewPartialTestContext returns a TestContext containing a partial kubebuilder TestContext. This object needs to be populated with GVK information. The underlying TestContext is created directly rather than through a constructor so cluster-based setup is skipped.

func NewTestContext

func NewTestContext(binaryName string, env ...string) (TestContext, error)

NewTestContext returns a TestContext containing a new kubebuilder TestContext. Construct if your environment is connected to a live cluster, ex. for e2e tests.

Jump to

Keyboard shortcuts

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