Skip to content

Commit a2329a6

Browse files
committed
test: Patch journal.stream so the output of qemu process is shown in the test output
1 parent 207b4d3 commit a2329a6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/supervisor/test_instance.py

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ async def test_create_firecracker_instance(mocker):
6363
mocker.patch.object(settings, "FAKE_DATA_PROGRAM", settings.BENCHMARK_FAKE_DATA_PROGRAM)
6464
mocker.patch.object(settings, "USE_JAILER", True)
6565

66+
# Patch journal.stream so the output of qemu proecss is shown in the test output
67+
mocker.patch("aleph.vm.hypervisors.firecracker.microvm.journal.stream", return_value=None)
6668
# logging.basicConfig(level=logging.DEBUG)
6769

6870
# Ensure that the settings are correct and required files present.

tests/supervisor/test_qemu_instance.py

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ async def test_create_qemu_instance(mocker):
6060
mocker.patch.object(settings, "ENABLE_CONFIDENTIAL_COMPUTING", False)
6161
mocker.patch.object(settings, "USE_JAILER", False)
6262

63+
# Patch journal.stream so the output of qemu proecss is shown in the test output
64+
mocker.patch("aleph.vm.hypervisors.qemu.qemuvm.journal.stream", return_value=None)
65+
6366
if not settings.FAKE_INSTANCE_BASE.exists():
6467
pytest.xfail(
6568
"Test Runtime not setup. run `cd runtimes/instance-rootfs && sudo ./create-debian-12-qemu-disk.sh`"
@@ -102,6 +105,7 @@ async def test_create_qemu_instance(mocker):
102105
qemu_execution, process = await mock_systemd_manager.enable_and_start(execution.controller_service)
103106
assert isinstance(qemu_execution, QemuVM)
104107
assert qemu_execution.qemu_process is not None
108+
await asyncio.sleep(30)
105109
await mock_systemd_manager.stop_and_disable(execution.vm_hash)
106110
await qemu_execution.qemu_process.wait()
107111
assert qemu_execution.qemu_process.returncode is not None
@@ -121,6 +125,9 @@ async def test_create_qemu_instance_online(mocker):
121125
mocker.patch.object(settings, "ENABLE_CONFIDENTIAL_COMPUTING", False)
122126
mocker.patch.object(settings, "USE_JAILER", False)
123127

128+
# Patch journal.stream so the output of qemu process is shown in the test output
129+
mocker.patch("aleph.vm.hypervisors.qemu.qemuvm.journal.stream", return_value=None)
130+
124131
if not settings.FAKE_INSTANCE_BASE.exists():
125132
pytest.xfail(
126133
"Test instance disk {} not setup. run `cd runtimes/instance-rootfs && sudo ./create-debian-12-qemu-disk.sh` ".format(

0 commit comments

Comments
 (0)