testutils

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

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

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 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
	// 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(operatorType projutil.OperatorType) 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) 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, error)

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) UncommentRestrictivePodStandards added in v1.22.0

func (tc TestContext) UncommentRestrictivePodStandards() error

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