Skip to content

Commit 8429494

Browse files
committed
Test base MAC address for Docker VMs
1 parent ddd6235 commit 8429494

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

tests/compute/docker/test_docker_vm.py

+31-1
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,37 @@ async def test_add_ubridge_connection(vm):
11871187
call.send('bridge start bridge0')
11881188
]
11891189
assert 'bridge0' in vm._bridges
1190-
# We need to check any_order ortherwise mock is confused by asyncio
1190+
# We need to check any_order otherwise mock is confused by asyncio
1191+
vm._ubridge_hypervisor.assert_has_calls(calls, any_order=True)
1192+
1193+
1194+
async def test_add_ubridge_connections_with_base_mac_address(vm):
1195+
1196+
vm._ubridge_hypervisor = MagicMock()
1197+
vm._namespace = 42
1198+
vm.adapters = 2
1199+
vm.mac_address = "02:42:42:42:42:00"
1200+
1201+
nio_params = {
1202+
"type": "nio_udp",
1203+
"lport": 4242,
1204+
"rport": 4343,
1205+
"rhost": "127.0.0.1"}
1206+
1207+
nio = vm.manager.create_nio(nio_params)
1208+
await vm._add_ubridge_connection(nio, 0)
1209+
1210+
nio = vm.manager.create_nio(nio_params)
1211+
await vm._add_ubridge_connection(nio, 1)
1212+
1213+
calls = [
1214+
call.send('bridge create bridge0'),
1215+
call.send('bridge create bridge1'),
1216+
call.send('docker set_mac_addr tap-gns3-e0 02:42:42:42:42:00'),
1217+
call.send('docker set_mac_addr tap-gns3-e0 02:42:42:42:42:01')
1218+
]
1219+
1220+
# We need to check any_order otherwise mock is confused by asyncio
11911221
vm._ubridge_hypervisor.assert_has_calls(calls, any_order=True)
11921222

11931223

0 commit comments

Comments
 (0)