Экран машины снова подключается: noVNC 1.6 строил адрес WebSocket от своей страницы и уходил в /novnc/console/ws, путь теперь работает и с 1.6, и с 1.3
Этот коммит содержится в:
@@ -254,3 +254,20 @@ def test_failed_create_of_existing_vm_keeps_its_disk(logged_in, data_dirs):
|
||||
def test_operation_page_reveals_only_buttons_for_its_result():
|
||||
script = (Path(__file__).resolve().parents[1] / "web" / "static" / "panel.js").read_text()
|
||||
assert '$$(`[data-op-done="${status}"]`)' in script and "$$('[data-op-done]')" not in script
|
||||
|
||||
|
||||
def test_console_websocket_path_works_with_old_and_new_novnc(tmp_path, monkeypatch):
|
||||
"""noVNC 1.6 (Ubuntu 26.04) считает path от /novnc/vnc.html: без "../" экран стучался в /novnc/console/ws/… и не подключался."""
|
||||
import posixpath
|
||||
from urllib.parse import parse_qs, urljoin, urlsplit
|
||||
|
||||
(tmp_path / "vnc.html").write_text("<html></html>")
|
||||
monkeypatch.setattr(app, "NOVNC_DIR", tmp_path)
|
||||
monkeypatch.setattr(app, "vm_vnc_display", lambda name: "127.0.0.1:0")
|
||||
info = app.console_info("web01")
|
||||
page = "https://panel.test:8443" + info["url"]
|
||||
path = parse_qs(urlsplit(page).query)["path"][0]
|
||||
token = path.rsplit("/", 1)[1]
|
||||
assert app.console_serializer.loads(token) == {"vm": "web01", "port": 5900}
|
||||
assert urlsplit(urljoin(page, path)).path == f"/console/ws/{token}" # noVNC 1.6: new URL(path, location.href)
|
||||
assert posixpath.normpath("/" + path) == f"/console/ws/{token}" # noVNC 1.3: "wss://host:port/" + path
|
||||
|
||||
Ссылка в новой задаче
Block a user