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

xds: enable race detector and some small cleanup #9461

Merged
merged 4 commits into from
Jan 7, 2021
Merged

Conversation

dnephin
Copy link
Contributor

@dnephin dnephin commented Dec 23, 2020

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 with go test -race.

Best viewed by individual commit.

@dnephin dnephin added the theme/envoy/xds Related to Envoy support label Dec 23, 2020
@dnephin dnephin requested review from a team December 23, 2020 18:44
@github-actions github-actions bot added the type/ci Relating to continuous integration (CI) tooling for testing or releases label Dec 23, 2020
Copy link
Member

@hanshasselberg hanshasselberg left a comment

Choose a reason for hiding this comment

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

LGTM!

@dnephin
Copy link
Contributor Author

dnephin commented Jan 6, 2021

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.
@dnephin dnephin merged commit 6f996ad into master Jan 7, 2021
@dnephin dnephin deleted the dnephin/xds-server branch January 7, 2021 23:29
@hashicorp-ci
Copy link
Contributor

🍒 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.

@hashicorp-ci
Copy link
Contributor

🍒 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.

@hashicorp-ci
Copy link
Contributor

🍒✅ Cherry pick of commit 6f996ad onto release/1.9.x succeeded!

hashicorp-ci pushed a commit that referenced this pull request Jan 7, 2021
xds: enable race detector and some small cleanup
@dnephin dnephin mentioned this pull request Jun 11, 2021
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/envoy/xds Related to Envoy support type/ci Relating to continuous integration (CI) tooling for testing or releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants