@@ -25,10 +25,7 @@ class MockSystemDManager(SystemDManager):
25
25
26
26
async def enable_and_start (self , service : str ) -> tuple [QemuVM | None , Process | None ]:
27
27
# 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 ]
32
29
33
30
config_path = Path (f"{ settings .EXECUTION_ROOT } /{ vm_hash } -controller.json" )
34
31
config = configuration_from_file (config_path )
@@ -50,17 +47,19 @@ async def stop_and_disable(self, vm_hash: str):
50
47
51
48
52
49
@pytest .mark .asyncio
53
- async def test_create_qemu_instance ():
50
+ async def test_create_qemu_instance (mocker ):
54
51
"""
55
52
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
56
55
"""
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 )
57
62
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
64
63
if not settings .FAKE_INSTANCE_BASE .exists ():
65
64
pytest .xfail ("Test Runtime not setup. run `cd runtimes/instance-rootfs && sudo ./create-debian-12-disk.sh`" )
66
65
@@ -120,17 +119,15 @@ async def test_create_qemu_instance_online(mocker):
120
119
mocker .patch .object (settings , "ENABLE_CONFIDENTIAL_COMPUTING" , False )
121
120
mocker .patch .object (settings , "USE_JAILER" , False )
122
121
123
- logging .basicConfig (level = logging .DEBUG )
124
-
125
- # Ensure that the settings are correct and required files present.
126
- settings .setup ()
127
- settings .check ()
128
122
if not settings .FAKE_INSTANCE_BASE .exists ():
129
123
pytest .xfail (
130
124
"Test instance disk {} not setup. run `cd runtimes/instance-rootfs && sudo ./create-debian-12-disk.sh` " .format (
131
125
settings .FAKE_QEMU_INSTANCE_BASE
132
126
)
133
127
)
128
+ # Ensure that the settings are correct and required files present.
129
+ settings .setup ()
130
+ settings .check ()
134
131
135
132
# The database is required for the metrics and is currently not optional.
136
133
engine = metrics .setup_engine ()
0 commit comments