[e2e-test] Add run bundle to e2e test#3831
[e2e-test] Add run bundle to e2e test#3831varshaprasad96 wants to merge 2 commits intooperator-framework:masterfrom
Conversation
|
Ginko's |
b97da1a to
450c7eb
Compare
camilamacedo86
left a comment
There was a problem hiding this comment.
See my comment:
- instead of use docker-push we load the image in the kind. Use
LoadImageToKindClusterWithName(bundleImage) - The same need to be done for helm/ansible as well.
450c7eb to
28c2c4a
Compare
28c2c4a to
5474b9d
Compare
6846a96 to
3f25d7a
Compare
| @@ -0,0 +1,4 @@ | |||
| entries: | |||
| - description: > | |||
| Enable `run bundle` command and include e2e tests. | |||
There was a problem hiding this comment.
| Enable `run bundle` command and include e2e tests. | |
| Add the subcommand `operato-sdk run bundle` which allows users check their project integration with OLM via the bundle. |
The e2e are not relevant to end-users
There was a problem hiding this comment.
I agree with @camilamacedo86 rephrase it. I would change her suggestion a bit:
Added the run bundle subcommand which allows users to verify their operator's bundle integrates with OLM.
There was a problem hiding this comment.
This should be sufficient:
| Enable `run bundle` command and include e2e tests. | |
| Added the `run bundle` command. |
| @@ -34,7 +35,7 @@ Currently only the package manifests format is supported via the 'packagemanifes | |||
|
|
|||
| cmd.AddCommand( | |||
| // TODO(joelanford): enable bundle command when implementation is complete | |||
There was a problem hiding this comment.
| // TODO(joelanford): enable bundle command when implementation is complete |
|
|
||
| By("destroying the Operator deployed with the 'run' subcommand") | ||
| cleanupPkgManCmd := exec.Command(tc.BinaryName, "cleanup", projectName, | ||
| "--timeout", "4m") |
There was a problem hiding this comment.
You are running the bundle in a specific namespace. The ns that. is created for the operator (project-system).
Should not the cleanup be done with the ns as well?
| } | ||
|
|
||
| By("running the operator bundle using `run bundle` command") | ||
| runBundleCmd := exec.Command(tc.BinaryName, "run", "bundle", bundleImage, "--namespace", tc.Kubectl.Namespace) |
There was a problem hiding this comment.
The command is not working see:
See that the error lead to us to beleive that the image was NOT load in the Kind. So, the problem shows be in the isRunningOnKind. It shows has not the kubectx outside of the suite. See;
operator-sdk/test/e2e-ansible/e2e_ansible_suite_test.go
Lines 196 to 198 in f7d9976
Suggested solution:
- Move the var kubectx in the suite to the testContext:
// TestContext wraps kubebuilder's e2e TestContext.
type TestContext struct {
*kbtestutils.TestContext
// Kubectx stores the k8s context from where the tests are running
Kubectx string
}- Move
isRunningOnKindto utils. See;operator-sdk/test/internal/utils.go
Line 89 in f7d9976
func (tc TestContext) IsRunningOnKind() bool {
return strings.Contains(tc.Kubectx, "kind")
}- the if will be tc.IsRunningOnKind on the tests
- In the suite code we will set the value: tc.Kubectx = the type
There was a problem hiding this comment.
Yes, was trying to debug this error with Jesus. IsRunningOnKind works fine, but the run bundle logic always reaches to the remote registry to pull and unpack the image. Jesus is working on finding a way out for that. Meanwhile we decided to push the image to a remote repository, and check if it works. But there is some error in the install plan. Trying to figure that out.
There was a problem hiding this comment.
Hi @varshaprasad96,
Since we use the IsRunningOnKind in all tests and in more than one place, IMO it should be centralized such as in order to be easy keep it maintained: #3941
Regards the issue, see that in the above pr;
STEP: loading the bundle image into Kind cluster
running: kind load docker-image e2e-test/controller-manager-bundle:mbnd --name kind
STEP: running the operator bundle usingrun bundlecommand
running: operator-sdk run bundle e2e-test/controller-manager-bundle:mbnd --namespace e2e-mbnd-system
Which means that the image was loaded in the Kind. So, the problem shows be a bug in the operator-sdk run bundle.
There was a problem hiding this comment.
@camilamacedo86 yes, there is no error with IsRunningOnKind. The implementation logic of run bundle expects the image to be in registry. Even if its loaded in the kind cluster, while unpacking it tries to pull it from registry.
3f25d7a to
1c53dc8
Compare
jmrodri
left a comment
There was a problem hiding this comment.
Just minor changes to the fragment and etc.
| @@ -0,0 +1,4 @@ | |||
| entries: | |||
| - description: > | |||
| Enable `run bundle` command and include e2e tests. | |||
There was a problem hiding this comment.
I agree with @camilamacedo86 rephrase it. I would change her suggestion a bit:
Added the run bundle subcommand which allows users to verify their operator's bundle integrates with OLM.
| // bundle image should be present in the remote repository in run bundle | ||
| // implementation. | ||
| By("push the image to a remote repository") | ||
| err = tc.Make("docker-push", "IMG="+runBundleImg) |
There was a problem hiding this comment.
I assume you're reverting this change @varshaprasad96?
There was a problem hiding this comment.
@estroz no, afaik the image has to be pushed otherwise run bundle can't seem to pull the code.
Add run bundle to e2e operator test suite.
1c53dc8 to
14ee010
Compare
|
Hi @varshaprasad96, It is outdated and we need to solve the issue with the run bundle to be able to do that? WDYT @jmrodri |
|
@camilamacedo86 this PR can be closed. These test cases would be covered in run bundle unit tests. |

Description of the change:
Add run bundle to e2e operator test suite.
Motivation for the change:
Test run bundle integration with OLM.
Checklist
If the pull request includes user-facing changes, extra documentation is required:
changelog/fragments(seechangelog/fragments/00-template.yaml)website/content/en/docs