Open arianvp opened 5 years ago
This happens because oneshots go from inactive -> activating -> inactive
and never reach the active
state unless RemainAfterExit=true
It is hard to capture the activating -> inactive
transition by just polling the CLI. A more healthy
solution would be to use the DBus API to listen to the appropriate unit events such that we can very clearly capture changes in unit states. But that would mean a substantial rewrite of our testing infrastructure. Maybe someone knows something simpler
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
Just to please the stale bot gods: I just encountered the same error. We should still consider fixing it / coming up with a solution for it.
I did an attempt on this during last years NixCon.
The main idea was to somehow forward the Dbus system socket from outside the VM, so it's accessible from the test runner, and having something watch for events, instead of doing polling.
This never really went anywhere, but if someone would be up to experimenting with this, please speak up :-)
I marked this as stale due to inactivity. → More info
still relevant.
I marked this as stale due to inactivity. → More info
Still relevant
Very very relevant. Do we have any other way of fixing this ?
Listening to DBUS is one way to fix it. Maybe looking at journalctl ?
Issue description
$machine->waitForUnit(<oneshot>)
fails when waiting for a unit that doesn't linger after activating. I need a way to test that a oneshot fired, but I currently can't do that.Steps to reproduce
The following test https://github.com/NixOS/nixpkgs/commit/55fb87d2b871db9f4bcb0e79651acf0228c9de52
fails with:
eventhough the oneshot did fire
Technical details
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the results.