-
Notifications
You must be signed in to change notification settings - Fork 148
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
Enable race detection in unit tests #264
Enable race detection in unit tests #264
Conversation
@@ -33,7 +33,7 @@ jobs: | |||
|
|||
- name: Go test | |||
if: ${{ matrix.goarch }} == "amd64" | |||
run: sudo go test ./... # sudo needed for netns change in test | |||
run: sudo go test -race ./... # sudo needed for netns change in test |
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 also saw there is a an option in the Makefile to run the tests with the race flag ( make test-race).
I wasn't sure why the CI doesn't use the Makefile to run the tests - so i decided to do minimal changes. But if there isn't any reason not to use the option in the Makefile i think its better to use it.
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.
Test rules in Makefile need cleaning, but they can be done in a different PR.
This change updates "Go test" step in buildtest.yml to include the '-race' flag, enabling race detection in the CI during testing. Signed-off-by: Alina Sudakov <asudakov@redhat.com>
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.
LGTM
Thanks for working on this @AlinaSecret
@@ -33,7 +33,7 @@ jobs: | |||
|
|||
- name: Go test | |||
if: ${{ matrix.goarch }} == "amd64" | |||
run: sudo go test ./... # sudo needed for netns change in test | |||
run: sudo go test -race ./... # sudo needed for netns change in test |
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.
Test rules in Makefile need cleaning, but they can be done in a different PR.
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.
LGTM
Pull Request Test Coverage Report for Build 5004616867Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
This pull request enables race detection in unit tests by modifying the Go test step in buildtest.yml. The test configuration is updated to include the '-race' flag, allowing thorough race detection during testing.
Race detection can help identifying potential data race conditions, which can lead to hard-to-debug issues in concurrent code. By enabling race detection in our unit tests, we can detect and address these race conditions, ensuring the reliability and stability of our code. (for further reference view: https://go.dev/doc/articles/race_detector)