1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Fixes after merging

This commit is contained in:
grossmj 2024-09-23 14:08:24 +07:00
parent 8ce0cbf7f7
commit a7b56739a9
No known key found for this signature in database
GPG Key ID: 0A2D76AC45EA25CD
3 changed files with 12 additions and 6 deletions

View File

@ -45,9 +45,8 @@ async def manager(port_manager):
@pytest_asyncio.fixture(scope="function")
async def vm(compute_project, manager):
vm = DockerVM("test", str(uuid.uuid4()), compute_project, manager, "ubuntu:latest")
vm = DockerVM("test", str(uuid.uuid4()), compute_project, manager, "ubuntu:latest", aux_type="none")
vm._cid = "e90e34656842"
vm.allocate_aux = False
vm.mac_address = '02:42:3d:b7:93:00'
return vm
@ -64,6 +63,7 @@ def test_json(vm, compute_project):
'mac_address': '02:42:3d:b7:93:00',
'console': vm.console,
'console_type': 'telnet',
'aux_type': 'none',
'console_resolution': '1024x768',
'console_http_port': 80,
'console_http_path': '/',
@ -1077,7 +1077,7 @@ async def test_start(vm, manager, free_console_port, tmpdir):
assert vm.status != "started"
vm.adapters = 1
vm.allocate_aux = True
vm.aux_type = "telnet"
vm._start_aux = AsyncioMagicMock()
vm._get_container_state = AsyncioMagicMock(return_value="stopped")
@ -1699,6 +1699,7 @@ async def test_start_vnc_missing(vm):
@pytest.mark.asyncio
async def test_start_aux(vm):
vm.aux_type = "telnet"
with asyncio_patch("asyncio.subprocess.create_subprocess_exec", return_value=MagicMock()) as mock_exec:
await vm._start_aux()
mock_exec.assert_called_with(

View File

@ -104,7 +104,7 @@ def test_aux(compute_project, manager, port_manager):
aux = port_manager.get_free_tcp_port(compute_project)
port_manager.release_tcp_port(aux, compute_project)
node = DockerVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager, "ubuntu", aux=aux)
node = DockerVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager, "ubuntu", aux=aux, aux_type="telnet")
assert node.aux == aux
node.aux = None
assert node.aux is None
@ -116,12 +116,13 @@ def test_allocate_aux(compute_project, manager):
assert node.aux is None
# Docker has an aux port by default
node = DockerVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager, "ubuntu")
node = DockerVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager, "ubuntu", aux_type="telnet")
assert node.aux is not None
def test_change_aux_port(node, port_manager):
def test_change_aux_port(compute_project, manager, port_manager):
node = DockerVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager, "ubuntu", aux_type="telnet")
port1 = port_manager.get_free_tcp_port(node.project)
port2 = port_manager.get_free_tcp_port(node.project)
port_manager.release_tcp_port(port1, node.project)

View File

@ -122,6 +122,8 @@ def test_json(node, compute):
"console": node.console,
"console_type": node.console_type,
"console_host": str(compute.console_host),
"aux": node.aux,
"aux_type": node.aux_type,
"command_line": None,
"node_directory": None,
"properties": node.properties,
@ -159,6 +161,8 @@ def test_json(node, compute):
"name": "demo",
"console": node.console,
"console_type": node.console_type,
"aux": node.aux,
"aux_type": node.aux_type,
"properties": node.properties,
"x": node.x,
"y": node.y,