-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
xds: enable race detector and some small cleanup #9461
Conversation
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!
TODO: remove the last commit about extracting an authorize function, and move that to a new PR. We may not have any tests of the ACL tokens, so add one in the new PR. Edit: moved to #9529 |
small cleanup in tests
TestEnvoy.Close used e.stream.recvCh == nil to indicate the channel had already been closed, so that TestEnvoy.Close can be called multiple times. The recvCh was not protected by a lock, so setting it to nil caused a data race with any goroutine trying to read from the channel. Instead set the stream to nil. The stream is guarded by a lock, so it does not race. This change allows us to test the agent/xds package using -race.
Requiring a call to initialize to set a single field is not really substantially different from having to set that field to a value.
9181a05
to
a04cefa
Compare
🍒 If backport labels were added before merging, cherry-picking will start automatically. To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/306904. |
🍒 If backport labels were added before merging, cherry-picking will start automatically. To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/306933. |
🍒✅ Cherry pick of commit 6f996ad onto |
xds: enable race detector and some small cleanup
One commit related to #8329
Mostly some minor cosmetic cleanup as I was reading over this code again. Also fixed what seems to be the only data race in the
agent/xds
package, which allows us to run the tests withgo test -race
.Best viewed by individual commit.