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

Refactor "can gzip requests" spec to fix race condition #577

Merged
merged 1 commit into from Apr 17, 2023

Conversation

willkoehler
Copy link
Contributor

Fixes #569

This spec had a race condition caused by the date and time in the "local file header" of the zip file. See https://en.wikipedia.org/wiki/ZIP_(file_format)#File_headers

This could result in the zip file that we compute during the test to be different from the zip file that the transporter sends in the HTTP request. This in turn caused stub_request(:post, url) to not match the request made in the transporter.

By asserting that decompressing the transporter's request body results in the original JSON, we avoid this race condition and clarify the intention of the test assertion.

Fixes MiniProfiler#569
@nateberkopec
Copy link
Collaborator

Thank you so much for your detailed dive into this @willkoehler! 🙇

@nateberkopec nateberkopec merged commit 45027b5 into MiniProfiler:master Apr 17, 2023
5 checks passed
@willkoehler willkoehler deleted the fix-569 branch June 19, 2023 19:17
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.

Intermittent test failure
2 participants