-
Notifications
You must be signed in to change notification settings - Fork 12
CFE-1108: Use upstream e2e to run using downstream images #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add RBAC permissions to create a project Add option to skip generation of testdata related to secrets Add option to skip local run in e2e Add option to skip image build and use pre-built memcached-molecule operator image Add security context to the spec of the pod used for fetching metrics Report a warning instead of test failure if undeply of memcached-molecule operator fails Add make target for only running the e2e test
|
@arkadeepsen: This pull request references CFE-1100 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: arkadeepsen The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold |
|
@arkadeepsen: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding few comments, I'll take another look.
| test-e2e-ansible-molecule:: install dev-install image/ansible-operator ## Run molecule-based Ansible e2e tests | ||
| go run ./hack/generate/samples/molecule/generate.go | ||
| ./hack/tests/e2e-ansible-molecule.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also try adding test-e2e-ansible-molecule target in the CI, as a followup PR may be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can take a look at it.
| .PHONY: test-e2e-ansible-run | ||
| test-e2e-ansible-run: | ||
| go test ./test/e2e/ansible -v -ginkgo.v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to move this target above # Double colon rules allow repeated rule declarations. comment line for better flow understanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought adding the test-e2e-ansible-run target just below the test-e2e-ansible target would make it easier to understand the flow.
| Kind: "Memcached", | ||
| } | ||
|
|
||
| var skipSecretGeneration = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to make it a global variable? If this variable is getting used only in GenerateMoleculeSample, we can make it local to that function to avoid unexpected use by other files inside this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to make changes to the existing function definitions. That's why I used the global variable.
| pkg.CheckError("generating ansible molecule sample - ignore", err) | ||
| } | ||
|
|
||
| ImplementMemcached(ansibleMoleculeMemcached, bundleImage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImplementMemcached can take skipSecretGeneration as an arg to avoid relying on global variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as #11 (comment).
| samplecli.WithName(ansibleMoleculeMemcached.Name()), | ||
| ) | ||
| pkg.CheckError("creating ignore samples", err) | ||
| skipSecretGeneration = os.Getenv("SKIP_SECRET_GENERATION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skipSecretGeneration would hold only boolean values, and the default should be false. Would it make sense to update the type to bool? The following helper functions could be useful.
// env returns an environment variable or a default value if not specified.
func env(key string, defaultValue string) string {
val := os.Getenv(key)
if len(val) == 0 {
return defaultValue
}
return val
}
func isTrue(s string) bool {
v, _ := strconv.ParseBool(s)
return v
}| skipSecretGeneration = os.Getenv("SKIP_SECRET_GENERATION") | |
| skipSecretGeneration := isTrue(env("SKIP_SECRET_GENERATION", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usage of strconv.ParseBool() will introduce the issue of error handling. The idea is to add code with minimal/no chances of erroring out. The current code simply says that if the SKIP_SECRET_GENERATION env var is not set to any value, then the operation will work as it is working currently. However, if you need to skip the generation of the secret related code, then set the env var to any value (need not be boolean). This avoids the additional checking of the value being a valid boolean or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SKIP_SECRET_GENERATION ENV can be exported with false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explained in #11 (comment).
| @@ -0,0 +1,20 @@ | |||
| FROM basebuilder AS builder | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we directly use the image tag to avoid overwriting in release config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems easier to maintain it like this. We won't have to update it on every branch cut and it will minimize the effort going forward. Also we just need the basebulider to re-generate the testdata directory. We are not building any binary which will be impacted by the base image.
|
|
||
| By("cleaning up created API objects during test process") | ||
| Expect(operator.UndeployOperator(ansibleSample)).To(Succeed()) | ||
| testutils.WrapWarnOutput("", operator.UndeployOperator(ansibleSample)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Undeploy causing some issues? Currently, there is only one It, so it's okay to use Warn instead of Error, but if the test grows, it could be an issue, and I think upstream won't accept this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The make undeploy removes the objects in the same order they are created. The namespace is deleted first and as it gets deleted all the resources created in the namespaces also gets deleted along with it. This always fails when running in an OCP cluster. However, on a kind cluster, this doesn't fail as the deletion of namespace takes some time and thus the make undeploy completes successfully.
I think it's okay to not fail a test if the cleanup fails. It's not related to the actual e2e test anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes should happen in runtime inside the container, do we need to commit the changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is updated as a result of running make generate. This additional permission is anyway required and it was kind of a bug not to include the permissions in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if we don't run make generate before pushing the changes to the PR, it'll fail the sanity check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is updated as a result of running make generate. If we don't run make generate before pushing the changes to the PR, it'll fail the sanity check.
|
@arkadeepsen: This pull request references CFE-1108 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
| ## Apply customize roles related to project.openshift.io | ||
| ## | ||
| - apiGroups: | ||
| - project.openshift.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the api groups installed via a CR on kind cluster?
|
@arkadeepsen, some changes assume roles that are specific to openshift apis. Have this PR been tested with kind cluster deployed by default in the Makefile? |
|
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
|
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
|
Rotten issues close after 30d of inactivity. Reopen the issue by commenting /close |
|
@openshift-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Description of the change:
This PR uses upstream e2e to run using downstream images
Motivation for the change:
Add support for running e2e downstream
Corresponding release PR: openshift/release#55440