1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Merge branch '2.2' into 3.0

# Conflicts:
#	gns3server/schemas/qemu_template.py
#	requirements.txt
#	tests/compute/qemu/test_qemu_vm.py
#	tests/handlers/api/compute/test_qemu.py
This commit is contained in:
grossmj 2023-10-24 18:31:51 +10:00
commit d680bbbc77
4 changed files with 19 additions and 15 deletions

View File

@ -13,7 +13,8 @@ logging console discriminator EXCESS
!
no ip icmp rate-limit unreachable
!
ip cef
! due to some bugs with IOU, try to change the following line to 'ip cef' if your routing does not work
no ip cef
no ip domain-lookup
!
!

View File

@ -12,7 +12,8 @@ no ip icmp rate-limit unreachable
!
!
!
ip cef
! due to some bugs with IOU, try to change the following line to 'ip cef' if your routing does not work
no ip cef
no ip domain-lookup
!
!

View File

@ -2,7 +2,8 @@ uvicorn==0.23.2
fastapi==0.104.0
python-multipart==0.0.6
websockets==12.0
aiohttp==3.8.6,<3.9
aiohttp>=3.8.6,<3.9; python_version < '3.12'
aiohttp==3.9.0b0; python_version == '3.12'
async-timeout==4.0.3
aiofiles==23.2.1
Jinja2>=3.1.2,<3.2

View File

@ -214,19 +214,19 @@ async def test_termination_callback_error(vm, tmpdir):
@pytest.mark.asyncio
async def test_reload(vm):
with asyncio_patch("gns3server.compute.qemu.QemuVM._control_vm") as mock:
with asyncio_patch("gns3server.compute.qemu.QemuVM._control_vm") as m:
await vm.reload()
assert mock.called_with("system_reset")
m.assert_called_with("system_reset")
@pytest.mark.asyncio
async def test_suspend(vm):
async def test_suspend(vm, running_subprocess_mock):
control_vm_result = MagicMock()
control_vm_result.match.group.decode.return_value = "running"
with asyncio_patch("gns3server.compute.qemu.QemuVM._control_vm", return_value=control_vm_result) as mock:
await vm.suspend()
assert mock.called_with("system_reset")
vm._process = running_subprocess_mock
with asyncio_patch("gns3server.compute.qemu.QemuVM._get_vm_status", return_value="running"):
with asyncio_patch("gns3server.compute.qemu.QemuVM._control_vm") as m:
await vm.suspend()
m.assert_called_with("stop")
@pytest.mark.asyncio
@ -500,14 +500,15 @@ def test_json(vm, compute_project):
@pytest.mark.asyncio
async def test_control_vm(vm):
async def test_control_vm(vm, running_subprocess_mock):
vm._process = MagicMock()
vm._process = running_subprocess_mock
vm._monitor = 4242
reader = MagicMock()
writer = MagicMock()
with asyncio_patch("asyncio.open_connection", return_value=(reader, writer)):
res = await vm._control_vm("test")
assert writer.write.called_with("test")
writer.write.assert_called_with(b"test\n")
assert res is None
@ -525,7 +526,7 @@ async def test_control_vm_expect_text(vm, running_subprocess_mock):
vm._monitor = 4242
res = await vm._control_vm("test", [b"epic"])
assert writer.write.called_with("test")
writer.write.assert_called_with(b"test\n")
assert res == "epic product"