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.
(binaryName, dir string, env ...string)
| 62 | // This object needs to be populated with GVK information. The underlying TestContext is |
| 63 | // created directly rather than through a constructor so cluster-based setup is skipped. |
| 64 | func NewPartialTestContext(binaryName, dir string, env ...string) (tc TestContext, err error) { |
| 65 | cc := &kbtestutils.CmdContext{ |
| 66 | Env: env, |
| 67 | } |
| 68 | if cc.Dir, err = filepath.Abs(dir); err != nil { |
| 69 | return tc, err |
| 70 | } |
| 71 | projectName := strings.ToLower(filepath.Base(dir)) |
| 72 | |
| 73 | return TestContext{ |
| 74 | TestContext: &kbtestutils.TestContext{ |
| 75 | CmdContext: cc, |
| 76 | BinaryName: binaryName, |
| 77 | ImageName: makeImageName(projectName), |
| 78 | }, |
| 79 | ProjectName: projectName, |
| 80 | BundleImageName: makeBundleImageName(projectName), |
| 81 | }, nil |
| 82 | } |
| 83 | |
| 84 | func makeImageName(projectName string) string { |
| 85 | return fmt.Sprintf("quay.io/example/%s:v0.0.1", projectName) |
no test coverage detected