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

Fix flaky qrexec agent tests #144

Merged
merged 2 commits into from
Apr 14, 2024
Merged

Conversation

DemiMarie
Copy link
Contributor

Various tests assumed that qrexec would deliver stdout in a single message. Qrexec does not make this guarantee: calls to write(2), send(2), sendmsg(2), etc are not guaranteed to correspond 1-to-1 to MSG_DATA_STDOUT messages on the vchan. This caused https://gitlab.com/QubesOS/qubes-core-qrexec/-/jobs/6616564043 to wrongly fail, even thouggh the code is correct.

Fix this problem by concatenating the payloads of all stdout messages into a single bytes object before comparing with the expected stdout value. Also add a utility function for this, saving a lot of code in tests.

Use a utility function for doing so, instead of open-coding the checks.
Some code goes away.
Various tests assumed that qrexec would deliver stdout in a single
message.  Qrexec does not make this guarantee: calls to write(2),
send(2), sendmsg(2), etc are not guaranteed to correspond 1-to-1
to MSG_DATA_STDOUT messages on the vchan.  This caused
https://gitlab.com/QubesOS/qubes-core-qrexec/-/jobs/6616564043 to
wrongly fail, even thouggh the code is correct.

Fix this problem by concatenating the payloads of all stdout messages
into a single bytes object before comparing with the expected stdout
value.  Also add a utility function for this, saving a lot of code in
tests.
Copy link

codecov bot commented Apr 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.83%. Comparing base (2be9adc) to head (dfd804f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #144      +/-   ##
==========================================
+ Coverage   76.81%   76.83%   +0.01%     
==========================================
  Files          52       52              
  Lines        9111     9103       -8     
==========================================
- Hits         6999     6994       -5     
+ Misses       2112     2109       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marmarek marmarek merged commit daee92e into QubesOS:main Apr 14, 2024
4 checks passed
@DemiMarie DemiMarie deleted the fix-flaky-test branch April 14, 2024 16:25
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.

2 participants