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

sourcemap: fix data race in test #5842

Merged
merged 1 commit into from
Aug 2, 2021
Merged

Conversation

axw
Copy link
Member

@axw axw commented Aug 2, 2021

Motivation/summary

Fix data race in TestFleetFetch: as there are two servers, one may update hasAuth concurrently with the test checking the value.

Change the way the auth header is checked to be similar to how the header would be checked in a real fleet-server, and respond with 401 if the auth header is invalid. Since we wait for a valid response, we can be sure the header has been checked.

Checklist

- [ ] Update CHANGELOG.asciidoc
- [ ] Documentation has been updated

How to test these changes

go test -v -race -count=50 -failfast -run TestFleetFetch

Related issues

https://apm-ci.elastic.co/blue/organizations/jenkins/apm-server%2Fapm-server-mbp/detail/PR-5840/2/tests/

Fix data race in TestFleetFetch: as there are two
servers, one may update hasAuth concurrently with
the test checking the value.

Change the way the auth header is checked to be
similar to how the header would be checked in a
real fleet-server, and respond with 401 if the
auth header is invalid.
@apmmachine
Copy link
Contributor

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-08-02T03:23:20.489+0000

  • Duration: 40 min 26 sec

  • Commit: f89472e

Test stats 🧪

Test Results
Failed 0
Passed 5934
Skipped 14
Total 5948

Trends 🧪

Image of Build Times

Image of Tests

@axw axw requested a review from a team August 2, 2021 04:17
@axw axw merged commit 710d4ed into elastic:master Aug 2, 2021
@axw axw deleted the sourcemap-test-race branch August 2, 2021 05:34
mergify bot pushed a commit that referenced this pull request Aug 2, 2021
Fix data race in TestFleetFetch: as there are two
servers, one may update hasAuth concurrently with
the test checking the value.

Change the way the auth header is checked to be
similar to how the header would be checked in a
real fleet-server, and respond with 401 if the
auth header is invalid.

(cherry picked from commit 710d4ed)

# Conflicts:
#	sourcemap/fleet_store_test.go
axw added a commit to axw/apm-server that referenced this pull request Aug 2, 2021
Fix data race in TestFleetFetch: as there are two
servers, one may update hasAuth concurrently with
the test checking the value.

Change the way the auth header is checked to be
similar to how the header would be checked in a
real fleet-server, and respond with 401 if the
auth header is invalid.
axw added a commit that referenced this pull request Aug 3, 2021
Fix data race in TestFleetFetch: as there are two
servers, one may update hasAuth concurrently with
the test checking the value.

Change the way the auth header is checked to be
similar to how the header would be checked in a
real fleet-server, and respond with 401 if the
auth header is invalid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants