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

Increase timeout for link creation

This commit is contained in:
Julien Duponchelle 2016-11-08 09:54:59 +01:00
parent 553e137a13
commit 15d190d911
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 16 additions and 16 deletions

View File

@ -61,7 +61,7 @@ class UDPLink(Link):
"rport": self._node2_port,
"type": "nio_udp"
}
yield from node1.post("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1), data=data)
yield from node1.post("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1), data=data, timeout=120)
data = {
"lport": self._node2_port,
@ -70,10 +70,10 @@ class UDPLink(Link):
"type": "nio_udp"
}
try:
yield from node2.post("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number2, port_number=port_number2), data=data)
yield from node2.post("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number2, port_number=port_number2), data=data, timeout=120)
except Exception as e:
# We clean the first NIO
yield from node1.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1))
yield from node1.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1), timeout=120)
raise e
self._created = True
@ -91,7 +91,7 @@ class UDPLink(Link):
except IndexError:
return
try:
yield from node1.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1))
yield from node1.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1), timeout=120)
# If the node is already delete (user selected multiple element and delete all in the same time)
except aiohttp.web.HTTPNotFound:
pass
@ -103,7 +103,7 @@ class UDPLink(Link):
except IndexError:
return
try:
yield from node2.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number2, port_number=port_number2))
yield from node2.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number2, port_number=port_number2), timeout=120)
# If the node is already delete (user selected multiple element and delete all in the same time)
except aiohttp.web.HTTPNotFound:
pass

View File

@ -54,7 +54,7 @@ def test_create(async_run, project):
async_run(link.add_node(node1, 0, 4))
@asyncio.coroutine
def compute1_callback(path, data={}):
def compute1_callback(path, data={}, **kwargs):
"""
Fake server
"""
@ -64,7 +64,7 @@ def test_create(async_run, project):
return response
@asyncio.coroutine
def compute2_callback(path, data={}):
def compute2_callback(path, data={}, **kwargs):
"""
Fake server
"""
@ -84,13 +84,13 @@ def test_create(async_run, project):
"rhost": "192.168.1.2",
"rport": 2048,
"type": "nio_udp"
})
}, timeout=120)
compute2.post.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id), data={
"lport": 2048,
"rhost": "192.168.1.1",
"rport": 1024,
"type": "nio_udp"
})
}, timeout=120)
def test_create_one_side_failure(async_run, project):
@ -115,7 +115,7 @@ def test_create_one_side_failure(async_run, project):
async_run(link.add_node(node1, 0, 4))
@asyncio.coroutine
def compute1_callback(path, data={}):
def compute1_callback(path, data={}, **kwargs):
"""
Fake server
"""
@ -125,7 +125,7 @@ def test_create_one_side_failure(async_run, project):
return response
@asyncio.coroutine
def compute2_callback(path, data={}):
def compute2_callback(path, data={}, **kwargs):
"""
Fake server
"""
@ -148,15 +148,15 @@ def test_create_one_side_failure(async_run, project):
"rhost": "192.168.1.2",
"rport": 2048,
"type": "nio_udp"
})
}, timeout=120)
compute2.post.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id), data={
"lport": 2048,
"rhost": "192.168.1.1",
"rport": 1024,
"type": "nio_udp"
})
}, timeout=120)
# The link creation has failed we rollback the nio
compute1.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id))
compute1.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id), timeout=120)
def test_delete(async_run, project):
@ -175,8 +175,8 @@ def test_delete(async_run, project):
async_run(link.delete())
compute1.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id))
compute2.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id))
compute1.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id), timeout=120)
compute2.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id), timeout=120)
def test_choose_capture_side(async_run, project):