testutils

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const BinaryName = "operator-sdk"
View Source
const (
	OlmVersionForTestSuite = "0.17.0"
)

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

func WrapWarn added in v1.3.0

func WrapWarn(err error)

WrapWarn is a one-liner to wrap an error from a command that returns (error) in a warning.

func WrapWarnOutput added in v1.3.0

func WrapWarnOutput(_ string, err error)

WrapWarnOutput is a one-liner to wrap an error from a command that returns (string, error) in a warning.

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
	// Kubectx stores the k8s context from where the tests are running
	Kubectx string
	// contains filtered or unexported fields
}

TestContext wraps kubebuilder's e2e TestContext.

func NewPartialTestContext added in v1.3.0

func NewPartialTestContext(binaryName, dir string, env ...string) (tc TestContext, err 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) (tc TestContext, err error)

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

func (TestContext) AddPackagemanifestsTarget

func (tc TestContext) AddPackagemanifestsTarget() error

AddPackagemanifestsTarget will append the packagemanifests target to the makefile in order to test the steps described in the docs. More info: https://v1-0-x.sdk.operatorframework.io/docs/olm-integration/generation/#package-manifests-formats

func (TestContext) AddScorecardCustomPatchFile

func (tc TestContext) AddScorecardCustomPatchFile() error

func (TestContext) AllowProjectBeMultiGroup added in v1.2.0

func (tc TestContext) AllowProjectBeMultiGroup() error

AllowProjectBeMultiGroup will update the PROJECT file with the information to allow we scaffold apis with different groups. todo(camilamacedo86) : remove this helper when the edit plugin via the bin be available. See the Pr: https://github.com/kubernetes-sigs/kubebuilder/pull/1691

func (TestContext) DisableManifestsInteractiveMode added in v1.3.0

func (tc TestContext) DisableManifestsInteractiveMode() error

DisableOLMBundleInterativeMode will update the Makefile to disable the interactive mode

func (TestContext) GenerateBundle added in v1.3.0

func (tc TestContext) GenerateBundle() error

GenerateBundle runs all commands to create an operator bundle.

func (TestContext) InstallOLMVersion

func (tc TestContext) InstallOLMVersion(version string) error

InstallOLM runs 'operator-sdk olm install' for specific version and returns any errors emitted by that command.

func (TestContext) InstallPrerequisites added in v1.2.0

func (tc TestContext) InstallPrerequisites()

InstallPrerequisites will install OLM and Prometheus when the cluster kind is Kind and when they are not present on the Cluster

func (TestContext) IsRunningOnKind added in v1.2.0

func (tc TestContext) IsRunningOnKind() bool

IsRunningOnKind returns true when the tests are executed in a Kind Cluster

func (TestContext) LoadImageToKindClusterWithName

func (tc TestContext) LoadImageToKindClusterWithName(image string) error

LoadImageToKindClusterWithName loads a local docker image with the name informed to the kind cluster

func (TestContext) ReplaceScorecardImagesForDev

func (tc TestContext) ReplaceScorecardImagesForDev() error

ReplaceScorecardImagesForDev will replaces the scorecard images in the manifests per dev tag which is built in the CI based on the code changes made.

func (TestContext) UninstallOLM

func (tc TestContext) UninstallOLM()

InstallOLM runs 'operator-sdk olm uninstall' and logs any errors emitted by that command.

func (TestContext) UninstallPrerequisites added in v1.2.0

func (tc TestContext) UninstallPrerequisites()

UninstallPrerequisites will uninstall all prerequisites installed via InstallPrerequisites()

Jump to

Keyboard shortcuts

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