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

fix: make unit-tests can be called more than once #594

Merged

Conversation

nestoracunablanco
Copy link
Contributor

To enable running the unit tests multiple times, the existing templates are deleted before creating new ones. This approach allows for the successful execution of unit tests even if the templates already exist in the cluster.

If the templates do not exist, the 'oc delete' command would fail, which is why '|| true' is used.

What this PR does / why we need it: ability to run unit tests consecutively

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:


@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jul 26, 2024
Copy link

openshift-ci bot commented Jul 26, 2024

Hi @nestoracunablanco. Thanks for your PR.

I'm waiting for a kubevirt member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 26, 2024
@jcanocan
Copy link

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 26, 2024
@jcanocan
Copy link

Nice catch @nestoracunablanco! These small details are always tricky.
/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2024
@@ -25,6 +25,8 @@ for template in $templates; do
oc process -f "$template" NAME=test DATA_SOURCE_NAME=test || exit 1
done

echo "generate all templates after cleaning up first"
oc delete -f dist/templates || true
Copy link
Member

Choose a reason for hiding this comment

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

This would not delete templates which differ from the ones in dist/templates (see L51). What about deleting the namespace that was created above after a test run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2024
In order to run the unit tests multiple times, the kubevirt
namespace will be removed before new templates are created. This
method ensures that unit tests can be executed successfully, even
if the templates already exist in the cluster.

If the namespace does not exist, the 'oc delete' command would
fail, hence the use of '|| true' to handle this scenario.

Signed-off-by: Nestor Acuna Blanco <nestor.acuna@ibm.com>
@nestoracunablanco
Copy link
Contributor Author

/retest

3 similar comments
@nestoracunablanco
Copy link
Contributor Author

/retest

@nestoracunablanco
Copy link
Contributor Author

/retest

@nestoracunablanco
Copy link
Contributor Author

/retest

Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 0xFelix

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2024
@jcanocan
Copy link

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 29, 2024
@kubevirt-bot kubevirt-bot merged commit 73c6fa0 into kubevirt:master Jul 29, 2024
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants