@@ -25,10 +25,7 @@ class MockSystemDManager(SystemDManager):
2525
2626 async def enable_and_start (self , service : str ) -> tuple [QemuVM | None , Process | None ]:
2727 # aleph-vm-controller@decadecadecadecadecadecadecadecadecadecadecadecadecadecadecadeca.service-controller.json
28- if '@' in service :
29- vm_hash = service .split ('@' , maxsplit = 1 )[1 ].split ('.' , maxsplit = 1 )[0 ]
30- else :
31- vm_hash = service
28+ vm_hash = service .split ("@" , maxsplit = 1 )[1 ].split ("." , maxsplit = 1 )[0 ]
3229
3330 config_path = Path (f"{ settings .EXECUTION_ROOT } /{ vm_hash } -controller.json" )
3431 config = configuration_from_file (config_path )
@@ -50,17 +47,19 @@ async def stop_and_disable(self, vm_hash: str):
5047
5148
5249@pytest .mark .asyncio
53- async def test_create_qemu_instance ():
50+ async def test_create_qemu_instance (mocker ):
5451 """
5552 Create an instance and check that it start / init / stop properly.
53+ No network.
54+ We don't actually check that the system ping since there is no network
5655 """
56+ mocker .patch .object (settings , "ALLOW_VM_NETWORKING" , False )
57+ mocker .patch .object (settings , "USE_FAKE_INSTANCE_BASE" , True )
58+ mocker .patch .object (settings , "FAKE_INSTANCE_MESSAGE" , settings .FAKE_INSTANCE_QEMU_MESSAGE )
59+ mocker .patch .object (settings , "FAKE_INSTANCE_BASE" , settings .FAKE_INSTANCE_QEMU_MESSAGE )
60+ mocker .patch .object (settings , "ENABLE_CONFIDENTIAL_COMPUTING" , False )
61+ mocker .patch .object (settings , "USE_JAILER" , False )
5762
58- settings .USE_FAKE_INSTANCE_BASE = True
59- settings .FAKE_INSTANCE_MESSAGE = settings .FAKE_INSTANCE_QEMU_MESSAGE
60- settings .FAKE_INSTANCE_BASE = settings .FAKE_QEMU_INSTANCE_BASE
61- settings .ENABLE_CONFIDENTIAL_COMPUTING = False
62- settings .ALLOW_VM_NETWORKING = False
63- settings .USE_JAILER = False
6463 if not settings .FAKE_INSTANCE_BASE .exists ():
6564 pytest .xfail ("Test Runtime not setup. run `cd runtimes/instance-rootfs && sudo ./create-debian-12-disk.sh`" )
6665
@@ -120,17 +119,15 @@ async def test_create_qemu_instance_online(mocker):
120119 mocker .patch .object (settings , "ENABLE_CONFIDENTIAL_COMPUTING" , False )
121120 mocker .patch .object (settings , "USE_JAILER" , False )
122121
123- logging .basicConfig (level = logging .DEBUG )
124-
125- # Ensure that the settings are correct and required files present.
126- settings .setup ()
127- settings .check ()
128122 if not settings .FAKE_INSTANCE_BASE .exists ():
129123 pytest .xfail (
130124 "Test instance disk {} not setup. run `cd runtimes/instance-rootfs && sudo ./create-debian-12-disk.sh` " .format (
131125 settings .FAKE_QEMU_INSTANCE_BASE
132126 )
133127 )
128+ # Ensure that the settings are correct and required files present.
129+ settings .setup ()
130+ settings .check ()
134131
135132 # The database is required for the metrics and is currently not optional.
136133 engine = metrics .setup_engine ()
0 commit comments