-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Conformance tests for vm_test.go #12682
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
/cc @xpivarc |
390fffc
to
92f436f
Compare
tests/vm_test.go
Outdated
vmi.Spec.Domain.Resources.Requests = k8sv1.ResourceList{ | ||
Entry("[test_id:6867] when VM scheduling error occurs with unsatisfiable resource requirements", | ||
libvmi.New( | ||
libvmi.WithContainerDisk("disk0", "no-such-image"), |
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.
Do we actually need the CD?
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 don't think so
tests/vm_test.go
Outdated
@@ -246,7 +245,7 @@ var _ = Describe("[rfe_id:1177][crit:medium][vendor:cnv-qe@redhat.com][level:com | |||
validateGenerationState(vm, 6, 6, 6, 6) | |||
}) | |||
|
|||
DescribeTable("[test_id:1520]should update VirtualMachine once VMIs are up", func(createTemplate vmiBuilder) { | |||
DescribeTable("[test_id:1520]should update VirtualMachine once VMIs are up", decorators.Conformance, func(createTemplate vmiBuilder) { |
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.
Where is the assert 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.
The assertion in the libvmops.StartVirtualMachine
function itself
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.
But what is the update? I am not sure I understand what this test does.
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 update is that the vm.Status.Ready
becomes true. Maybe we can drop this?
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.
Seems like duplicate then...
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.
Yeah! Already dropped in a new commit
tests/vm_test.go
Outdated
@@ -359,6 +358,7 @@ var _ = Describe("[rfe_id:1177][crit:medium][vendor:cnv-qe@redhat.com][level:com | |||
Expect(pod.Name).ToNot(Equal(firstPod.Name)) | |||
}) | |||
|
|||
//TODO does it make sense? |
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.
What are your thoughts?
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 was wondering if this makes sense since we have test_id:1526
that checks stop and start multiple times. WDYT?
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.
Let's drop the comment for now and track it offline
tests/vm_test.go
Outdated
@@ -575,7 +573,7 @@ var _ = Describe("[rfe_id:1177][crit:medium][vendor:cnv-qe@redhat.com][level:com | |||
} | |||
}) | |||
|
|||
It("[test_id:7679]should report an error status when data volume error occurs", func() { | |||
It("[test_id:7679]should report an error status when data volume error occurs", decorators.Conformance, func() { |
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 not use Skip
inside Conformance tests
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.
Removed from the conformance set
92f436f
to
6e041d4
Compare
Thank you for the review @xpivarc. |
a4cbde7
to
de5b441
Compare
Exciting idea!
No doubts that the cleanup and refactoring is required, but I wonder in which way is this is related to the new label? |
Thank you! I have to analyze every test to decide if they are or are not part of the |
No doubts that we should do it and that it is great, I just wonder if it is clean to introduce the change in the PR which is about adding the new label.
No doubts that the changes are highly welcome. |
By nature, |
de5b441
to
a7bad41
Compare
a7bad41
to
68e1a05
Compare
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: xpivarc 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 |
@EdDev can you please have a look at the libvmi |
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.
Looks great, just some nits
vmi.Spec.Domain.Devices.Disks = append(vmi.Spec.Domain.Devices.Disks, v1.Disk{ | ||
Name: "testdisk", | ||
Context("with an invalid VM", func() { | ||
It("should reject the request with unrecognized field", func() { |
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.
@fossedihelm @xpivarc Did we previously ignored unrecognized fields?
Are we sure we need to reject these?
Are we sure that it's not going to affect upgrades?
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.
@vladikr I did not change any behavior here. I just converted the e2e test to unit test :)
So yes, we were rejecting unrecognized fields even before.
It is something that we do for every resource and looks like we have always done it:
93eecf3#diff-37e7f54f2a03b510af54f5d608e432bb0447d09ea6066a9970e0be8beab66649R1214
AFAIK k8s does not allow unrecognized fields as well.
Also, maybe we can perform this instructing openapi, instead of manually doing this 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.
Yes, the fields were rejected as previously the Kube would only ignore the fields. In case of typo the behavior could be different..
Template: &v1.VirtualMachineInstanceTemplateSpec{ | ||
Spec: vmi.Spec, | ||
|
||
It("reject syntax valid VM, but with invalid spec", func() { |
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.
What is invalid in this test?
Is it that a matching volume doesn't exist?
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.
Exactly!
Don't know how but looks like I accidentally deleted this comment:
// Add a disk that doesn't map to a volume.
// This should get rejected which tells us the webhook validator is working.
I will reintroduce it. Thanks
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.
done
a412545
to
34a6947
Compare
The invalid vm spec e2e test can easily be a unit test. We can lower the e2e test time by moving it. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Currently, `WithNodeSelectorFor` takes the pointer to a node to create the nodeSelector field of a vmi. In most of the cases we just have the node name. Indeed, we can see that a dummy node obj is passed to respect the function signature. The node name is enough to achieve what we want. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Signed-off-by: fossedihelm <ffossemo@redhat.com>
Annotations carrying was not covering all the cases. The annotation carrying mechanism should ensure that annotations listed in the vm.spec.template object were propagated, while those listed in the vm objects are discarded. In other words, the vm annotations is not propagated to the vmi. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Currently we have two e2e tests: the first one that checks that a revision is created when a vm starts and the second one that checks that the revision is updated when a vm is restarted. The second one includes all the steps of the first one, so there is no reason to have both. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Signed-off-by: fossedihelm <ffossemo@redhat.com>
Signed-off-by: fossedihelm <ffossemo@redhat.com>
- Unwrap Delete out of Eventually block - Use `GetPodByVirtualMachineInstance` utility function Signed-off-by: fossedihelm <ffossemo@redhat.com>
Check for events rather than logs, which is well-defined API for users compared to logs that is mostly available only to admins. Signed-off-by: fossedihelm <ffossemo@redhat.com>
The test just checks that a vm becomes ready once the vmi is started. This is performed almost in every other tests, so we can drop it. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Signed-off-by: fossedihelm <ffossemo@redhat.com>
Signed-off-by: fossedihelm <ffossemo@redhat.com>
34a6947
to
dde8a54
Compare
/lgtm |
Required labels detected, running phase 2 presubmits: |
@fossedihelm: The following test failed, say
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. |
/retest-required |
Sorry for the late reply, it looks good to me. |
What this PR does
A new label (
conformance
) is introduced and will be used to tag those tests that will be part of the conformance tests.This PR aims to identify and label the tests in the vm_tests.go file.
Also, a cleanup and refactoring of the tests is performed:
This is a starting point for several PRs, whose goal is to cover all the conformance tests.
For the number lovers:
Previous number of e2e tests: 84Current number of e2e tests: 77Conformance e2e tests: 27Fixes #
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
Release note