Server support for VNC console resolution

Ref https://github.com/GNS3/gns3-gui/issues/1165
This commit is contained in:
Julien Duponchelle committed 2016-04-07 13:29:11 +02:00
1 parent ad6fb664a2
commit 977ccabf98
5 files changed
+40 -8

No files matched your search

+2 -1
View File
@@ -30,7 +30,7 @@ from gns3server.modules.docker import Docker
@pytest.fixture
def base_params():
"""Return standard parameters"""
return {"name": "PC TEST 1", "image": "nginx", "start_command": "nginx-daemon", "adapters": 2, "environment": "YES=1\nNO=0", "console_type": "telnet"}
return {"name": "PC TEST 1", "image": "nginx", "start_command": "nginx-daemon", "adapters": 2, "environment": "YES=1\nNO=0", "console_type": "telnet", "console_resolution": "1280x1024"}
@pytest.yield_fixture(autouse=True)
@@ -65,6 +65,7 @@ def test_docker_create(server, project, base_params):
assert response.json["image"] == "nginx"
assert response.json["adapters"] == 2
assert response.json["environment"] == "YES=1\nNO=0"
assert response.json["console_resolution"] == "1280x1024"
def test_docker_start(server, vm):
+3 -1
View File
@@ -57,6 +57,7 @@ def test_json(vm, project):
'adapters': 1,
'console': vm.console,
'console_type': 'telnet',
'console_resolution': '1024x768',
'aux': vm.aux,
'start_command': vm.start_command,
'environment': vm.environment,
@@ -816,12 +817,13 @@ def test_mount_binds(vm, tmpdir):
def test_start_vnc(vm, loop):
vm.console_resolution = "1280x1024"
with patch("shutil.which", return_value="/bin/x"):
with asyncio_patch("gns3server.modules.docker.docker_vm.wait_for_file_creation") as mock_wait:
with asyncio_patch("asyncio.create_subprocess_exec") as mock_exec:
loop.run_until_complete(asyncio.async(vm._start_vnc()))
assert vm._display is not None
mock_exec.assert_any_call("Xvfb", "-nolisten", "tcp", ":{}".format(vm._display), "-screen", "0", "1024x768x16")
mock_exec.assert_any_call("Xvfb", "-nolisten", "tcp", ":{}".format(vm._display), "-screen", "0", "1280x1024x16")
mock_exec.assert_any_call("x11vnc", "-forever", "-nopw", "-display", "WAIT:{}".format(vm._display), "-rfbport", str(vm.console), "-noncache", "-listen", "127.0.0.1")
mock_wait.assert_called_with("/tmp/.X11-unix/X{}".format(vm._display))