mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-29 02:08:10 +00:00
Fix tests
This commit is contained in:
parent
10296f4f19
commit
80fd857658
@ -80,7 +80,7 @@ class PortManager:
|
||||
return self._console_host
|
||||
|
||||
@console_host.setter
|
||||
def host(self, new_host):
|
||||
def console_host(self, new_host):
|
||||
|
||||
self._console_host = new_host
|
||||
|
||||
|
@ -133,6 +133,7 @@ def test_qemu_update(server, vm, tmpdir, free_console_port, project):
|
||||
|
||||
|
||||
def test_qemu_nio_create_udp(server, vm):
|
||||
server.put("/projects/{project_id}/qemu/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"adapters": 2})
|
||||
response = server.post("/projects/{project_id}/qemu/vms/{vm_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_udp",
|
||||
"lport": 4242,
|
||||
"rport": 4343,
|
||||
@ -144,6 +145,7 @@ def test_qemu_nio_create_udp(server, vm):
|
||||
|
||||
|
||||
def test_qemu_nio_create_ethernet(server, vm):
|
||||
server.put("/projects/{project_id}/qemu/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"adapters": 2})
|
||||
response = server.post("/projects/{project_id}/qemu/vms/{vm_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_generic_ethernet",
|
||||
"ethernet_device": "eth0",
|
||||
},
|
||||
@ -155,6 +157,7 @@ def test_qemu_nio_create_ethernet(server, vm):
|
||||
|
||||
|
||||
def test_qemu_delete_nio(server, vm):
|
||||
server.put("/projects/{project_id}/qemu/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"adapters": 2})
|
||||
server.post("/projects/{project_id}/qemu/vms/{vm_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_udp",
|
||||
"lport": 4242,
|
||||
"rport": 4343,
|
||||
|
@ -59,6 +59,7 @@ def fake_qemu_binary():
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def vm(project, manager, fake_qemu_binary, fake_qemu_img_binary):
|
||||
manager.port_manager.console_host = "127.0.0.1"
|
||||
return QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager, qemu_path=fake_qemu_binary)
|
||||
|
||||
|
||||
@ -252,7 +253,7 @@ def test_control_vm_expect_text(vm, loop, running_subprocess_mock):
|
||||
assert res == "epic product"
|
||||
|
||||
|
||||
def test_build_command(vm, loop, fake_qemu_binary):
|
||||
def test_build_command(vm, loop, fake_qemu_binary, port_manager):
|
||||
|
||||
os.environ["DISPLAY"] = "0:0"
|
||||
with patch("gns3server.modules.qemu.qemu_vm.QemuVM._get_random_mac", return_value="00:00:ab:7e:b5:00"):
|
||||
@ -267,13 +268,13 @@ def test_build_command(vm, loop, fake_qemu_binary):
|
||||
"-hda",
|
||||
os.path.join(vm.working_dir, "flash.qcow2"),
|
||||
"-serial",
|
||||
"telnet:0.0.0.0:{},server,nowait".format(vm.console),
|
||||
"telnet:127.0.0.1:{},server,nowait".format(vm.console),
|
||||
"-monitor",
|
||||
"telnet:0.0.0.0:{},server,nowait".format(vm.monitor),
|
||||
"-net",
|
||||
"nic,vlan=0,macaddr=00:00:ab:7e:b5:00,model=e1000",
|
||||
"-net",
|
||||
"user,vlan=0,name=gns3-0"
|
||||
"telnet:127.0.0.1:{},server,nowait".format(vm.monitor),
|
||||
"-device",
|
||||
"e1000,mac=00:00:ab:7e:b5:00,netdev=gns3-0",
|
||||
"-netdev",
|
||||
"user,id=gns3-0"
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user