-
Notifications
You must be signed in to change notification settings - Fork 911
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
chore: fix unit test data races (#3478) #3479
chore: fix unit test data races (#3478) #3479
Conversation
Go Published Test Results2 144 tests 2 144 ✅ 2m 51s ⏱️ Results for commit c8cff22. ♻️ This comment has been updated with latest results. |
E2E Tests Published Test Results 4 files 4 suites 3h 46m 4s ⏱️ For more details on these failures, see this check. Results for commit c8cff22. ♻️ This comment has been updated with latest results. |
a968c7d
to
8a09d13
Compare
Signed-off-by: Jonathan West <[email protected]>
8a09d13
to
c8cff22
Compare
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3479 +/- ##
==========================================
+ Coverage 81.83% 82.78% +0.94%
==========================================
Files 135 135
Lines 20688 17025 -3663
==========================================
- Hits 16931 14094 -2837
+ Misses 2883 2041 -842
- Partials 874 890 +16 ☔ View full report in Codecov by Sentry. |
chore: fix unit test data races Signed-off-by: Jonathan West <[email protected]>
Fixes #3478
See parent issue for reproduction steps.
With this set of changes,
go test -race (...)
now passes:(I also used this shell script to run the tests over and over for several hours, to ensure there are not remaining intermittent failures).
Data races fixed
Unsynchronized read/write to 'callbacks' within
pkg/kubectl-argo-rollouts/viewcontroller/viewcontroller.go
Unsynchronized read/writes to 'rolloutUpdates' within
pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go
:Unsynchronized read/write to 'enqueuedObjects' in various test functions
Unsynchronized read/write to
utils/time
's Now global variable, which is used by unit tests to simulate time changes by replacing default time.Now()Ambassador unit test's fake client was allowing unintended modification of the mock object in memory, via k8s client Get() function
APISix unit tests cannot be parallelized, due to the use of 4 global test variables that are shared between test threads in
rollout/trafficrouting/apisix/mocks/apisix.go
:Fix:
APIsix unit tests cannot share a single, global reference to
client *mocks.FakeClient
, when parallelizedTraefik unit tests also cannot share a single, global reference to
client *mocks.FakeClient
, when parallelizedTraefik unit tests cannot be parallelized, due to the use of 2 global test variables that are shared between test threads in
rollout/trafficrouting/traefik/mocks/traefik.go
:Fix:
Unsynchronized read/write to events in
FakeEventRecorder
A small number of miscellaneous tests that were not using mutexes when read/writing between go routines
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.