I have a pkgs.nixosTest
that runs on a single machine with the following testScript
:
testScript = ''
start_all()
try:
machine.succeed("some program that creates a log file", timeout=300)
finally:
machine.copy_from_vm("logfile")
'';
When the test completes successfully, the log gets copied to the store and I can access it after building the test. However, if it times out, it appears that machine
dies before it can copy out the log. I have also tried the following:
status, _ = machine.execute("some program that creates a log file", timeout=300)
machine.copy_from_vm("logfile")
if status:
raise Exception(f"Program failed with status {status}")
However, as before, the issue is that the log won’t be copied if the operation times out.
What is the “correct” way to copy logs off of the machine before it dies?