{"modulePath":"github.com/operator-framework/operator-sdk","version":"v1.42.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package testutils\n\n## Constants\n\n```go\nconst BinaryName = \"operator-sdk\"\n```\n\n```go\nconst (\n\tOlmVersionForTestSuite = \"0.28.0\"\n)\n```\n\n## Functions\n\n```go\nfunc ReplaceInFile(path, o, n string) error\n```\nReplaceInFile replaces all instances of old with new in the file at path. todo(camilamacedo86): this func can be pushed to upstream/kb\n\n```go\nfunc WrapWarn(err error)\n```\nWrapWarn is a one-liner to wrap an error from a command that returns (error) in a warning.\n\n```go\nfunc WrapWarnOutput(_ string, err error)\n```\nWrapWarnOutput is a one-liner to wrap an error from a command that returns (string, error) in a warning.\n\n## Types\n\n```go\ntype TestContext struct {\n\t*kbtestutils.TestContext\n\t// BundleImageName store the image to use to build the bundle\n\tBundleImageName string\n\t// ProjectName store the project name\n\tProjectName string\n\t// contains filtered or unexported fields\n}\n```\nTestContext wraps kubebuilder's e2e TestContext.\n\n```go\nfunc NewPartialTestContext(binaryName, dir string, env ...string) (tc TestContext, err error)\n```\nNewPartialTestContext 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.\n\n```go\nfunc NewTestContext(binaryName string, env ...string) (tc TestContext, err error)\n```\nNewTestContext returns a TestContext containing a new kubebuilder TestContext. Construct if your environment is connected to a live cluster, ex. for e2e tests.\n\n```go\nfunc (tc TestContext) AddPackagemanifestsTarget(operatorType projutil.OperatorType) error\n```\nAddPackagemanifestsTarget 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](https://v1-0-x.sdk.operatorframework.io/docs/olm-integration/generation/#package-manifests-formats)\n\n```go\nfunc (tc TestContext) AddScorecardCustomPatchFile() error\n```\n\n```go\nfunc (tc TestContext) DisableManifestsInteractiveMode() error\n```\nDisableManifestsInteractiveMode will update the Makefile to disable the interactive mode\n\n```go\nfunc (tc TestContext) GenerateBundle() error\n```\nGenerateBundle runs all commands to create an operator bundle.\n\n```go\nfunc (tc TestContext) InstallOLMVersion(version string) error\n```\nInstallOLMVersion runs 'operator-sdk olm install' for specific version and returns any errors emitted by that command.\n\n```go\nfunc (tc TestContext) InstallPrerequisites()\n```\nInstallPrerequisites will install OLM and Prometheus when the cluster kind is Kind and when they are not present on the Cluster\n\n```go\nfunc (tc TestContext) IsRunningOnKind() (bool, error)\n```\nIsRunningOnKind returns true when the tests are executed in a Kind Cluster\n\n```go\nfunc (tc TestContext) LoadImageToKindClusterWithName(image string) error\n```\nLoadImageToKindClusterWithName loads a local docker image with the name informed to the kind cluster\n\n```go\nfunc (tc TestContext) ReplaceScorecardImagesForDev() error\n```\nReplaceScorecardImagesForDev will replaces the scorecard images in the manifests per dev tag which is built in the CI based on the code changes made.\n\n```go\nfunc (tc TestContext) UncommentRestrictivePodStandards() error\n```\n\n```go\nfunc (tc TestContext) UninstallOLM()\n```\nUninstallOLM runs 'operator-sdk olm uninstall' and logs any errors emitted by that command.\n\n```go\nfunc (tc TestContext) UninstallPrerequisites()\n```\nUninstallPrerequisites will uninstall all prerequisites installed via InstallPrerequisites()\n\n","path":"github.com/operator-framework/operator-sdk/internal/testutils","name":"testutils","synopsis":"","isRedistributable":true}
