-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
For goveralls fix races in unit tests #5262
For goveralls fix races in unit tests #5262
Conversation
Skipping CI for Draft Pull Request. |
/test pull-kubevirt-goveralls |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
/test pull-kubevirt-unit-test |
/test pull-kubevirt-goveralls |
This seems like a hard nut to crack. I've done several test runs, and seen sometimes several data races in one run (especially regarding |
|
85e9cfb
to
7957088
Compare
7957088
to
252af94
Compare
/test pull-kubevirt-unit-test |
80c5b2f
to
b541dbe
Compare
/test pull-kubevirt-unit-test |
kubevirt_test.go data races seem to have gone with the changes. |
/test pull-kubevirt-unit-test |
8e7c8d7
to
f37f65e
Compare
/test pull-kubevirt-unit-test |
|
Signed-off-by: Roman Mohr <rmohr@redhat.com>
Signed-off-by: Roman Mohr <rmohr@redhat.com>
Signed-off-by: Roman Mohr <rmohr@redhat.com>
Signed-off-by: Daniel Hiller <dhiller@redhat.com>
Example: KUBEVIRT_FOCUS="On valid KubeVirt object" \ KUBEVIRT_EXTRA_ARGS="--runs_per_test=5 --test_output=all --cache_test_results=no" \ KUBEVIRT_TARGETS="//pkg/virt-operator:*" make test Signed-off-by: Daniel Hiller <dhiller@redhat.com>
Create a test data struct in order to separate the required test state (mocks, recording structures etc) from the actual run, so we do not share state between tests anymore. This eliminates the data races. Also add the behavior to the struct so that it uses the test state and not the shared state. Increase timeouts for tests that regularly fail on parallel execution. Signed-off-by: Daniel Hiller <dhiller@redhat.com>
See https://docs.bazel.build/versions/master/test-encyclopedia.html#role-of-the-test-runner Also add the test.log output to the artifacts for having more information. Signed-off-by: Daniel Hiller <dhiller@redhat.com>
Also add ctrl.Finish() and do expect call before changing the mock handler. Signed-off-by: kubevirt-bot <kubevirtbot@redhat.com>
e5cfa24
to
c4e7df3
Compare
/test pull-kubevirt-unit-test |
c4e7df3
to
e9e0f43
Compare
/test pull-kubevirt-unit-test |
Also increase go_default_test timeout to "long" for virt-handler tests. Signed-off-by: Daniel Hiller <dhiller@redhat.com>
e9e0f43
to
19756a4
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
/test pull-kubevirt-unit-test |
/test pull-kubevirt-goveralls |
testing When investigating I found some strange error compiling
Here's the test patch file: https://gist.github.com/dhiller/b51bca27d96b35f27b9fdad8dc30396d Complete error:
@rmohr any ideas? |
Signed-off-by: Daniel Hiller <dhiller@redhat.com>
unsafeptr fails in vendored dependencies. Signed-off-by: Daniel Hiller <dhiller@redhat.com>
/test pull-kubevirt-unit-test |
@dhiller: 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/test-infra repository. I understand the commands that are listed here. |
@dhiller: 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/test-infra repository. |
What this PR does / why we need it:
This PR picks up the original fixes for data races from @rmohr .
Furthermore it addresses the data races that are getting visible for
kubevirt_test.go
when the tests are run in parallel, i.e. when using bazel options like this:--runs_per_test=4 --cache_test_results=no
In that case i.e. several data races got visible. This was addressed by isolating the test data (mocks, recording data structures etc.) into a separate struct that is created per test, in order to isolate data access of each test. Also the function lambdas were attached to the struct to use the data from the test data struct.Finally this PR makes available some of the bazel options so that they can be used when calling
make test
Example:
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 #5313
Special notes for your reviewer:
I think we can improve the readability and interface of the created struct in a fluent interface way in order to improve reading the test code. But the changes here are required to enable the goveralls lane, so I would prefer to do this in a second PR.
Example:
Release note: