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

Allow setting order and hooks for test role #2374

Conversation

eshulman2
Copy link
Contributor

@eshulman2 eshulman2 commented Sep 24, 2024

This PR introduces improvements to the test_operator role, enabling ordering of testing stages and hooks for better control over test execution. Key updates include:

Customizable Testing Order:
Introduced the ability to define the testing order for the test_operator role, providing better control over test sequencing.

Repeatable Testing Controller:
Added support for running the same testing controller multiple times within a single test suite.

Stage-Specific Hooks:
Enabled configuration of pre-hooks and post-hooks for each testing stage, offering more granular customization.

Variable Overrides per Stage:
Allowed overriding variables for specific testing stages via either external files (test_vars_file) or specific stage vars (test_vars) parameter.

Refactoring for Enhanced Flexibility
The implementation refactors pre-set testing stage functionality, making test management more adaptable and significantly extending hook behavior when using the CI framework (cifmw). These changes enable the creation of more complex testing workflows, including scenarios requiring multiple and varied hooks or stage-specific configurations.

Impact and Use Cases
These updates allow users to:

  • Design sophisticated test scenarios with stage-specific logic.
  • Reuse controllers efficiently across multiple stages.
  • Seamlessly integrate dynamic hooks and variables for greater flexibility.

Related Issue:
Jira: OSPRH-10106

Copy link

Thanks for the PR! ❤️
I'm marking it as a draft, once your happy with it merging and the PR is passing CI, click the "Ready for review" button below.

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/e1ceb9f2cf3d47658a3de25c1ed70de8

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 39m 16s
podified-multinode-edpm-deployment-crc FAILURE in 1h 03m 43s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 23m 33s
cifmw-multinode-tempest FAILURE in 1h 05m 28s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 35s
cifmw-pod-pre-commit FAILURE in 7m 04s
✔️ build-push-container-cifmw-client SUCCESS in 30m 49s
✔️ cifmw-molecule-run_hook SUCCESS in 3m 26s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 31s

@eshulman2 eshulman2 force-pushed the test_operator_stages branch 3 times, most recently from f24ddba to c4de17d Compare September 24, 2024 15:17
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/a25d6668f88443eeb5b2e354691eb8dc

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 39m 51s
podified-multinode-edpm-deployment-crc FAILURE in 1h 02m 18s
cifmw-crc-podified-edpm-baremetal RETRY_LIMIT in 22m 04s
cifmw-multinode-tempest FAILURE in 1h 02m 50s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 49s
cifmw-pod-pre-commit FAILURE in 8m 22s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 50s
✔️ cifmw-architecture-validate-hci SUCCESS in 4m 00s
✔️ build-push-container-cifmw-client SUCCESS in 31m 24s
✔️ cifmw-molecule-run_hook SUCCESS in 3m 25s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 16s

@eshulman2 eshulman2 force-pushed the test_operator_stages branch 2 times, most recently from c175381 to 5efbd8f Compare September 24, 2024 17:26
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/ea84a8ceb689406f85a63f9e9f8d1718

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 39m 40s
podified-multinode-edpm-deployment-crc FAILURE in 1h 00m 58s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 27m 32s
cifmw-multinode-tempest FAILURE in 1h 01m 56s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 29s
cifmw-pod-pre-commit FAILURE in 6m 57s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 18s
✔️ cifmw-architecture-validate-hci SUCCESS in 4m 47s
✔️ build-push-container-cifmw-client SUCCESS in 20m 55s
✔️ cifmw-molecule-run_hook SUCCESS in 4m 02s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 54s

@eshulman2 eshulman2 force-pushed the test_operator_stages branch 3 times, most recently from 1c61cd8 to 34ffac9 Compare September 25, 2024 08:19
@eshulman2 eshulman2 marked this pull request as ready for review September 25, 2024 08:24
@eshulman2 eshulman2 force-pushed the test_operator_stages branch 2 times, most recently from c00804c to e6b67aa Compare September 25, 2024 08:28
@eshulman2 eshulman2 requested review from lpiwowar, lewisdenny and cjeanner and removed request for lpiwowar and lewisdenny September 25, 2024 09:48
@pablintino
Copy link
Collaborator

pablintino commented Nov 27, 2024

@lpiwowar @SeanMooney @vyzigold I can offer a compromise. I can probably do something like this in the defaults/main.yaml and mention that the old names are aliases for the new names and should not be used anymore for any new project. this will allow us to keep the same behavior in case a project didn't changed the name of the vars but would also allow us to conform to a naming convention:

cifmw_test_operator_tempest_concurrency: "{{ cifmw_test_operator_concurrency }}"
cifmw_test_operator_tempest_tempestconf_config: "{{ cifmw_tempest_tempestconf_config }}"

CC: @pablintino any thoughts?

I'd be fine with this change as long as we can merge it without touching a single job. That trick in the defaults will do the trick and I'm all good with it.

@eshulman2
Copy link
Contributor Author

@lpiwowar @pablintino updated the patch and related patch with changes in the compromise

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/5ab23c4b7d3f4804b46465355e232cf1

