mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
tests: pick a free console port instead of hardcoding 5011
A dev machine running a real gns3server (or qemu) can already listen on 5011; reserve_tcp_port then silently replaces it with the next free port and test_console fails on the exact-echo assertion. Pick a port that is actually free on the host first, like test_change_console_port does.
This commit is contained in:
parent
72dc10a669
commit
5188ae625a
@ -51,11 +51,16 @@ def test_temporary_directory(compute_project, manager):
|
||||
assert isinstance(node.temporary_directory, str)
|
||||
|
||||
|
||||
def test_console(compute_project, manager):
|
||||
def test_console(compute_project, manager, port_manager):
|
||||
|
||||
node = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", compute_project, manager)
|
||||
node.console = 5011
|
||||
assert node.console == 5011
|
||||
# pick a port that is actually free on this host: a hardcoded one may be
|
||||
# taken by a running gns3server/qemu on a dev machine, and the setter would
|
||||
# silently replace it with the next free port
|
||||
console_port = port_manager.get_free_tcp_port(node.project)
|
||||
port_manager.release_tcp_port(console_port, node.project)
|
||||
node.console = console_port
|
||||
assert node.console == console_port
|
||||
node.console = None
|
||||
assert node.console is None
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user