-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Execution creation was not tested
Solution: Add a test that creates a new VM execution and checks that it starts properly.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |