Skip to content
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

Customizable e2e tests #93

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arkadeepsen
Copy link

@arkadeepsen arkadeepsen commented Sep 23, 2024

Description of the change:
This PR adds the support of customizing the e2e tests by providing various inputs via environment variables. The behavior of the tests remains the same with the default values.

Following are the details of the changes:

  • RBAC permissions were missing for operations related to project.openshift.io. Added them so that when the e2e test for memcached-molecule-operator is run on an OCP cluster the test passes successfully.
  • An environment variable, SKIP_SECRET_GENERATION, is used to skip the generation of secret related testdata for memcached-molecule-operator. This variable can be used to generate the testdata when running the e2e test with memcached-molecule-operator on an OCP cluster. If not not skipped, the controller tries to reconcile all secrets from all namespaces which results in heavy load on the controller and the e2e test fails.
  • Security context is added to the curl pod so that the creation of the pod doesn't fail on an OCP cluster.
  • MEMCACHED_MOLECULE_OPERATOR_IMAGE environment variable is introduced which will hold the container image registry path for memcached-molecule-operator, if set. Local image will not be built when this variable is set.
  • SKIP_LOCAL_TEST environment variable is introduced to skip the local test when it is set.
  • ADVANCED_MOLECULE_OPERATOR_IMAGE environment variable is introduced which will hold the container image registry path for advanced-molecule-operator, if set. Local image will not be built when this variable is set. In addition to that, the Kind test for memcached-molecule-operator will be skipped.
  • More granular Makefile targets are created so that only those can be called while skipping the targets which are related to Kind cluster creation.

Motivation for the change:

The e2e tests for ansible-operator-plugins are tightly coupled with Kind cluster. We want to use the same test cases that are used in the e2e tests on an OCP cluster. To enable us to do so, the e2e tests are needed to be made customizable so that they work on an OCP cluster, in addition to a Kind cluster.

@@ -518,6 +518,25 @@ const rolesForBaseOperator = `
- watch
#+kubebuilder:scaffold:rules
`
const rolesForProject = `
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an upstream project, and we wouldn't put anything OCP specific here. If that is needed, it should go in the downstream fork.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually already added in the memcached-molecule-operator roles. When we tried to run it on an OCP cluster it failed as the required permissions were not available.

- name: create project if projects are available
kubernetes.core.k8s:
definition:
apiVersion: project.openshift.io/v1
kind: Project
metadata:
name: testing-foo
when: "'project.openshift.io' in api_groups"

@acornett21
Copy link
Contributor

It seems like all of these changes are OCP specific, they should probably go in the downstream project.

@arkadeepsen
Copy link
Author

It seems like all of these changes are OCP specific, they should probably go in the downstream project.

I mentioned in the description that the changes are added for running the e2e test on an OCP cluster. However, the changes are actually platform agnostic and nothing is added which is specific for OCP. As the changes are platform agnostic we thought of adding them upstream. The actual OCP specific changes we'll add downstream. PLMK if you still feel that there are changes which are specific for OCP.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 18, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 21, 2024
Expect(operator.UndeployOperator(ansibleSample)).To(Succeed())
testutils.WrapWarnOutput("", operator.UndeployOperator(ansibleSample))
Copy link
Author

@arkadeepsen arkadeepsen Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting this change in favour of #106

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 22, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 22, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2024
@openshift-merge-robot
Copy link

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants