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

Avoid crash during tests if VNC server run on host PC

This commit is contained in:
Julien Duponchelle 2016-10-24 12:21:57 +02:00
parent 19d184e04c
commit 00fc2fa007
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 11 additions and 9 deletions

View File

@ -109,7 +109,7 @@ def test_create(loop, project, manager):
"container=docker", "container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
], ],
"Entrypoint": ["/gns3/init.sh"], "Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"] "Cmd": ["/bin/sh"]
}) })
@ -148,7 +148,7 @@ def test_create_with_tag(loop, project, manager):
"container=docker", "container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
], ],
"Entrypoint": ["/gns3/init.sh"], "Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"] "Cmd": ["/bin/sh"]
}) })
@ -193,7 +193,7 @@ def test_create_vnc(loop, project, manager):
"GNS3_VOLUMES=/etc/network", "GNS3_VOLUMES=/etc/network",
"QT_GRAPHICSSYSTEM=native", "QT_GRAPHICSSYSTEM=native",
"DISPLAY=:42" "DISPLAY=:42"
], ],
"Entrypoint": ["/gns3/init.sh"], "Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"] "Cmd": ["/bin/sh"]
}) })
@ -237,7 +237,7 @@ def test_create_start_cmd(loop, project, manager):
"container=docker", "container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
] ]
}) })
assert vm._cid == "e90e34656806" assert vm._cid == "e90e34656806"
@ -272,7 +272,7 @@ def test_create_environment(loop, project, manager):
"GNS3_VOLUMES=/etc/network", "GNS3_VOLUMES=/etc/network",
"YES=1", "YES=1",
"NO=0" "NO=0"
], ],
"Volumes": {}, "Volumes": {},
"NetworkDisabled": True, "NetworkDisabled": True,
"Name": "test", "Name": "test",
@ -330,7 +330,7 @@ def test_create_image_not_available(loop, project, manager):
"container=docker", "container=docker",
"GNS3_MAX_ETHERNET=eth0", "GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network" "GNS3_VOLUMES=/etc/network"
], ],
"Entrypoint": ["/gns3/init.sh"], "Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"] "Cmd": ["/bin/sh"]
}) })
@ -566,8 +566,8 @@ def test_update_vnc(loop, vm):
"Warnings": [] "Warnings": []
} }
vm.console_type = "vnc" vm._console_type = "vnc"
vm.console = 5900 vm._console = 5900
vm._display = "display" vm._display = "display"
original_console = vm.console original_console = vm.console
original_aux = vm.aux 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())) loop.run_until_complete(asyncio.async(vm._get_image_information()))
mock.assert_called_with("GET", "images/ubuntu:latest/json") mock.assert_called_with("GET", "images/ubuntu:latest/json")
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
def test_mount_binds(vm, tmpdir): def test_mount_binds(vm, tmpdir):
image_infos = { image_infos = {
@ -930,6 +931,7 @@ def test_create_network_interfaces(vm):
assert "eth4" in content assert "eth4" in content
assert "eth5" not in content assert "eth5" not in content
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
def test_fix_permission(vm, loop): def test_fix_permission(vm, loop):
vm._volumes = ["/etc"] vm._volumes = ["/etc"]

View File

@ -68,7 +68,7 @@ def test_change_console_port(node, port_manager):
def test_console_vnc_invalid(project, manager): def test_console_vnc_invalid(project, manager):
node = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager) node = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
node.console_type = "vnc" node._console_type = "vnc"
with pytest.raises(NodeError): with pytest.raises(NodeError):
node.console = 2012 node.console = 2012