-
Notifications
You must be signed in to change notification settings - Fork 43
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
Actually test that logs are flowing to sd-log #1087
Conversation
tests/test_log_vm.py
Outdated
# TODO: test a sd-viewer based dispVM | ||
for vm_name in ["sd-app", "sd-devices", "sd-proxy", "sd-gpg"]: | ||
# The sudo call will make it into syslog | ||
subprocess.check_call(["qvm-run", vm_name, f"sudo echo {token}"]) | ||
|
||
# Now look in the log files to find the token | ||
for vm_name in ["sd-app", "sd-devices", "sd-proxy"]: | ||
contents = self._get_file_contents(f"/home/user/QubesIncomingLogs/{vm_name}/syslog.log") | ||
self.assertIn(token, contents) | ||
|
||
# But nothing for sd-gpg | ||
self.assertFalse(self._fileExists("/home/user/QubesIncomingLogs/sd-gpg/syslog.log")) |
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.
Do you see any point in parameterizing this now, such that either:
- we have sets
logs_expected_from
andlogs_not_expected_from
that we enforce; or even - we have a set
log_expected_from
that we check strictly against all the VMs on the system?
(2) might well be overkill, but these are the two possibilities that occurred to me.
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.
Yeah, I think that's a good idea, let me see...
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.
Done! There's one todo about sd-viewer, because we can't actually run/start sd-viewer, we have to use a disposable based on it. There's a workaround for it in the sd-viewer tests, but it's not reusable yet. Once we're pytest and can have easily shared fixtures, it should be trivial.
7d0d41a
to
a0027c4
Compare
The test failure looks legit...I suspect there could easily be a race condition since we run the command and then immediately look for it in the logs. |
a0027c4
to
e779ae5
Compare
I've switched it back to the original style of one loop to run the command, and then another loop to check the results, which hopefully avoids the race condition (I must've ran this 10-15 times when originally writing the tests with no issues). It's possible CI is worse because the VM has less resources than a physical machine. If this doesn't solve it, we could 1) add a small |
Looks like this is now conflicted, @legoktm, but I'll be happy to re-review and merge tomorrow. |
Instead of checking that a folder exists, we now trigger a log entry in all VMs and then look for that log entry in the logs. We also verify that sd-gpg, sd-log and sd-whonix logs are *not* flowing.
e779ae5
to
19ee2cc
Compare
Rebased. |
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.
Thanks, @legoktm.
Status
Ready for review
Description of Changes
Instead of checking that a folder exists, we now trigger a log entry in all VMs and then look for that log entry in the logs.
We also verify that sd-gpg, sd-log and sd-whonix logs are not flowing.
Testing
Deployment
Any special considerations for deployment? n/a
Checklist
make test
) pass indom0