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

cleanup(virtctl): More robust VM decoding and minor cleanups in create vm unit and func tests #12794

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

Conversation

0xFelix
Copy link
Member

@0xFelix 0xFelix commented Sep 11, 2024

What this PR does

Make VM decoding a little more robust by using runtime.Decode and apply
some minor cleanups throughout the test files.

In the func tests use the instancetype and preference builders to
construct resources and drop the no longer required workaround in
createVMWithRWOVolume. Also use testsuite.GetTestNamespace(nil) where
appropriate.

Before this PR:

After this PR:

Fixes #

Why we need it and why it was done in this way

The following tradeoffs were made:

The following alternatives were considered:

Links to places where the discussion took place:

Special notes for your reviewer

Merge after #12754

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

None

Cleanup the virtctl create preference unit tests by:

- Reorganizing tests
- Removing redundant table entry arguments

Signed-off-by: Felix Matouschek <[email protected]>
Cleanup the virtctl create instancetype unit tests by:

- Reorganizing tests
- Adding missing test cases
- Removing redundant table entry arguments

Signed-off-by: Felix Matouschek <[email protected]>
Export the ValidatePreferenceSpec func to be consistent with
instancetype-admitter.go and to allow use of the validation logic in
other places.

Signed-off-by: Felix Matouschek <[email protected]>
Valdidate the specs of created instancetypes and preferences by calling
ValidateInstanceTypeSpec and ValidatePreferenceSpec, which are also
used by the validating admitters.

Signed-off-by: Felix Matouschek <[email protected]>
…ests

Drop the functional tests of virtctl create instancetype and virtctl
create preference because all tests cases are already covered by the
unit tests of the commands. The functional tests do not provide any
additional value.

Signed-off-by: Felix Matouschek <[email protected]>
Make VM decoding a little more robust by using runtime.Decode and apply
some minor cleanups throughout the test file.

Signed-off-by: Felix Matouschek <[email protected]>
Make VM decoding a little more robust by using runtime.Decode and apply
some minor cleanups throughout the test file.

Use the instancetype and preference builders to construct resources and
drop the no longer required workaround in createVMWithRWOVolume. Also
use testsuite.GetTestNamespace(nil) where appropriate.

Signed-off-by: Felix Matouschek <[email protected]>
@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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 11, 2024
@kubevirt-bot
Copy link
Contributor

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.

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign davidvossel for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@0xFelix
Copy link
Member Author

0xFelix commented Sep 11, 2024

/hold Merge after #12754

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 11, 2024
@dosubot dosubot bot added the sig/testing label Sep 11, 2024
@kubevirt-bot
Copy link
Contributor

@0xFelix: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubevirt-e2e-arm64 e09895d link false /test pull-kubevirt-e2e-arm64
pull-kubevirt-e2e-k8s-1.31-sig-compute e09895d link true /test pull-kubevirt-e2e-k8s-1.31-sig-compute
pull-kubevirt-e2e-k8s-1.29-sig-performance e09895d link true /test pull-kubevirt-e2e-k8s-1.29-sig-performance
pull-kubevirt-fuzz e09895d link false /test pull-kubevirt-fuzz
pull-kubevirt-check-tests-for-flakes e09895d link false /test pull-kubevirt-check-tests-for-flakes
pull-kubevirt-e2e-k8s-1.31-sig-operator e09895d link true /test pull-kubevirt-e2e-k8s-1.31-sig-operator
pull-kubevirt-e2e-k8s-1.31-sig-storage e09895d link true /test pull-kubevirt-e2e-k8s-1.31-sig-storage
pull-kubevirt-e2e-k8s-1.31-sig-network e09895d link true /test pull-kubevirt-e2e-k8s-1.31-sig-network
pull-kubevirt-e2e-k8s-1.31-sig-compute-migrations e09895d link true /test pull-kubevirt-e2e-k8s-1.31-sig-compute-migrations
pull-kubevirt-unit-test-s390x e09895d link true /test pull-kubevirt-unit-test-s390x
pull-kubevirt-e2e-k8s-1.31-sig-compute-serial e09895d link true /test pull-kubevirt-e2e-k8s-1.31-sig-compute-serial
pull-kubevirt-build e09895d link true /test pull-kubevirt-build
pull-kubevirt-build-arm64 e09895d link true /test pull-kubevirt-build-arm64
pull-kubevirt-client-python e09895d link true /test pull-kubevirt-client-python
pull-kubevirt-apidocs e09895d link true /test pull-kubevirt-apidocs
pull-kubevirt-generate e09895d link true /test pull-kubevirt-generate
pull-kubevirt-goveralls e09895d link false /test pull-kubevirt-goveralls
pull-kubevirt-prom-rules-verify e09895d link true /test pull-kubevirt-prom-rules-verify
pull-kubevirt-build-s390x e09895d link true /test pull-kubevirt-build-s390x
pull-kubevirt-code-lint e09895d link true /test pull-kubevirt-code-lint
pull-kubevirt-unit-test e09895d link true /test pull-kubevirt-unit-test
pull-kubevirt-verify-go-mod e09895d link true /test pull-kubevirt-verify-go-mod
pull-kubevirt-manifests e09895d link true /test pull-kubevirt-manifests
pull-kubevirt-fossa e09895d link true /test pull-kubevirt-fossa
pull-kubevirt-check-unassigned-tests e09895d link true /test pull-kubevirt-check-unassigned-tests

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.

@0xFelix
Copy link
Member Author

0xFelix commented Sep 11, 2024

/sig code-quality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/instancetype area/virtctl dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. sig/code-quality sig/compute sig/testing size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants