Skip to content

Commit

Permalink
Fixes after merging
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Sep 23, 2024
1 parent 8ce0cbf commit a7b5673
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions tests/compute/docker/test_docker_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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': '/',
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions tests/compute/test_base_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions tests/controller/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a7b5673

Please sign in to comment.