Fix packet filter validation tests: use correct ubridge filter type names

This commit is contained in:
YueGuobin 2026-05-31 00:38:03 +08:00
parent 0aa0467b02
commit 92a0fa6cd7
No known key found for this signature in database
2 changed files with 13 additions and 13 deletions

View File

@ -63,10 +63,10 @@ class TestLinkRoutes:
node1, node2 = nodes
filters = {
"latency": [10],
"delay": [10, 0],
"frequency_drop": [50]
}
with asyncio_patch("gns3server.controller.udp_link.UDPLink.create") as mock:
response = await client.post(app.url_path_for("create_link", project_id=project.id), json={
"nodes": [
@ -88,7 +88,7 @@ class TestLinkRoutes:
],
"filters": filters
})
assert mock.called
assert response.status_code == status.HTTP_201_CREATED
assert response.json()["link_id"] is not None
@ -250,10 +250,10 @@ class TestLinkRoutes:
) -> None:
filters = {
"latency": [10],
"delay": [10, 0],
"frequency_drop": [50]
}
node1, node2 = nodes
with asyncio_patch("gns3server.controller.udp_link.UDPLink.create") as mock:
response = await client.post(app.url_path_for("create_link", project_id=project.id), json={
@ -315,7 +315,7 @@ class TestLinkRoutes:
) -> None:
filters = {
"latency": [10],
"delay": [10, 0],
"frequency_drop": [50]
}

View File

@ -46,7 +46,7 @@ async def test_create(project):
link = UDPLink(project)
await link.add_node(node1, 0, 4)
await link.update_filters({"latency": [10]})
await link.update_filters({"delay": [10, 0]})
async def compute1_callback(path, data={}, **kwargs):
"""
@ -77,7 +77,7 @@ async def test_create(project):
"rhost": "192.168.1.2",
"rport": 2048,
"type": "nio_udp",
"filters": {"latency": [10]},
"filters": {"delay": [10, 0]},
"suspend": False,
}, timeout=120)
@ -313,7 +313,7 @@ async def test_update(project):
link = UDPLink(project)
await link.add_node(node1, 0, 4)
await link.update_filters({"latency": [10]})
await link.update_filters({"delay": [10, 0]})
async def compute1_callback(path, data={}, **kwargs):
"""
@ -345,7 +345,7 @@ async def test_update(project):
"rport": 2048,
"type": "nio_udp",
"suspend": False,
"filters": {"latency": [10]}
"filters": {"delay": [10, 0]}
}, timeout=120)
compute2.post.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id), data={
@ -358,7 +358,7 @@ async def test_update(project):
}, timeout=120)
assert link.created
await link.update_filters({"drop": [5], "bpf": ["icmp[icmptype] == 8"]})
await link.update_filters({"frequency_drop": [5], "bpf": ["icmp[icmptype] == 8"]})
compute1.put.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id), data={
"lport": 1024,
"rhost": "192.168.1.2",
@ -366,7 +366,7 @@ async def test_update(project):
"type": "nio_udp",
"suspend": False,
"filters": {
"drop": [5],
"frequency_drop": [5],
"bpf": ["icmp[icmptype] == 8"]
}
}, timeout=120)
@ -392,7 +392,7 @@ async def test_update_suspend(project):
link = UDPLink(project)
await link.add_node(node1, 0, 4)
await link.update_filters({"latency": [10]})
await link.update_filters({"frequency_drop": [-1]})
await link.update_suspend(True)
async def compute1_callback(path, data={}, **kwargs):