From 00fc2fa0074321c2e068dd7c4c5336bb664bd78b Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 24 Oct 2016 12:21:57 +0200 Subject: [PATCH] Avoid crash during tests if VNC server run on host PC --- tests/compute/docker/test_docker_vm.py | 18 ++++++++++-------- tests/compute/test_base_node.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/compute/docker/test_docker_vm.py b/tests/compute/docker/test_docker_vm.py index be5e7f5c..97419c43 100644 --- a/tests/compute/docker/test_docker_vm.py +++ b/tests/compute/docker/test_docker_vm.py @@ -109,7 +109,7 @@ def test_create(loop, project, manager): "container=docker", "GNS3_MAX_ETHERNET=eth0", "GNS3_VOLUMES=/etc/network" - ], + ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] }) @@ -148,7 +148,7 @@ def test_create_with_tag(loop, project, manager): "container=docker", "GNS3_MAX_ETHERNET=eth0", "GNS3_VOLUMES=/etc/network" - ], + ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] }) @@ -193,7 +193,7 @@ def test_create_vnc(loop, project, manager): "GNS3_VOLUMES=/etc/network", "QT_GRAPHICSSYSTEM=native", "DISPLAY=:42" - ], + ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] }) @@ -237,7 +237,7 @@ def test_create_start_cmd(loop, project, manager): "container=docker", "GNS3_MAX_ETHERNET=eth0", "GNS3_VOLUMES=/etc/network" - ] + ] }) assert vm._cid == "e90e34656806" @@ -272,7 +272,7 @@ def test_create_environment(loop, project, manager): "GNS3_VOLUMES=/etc/network", "YES=1", "NO=0" - ], + ], "Volumes": {}, "NetworkDisabled": True, "Name": "test", @@ -330,7 +330,7 @@ def test_create_image_not_available(loop, project, manager): "container=docker", "GNS3_MAX_ETHERNET=eth0", "GNS3_VOLUMES=/etc/network" - ], + ], "Entrypoint": ["/gns3/init.sh"], "Cmd": ["/bin/sh"] }) @@ -566,8 +566,8 @@ def test_update_vnc(loop, vm): "Warnings": [] } - vm.console_type = "vnc" - vm.console = 5900 + vm._console_type = "vnc" + vm._console = 5900 vm._display = "display" original_console = vm.console original_aux = vm.aux @@ -872,6 +872,7 @@ def test_get_image_informations(project, manager, loop): loop.run_until_complete(asyncio.async(vm._get_image_information())) mock.assert_called_with("GET", "images/ubuntu:latest/json") + @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") def test_mount_binds(vm, tmpdir): image_infos = { @@ -930,6 +931,7 @@ def test_create_network_interfaces(vm): assert "eth4" in content assert "eth5" not in content + @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") def test_fix_permission(vm, loop): vm._volumes = ["/etc"] diff --git a/tests/compute/test_base_node.py b/tests/compute/test_base_node.py index 9aa344e9..c706a47a 100644 --- a/tests/compute/test_base_node.py +++ b/tests/compute/test_base_node.py @@ -68,7 +68,7 @@ def test_change_console_port(node, port_manager): def test_console_vnc_invalid(project, manager): node = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager) - node.console_type = "vnc" + node._console_type = "vnc" with pytest.raises(NodeError): node.console = 2012