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

Conformance headless #12990

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

Conversation

xpivarc
Copy link
Member

@xpivarc xpivarc commented Oct 2, 2024

What this PR does

1 .Covers headless tests in Conformance tests
2. Removes tests that don't bring value
3. Converts e2e tests to unit tests
4. Make sure that only relevant tests are in the vmi_headless_test.go

Fixes #

Special notes for your reviewer

Release note

NONE

@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 ask for approval from xpivarc. 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

@kubevirt-bot kubevirt-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Oct 2, 2024
@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Oct 2, 2024
@dosubot dosubot bot added the sig/testing label Oct 2, 2024
Copy link
Member

@dankenigsberg dankenigsberg left a comment

Choose a reason for hiding this comment

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

Thanks for this, and your other Conformance PRs.

It("[Serial] multiple HTTP calls should re-use connections and not grow the number of open connections", Serial, func() {

getHandlerConnectionCount := func(nodeName string) int {
cmd := []string{"bash", "-c", fmt.Sprintf("ss -ntlap | grep %d | wc -l", virt_api.DefaultConsoleServerPort)}
Copy link
Member

Choose a reason for hiding this comment

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

nit: this would fail if an unrelated process has 8186 in its name or listens to 18186 or if virt-handler is configured to use non-default port.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right and is why I don't include it in Conformance set. Regarding the other process listening, I doubt as we should have our own net ns. But the non-default port is true case.

*
*/

package tests_test
Copy link
Member

Choose a reason for hiding this comment

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

This PR is only moving an existing test, but still:
virt-handler is not part of the KubeVirt API, so testing that it does not leak a specific kind of TCP connections does not really belong in an end-to-end test.

Can this be generalized to check that kubevirt components do not leak sockets/memory/files/whatnot during the entire suite?

If you decide to keep it here, can you place it under its own package? tests_test is a generic and misleading name.

Copy link
Member Author

Choose a reason for hiding this comment

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

This test was added as part of found regression and I marked it as such. I believe it is useful for the project but I agree it is not really e2e. I think we need to bring this up this discussion on how we want to group tests... but I like to keep it out of this PR

Copy link
Member

Choose a reason for hiding this comment

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

The test may be useful to protect against a recurrence of a specific regression, but it is not a good test. It has a very strong dependency on implementation details and leaves out other leaks untested.

Splitting tests to sensible packages and owning teams urgently needed - but it can wait form another PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

but it can wait form another PR.

Thanks

tests/vmi_headless_test.go Show resolved Hide resolved
@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 3, 2024
Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
Unit test "and not add the graphics and video device if it is set to false on amd64"
in converter_test.go is covering this scenario.

Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
These tests don't relate to Headless VMs

Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
1. The test name is missleading as Pod should have
more memory if it has graphic device, not the other
way around.

2. The test is covered by unit test in template_test.go
"should check autoattachGraphicsDevicse and
consider graphics overhead if it is not set on amd64" and
other variants.

Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
The test showcase expected behavior for
user therefore let's cover it in Conformance.

As part of this commit we also merge the console test
as these tests are not cheap.

Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
This e2e is only counting number of vncs. This
can be tested by unit test.

Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
The test "multiple HTTP calls should re-use connections and
not grow the number of open connections" doesn't have correlation
with headless VMs. Therefore move it to its own file.

Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
@kubevirt-bot kubevirt-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 4, 2024
@kubevirt-bot
Copy link
Contributor

kubevirt-bot commented Oct 4, 2024

@xpivarc: The following test 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-check-unassigned-tests 57fde4d 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.


memDiff := normalComputeContainer.Resources.Requests.Memory()
memDiff.Sub(*computeContainer.Resources.Requests.Memory())
It("[test_id:738][posneg:negative]should not connect to VNC but still be able to connect to console", decorators.Conformance, func() {
Copy link
Member

Choose a reason for hiding this comment

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

sorry for not thinking of this in my first review, but I don't think this merits inclusion in decorators.Conformance. We already unittest that no vnc device is passed to libvirt. I'm not sure we must test libvirt not to invent a graphic device, or test that Alpine boots without a graphic device. But I am certain it does not belong in our slim, do-or-die, conformance suite.

I believe that every test that is added to Conformance should have a strong reason described in the commit message. The current explanation

The test showcase expected behavior for
user therefore let's cover it in Conformance.

can be applied to every proper e2e test.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I must confess I haven't think about this in this way. I was more focused on the fact that we would cover the expected behavior when user defines VMI with

...
autoattachGraphicsDevice : false  
...

so at least I should change the reasoning...

I believe that every test that is added to Conformance should have a strong reason described in the commit message.

Agree, I think generally the Conformance test should cover the expected behavior of the API (this test would therefore fit), thinks I don't see as such are:

  1. Every permutation
  2. Edge cases
  3. Negative tests or more what the API doesn't mean, in other words we should define the API in terms of what it does and not what it doesn't do...

Would you keep it with the reason of covering the expected behavior of the API field?

Copy link
Member

Choose a reason for hiding this comment

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

Would you keep it with the reason of covering the expected behavior of the API field?

I really don't like the fact that our API has defaults and the flags to disable the defaults, and defaults for the flags. It's two complex for humans to follow.

IMO autoattachGraphicsDevice=false is an edge case, that is properly tested by unit tests. The code here tests the the API does not create a device. I see no urgent need to pay time, electricity and labor to test it in every time we run Compliance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. release-note-none Denotes a PR that doesn't merit a release note. sig/testing size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants