diff --git a/tests/supervisor/test_execution.py b/tests/supervisor/test_execution.py new file mode 100644 index 000000000..3061050ef --- /dev/null +++ b/tests/supervisor/test_execution.py @@ -0,0 +1,37 @@ +import asyncio + +import pytest +from aleph_message.models import ItemHash + +from aleph.vm.conf import settings +from aleph.vm.models import VmExecution +from aleph.vm.storage import get_message + + +@pytest.mark.asyncio +async def test_create_execution(): + """ + Create a new VM execution and check that it starts properly. + """ + + settings.FAKE_DATA_PROGRAM = settings.BENCHMARK_FAKE_DATA_PROGRAM + settings.ALLOW_VM_NETWORKING = False + vm_hash = ItemHash("fake-hash-fake-hash-fake-hash-fake-hash-fake-hash-fake-hash-hash") + message = await get_message(ref=vm_hash) + + execution = VmExecution( + vm_hash=vm_hash, + message=message.content, + original=message.content, + snapshot_manager=None, + systemd_manager=None, + persistent=False, + ) + + # Downloading the resources required may take some time, limit it to 10 seconds + async with asyncio.timeout(30): + await execution.prepare() + + execution.create(vm_id=3, tap_interface=None) + # async with asyncio.timeout(30): + # await execution.start()