✔️ openstack-k8s-operators-content-provider SUCCESS in 3h 07m 37s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 18m 38s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 29m 13s
podified-multinode-hci-deployment-crc FAILURE in 2h 34m 32s
✔️ cifmw-multinode-tempest SUCCESS in 1h 39m 46s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 20s
✔️ cifmw-pod-pre-commit SUCCESS in 7m 03s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 02s
✔️ build-push-container-cifmw-client SUCCESS in 37m 38s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 12s

@lpiwowar
Copy link
Contributor

@eshulman2 👍 the changes you've made look reasonable. Now it is about the testing.

This commit adds key improvements to the test_operator role:

Support for defining test execution order.
Ability to run the same testing controller multiple times.
Pre-hooks and post-hooks for stage-specific customization.
Per-stage variable overrides via files or test_vars.
Refactored pre-set testing stages to enable more dynamic test
management and extend hook behavior for complex scenarios.

Jira: OSPRH-10106
@pablintino
Copy link
Collaborator

/approve

Copy link
Contributor

openshift-ci bot commented Dec 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pablintino

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

lpiwowar added a commit to lpiwowar/test-operator that referenced this pull request Dec 16, 2024
cifmw_run_test_role: shiftstack
cifmw_run_test_shiftstack_testconfig:
- 4.17_ovnkubernetes_ipi.yaml
- 4.17_ovnkubernetes_upi.yaml
cifmw_shiftstack_qa_gerrithub_change: refs/changes/29/1188429/50 #optional

$ ansible-playbook deploy-edpm.yml -e 'cifmw_run_tests=true cifmw_run_tempest=false cifmw_run_test_role=shiftstack cifmw_openshift_kubeconfig={{ ansible_user_dir }}/.kube/config cifmw_shiftstack_qa_gerrithub_change=refs/changes/29/1188429/50' -e 'cifmw_run_test_shiftstack_testconfig=["4.17_ovnkubernetes_ipi.yaml","4.17_ovnkubernetes_upi.yaml"]'
$ ansible-playbook deploy-edpm.yml --extra-vars "cifmw_run_tests=true cifmw_run_test_role=shiftstack cifmw_test_operator_stages=[] cifmw_openshift_kubeconfig={{ ansible_user_dir }}/.kube/config cifmw_run_test_shiftstack_testconfig=4.15_ovnkubernetes_ipi_va1.yaml cifmw_shiftstack_qa_gerrithub_change=refs/changes/29/1188429/50"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey Ella, thanks for adapting the shiftstack part too. I'm suggesting a change (even if it's a md file) just because cifmw_run_test_shiftstack_testconfig should be a list.

Suggested change
$ ansible-playbook deploy-edpm.yml --extra-vars "cifmw_run_tests=true cifmw_run_test_role=shiftstack cifmw_test_operator_stages=[] cifmw_openshift_kubeconfig={{ ansible_user_dir }}/.kube/config cifmw_run_test_shiftstack_testconfig=4.15_ovnkubernetes_ipi_va1.yaml cifmw_shiftstack_qa_gerrithub_change=refs/changes/29/1188429/50"
$ ansible-playbook deploy-edpm.yml --extra-vars 'cifmw_run_tests=true cifmw_run_test_role=shiftstack cifmw_test_operator_stages=[] cifmw_openshift_kubeconfig={{ ansible_user_dir }}/.kube/config cifmw_run_test_shiftstack_testconfig=["4.17_ovnkubernetes_ipi.yaml","4.17_ovnkubernetes_upi.yaml"] cifmw_shiftstack_qa_gerrithub_change=refs/changes/29/1188429/50'

Copy link
Contributor

Choose a reason for hiding this comment

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

We'll address this in a follow up patch, so ok from shiftstack side!

@lpiwowar
Copy link
Contributor

/lgtm

Thank you @eshulman2 for sticking with this! I know it has been quite a lot of work. Kudos to you!:)

We agreed with @eurijon and @eshulman2 that we are going to address the mild fix in another PR. If nobody proposes one till tomorrow then I'll probably propose it. I do not want this to be forgotten. Also, the README should be a source of truth.

@openshift-ci openshift-ci bot added the lgtm label Dec 16, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 3b95d56 into openstack-k8s-operators:main Dec 16, 2024
5 checks passed
lpiwowar added a commit to lpiwowar/test-operator that referenced this pull request Dec 17, 2024
With this PR in the test-operator role [1] we introduced the concept of
stages. By default only tempest stage is enabled. In order for us to
continue to test tobiko and ansibletest CR we have to explicitly enable
the testing via the cifmw_test_operator_stages parameter.

[1] openstack-k8s-operators/ci-framework#2374
lpiwowar added a commit to lpiwowar/test-operator that referenced this pull request Dec 18, 2024
With this PR in the test-operator role [1] we introduced the concept of
stages. By default only tempest stage is enabled. In order for us to
continue to test tobiko and ansibletest CR we have to explicitly enable
the testing via the cifmw_test_operator_stages parameter.

[1] openstack-k8s-operators/ci-framework#2374
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants