@@ -123,6 +123,7 @@ async def test_create(compute_project, manager):
123
123
"Memory" : 0 ,
124
124
"NanoCpus" : 0
125
125
},
126
+ "UsernsMode" : "host" ,
126
127
"Volumes" : {},
127
128
"NetworkDisabled" : True ,
128
129
"Hostname" : "test" ,
@@ -173,6 +174,7 @@ async def test_create_with_tag(compute_project, manager):
173
174
"Memory" : 0 ,
174
175
"NanoCpus" : 0
175
176
},
177
+ "UsernsMode" : "host" ,
176
178
"Volumes" : {},
177
179
"NetworkDisabled" : True ,
178
180
"Hostname" : "test" ,
@@ -232,6 +234,7 @@ async def test_create_vnc(compute_project, manager):
232
234
"Memory" : 0 ,
233
235
"NanoCpus" : 0
234
236
},
237
+ "UsernsMode" : "host" ,
235
238
"Volumes" : {},
236
239
"NetworkDisabled" : True ,
237
240
"Hostname" : "test" ,
@@ -377,6 +380,7 @@ async def test_create_start_cmd(compute_project, manager):
377
380
"Memory" : 0 ,
378
381
"NanoCpus" : 0
379
382
},
383
+ "UsernsMode" : "host" ,
380
384
"Volumes" : {},
381
385
"Entrypoint" : ["/gns3/init.sh" ],
382
386
"Cmd" : ["/bin/ls" ],
@@ -489,6 +493,7 @@ async def information():
489
493
"Memory" : 0 ,
490
494
"NanoCpus" : 0
491
495
},
496
+ "UsernsMode" : "host" ,
492
497
"Volumes" : {},
493
498
"NetworkDisabled" : True ,
494
499
"Hostname" : "test" ,
@@ -544,6 +549,7 @@ async def test_create_with_user(compute_project, manager):
544
549
"Memory" : 0 ,
545
550
"NanoCpus" : 0
546
551
},
552
+ "UsernsMode" : "host" ,
547
553
"Volumes" : {},
548
554
"NetworkDisabled" : True ,
549
555
"Hostname" : "test" ,
@@ -647,6 +653,7 @@ async def test_create_with_extra_volumes_duplicate_1_image(compute_project, mana
647
653
"Memory" : 0 ,
648
654
"NanoCpus" : 0
649
655
},
656
+ "UsernsMode" : "host" ,
650
657
"Volumes" : {},
651
658
"NetworkDisabled" : True ,
652
659
"Hostname" : "test" ,
@@ -702,6 +709,7 @@ async def test_create_with_extra_volumes_duplicate_2_user(compute_project, manag
702
709
"Memory" : 0 ,
703
710
"NanoCpus" : 0
704
711
},
712
+ "UsernsMode" : "host" ,
705
713
"Volumes" : {},
706
714
"NetworkDisabled" : True ,
707
715
"Hostname" : "test" ,
@@ -757,6 +765,7 @@ async def test_create_with_extra_volumes_duplicate_3_subdir(compute_project, man
757
765
"Memory" : 0 ,
758
766
"NanoCpus" : 0
759
767
},
768
+ "UsernsMode" : "host" ,
760
769
"Volumes" : {},
761
770
"NetworkDisabled" : True ,
762
771
"Hostname" : "test" ,
@@ -812,6 +821,7 @@ async def test_create_with_extra_volumes_duplicate_4_backslash(compute_project,
812
821
"Memory" : 0 ,
813
822
"NanoCpus" : 0
814
823
},
824
+ "UsernsMode" : "host" ,
815
825
"Volumes" : {},
816
826
"NetworkDisabled" : True ,
817
827
"Hostname" : "test" ,
@@ -862,6 +872,7 @@ async def test_create_with_extra_volumes_duplicate_5_subdir_issue_1595(compute_p
862
872
"Memory" : 0 ,
863
873
"NanoCpus" : 0
864
874
},
875
+ "UsernsMode" : "host" ,
865
876
"Volumes" : {},
866
877
"NetworkDisabled" : True ,
867
878
"Hostname" : "test" ,
@@ -912,6 +923,7 @@ async def test_create_with_extra_volumes_duplicate_6_subdir_issue_1595(compute_p
912
923
"Memory" : 0 ,
913
924
"NanoCpus" : 0
914
925
},
926
+ "UsernsMode" : "host" ,
915
927
"Volumes" : {},
916
928
"NetworkDisabled" : True ,
917
929
"Hostname" : "test" ,
@@ -978,6 +990,7 @@ async def test_create_with_extra_volumes(compute_project, manager):
978
990
"Memory" : 0 ,
979
991
"NanoCpus" : 0
980
992
},
993
+ "UsernsMode" : "host" ,
981
994
"Volumes" : {},
982
995
"NetworkDisabled" : True ,
983
996
"Hostname" : "test" ,
@@ -1254,6 +1267,7 @@ async def test_update(vm):
1254
1267
"Memory" : 0 ,
1255
1268
"NanoCpus" : 0
1256
1269
},
1270
+ "UsernsMode" : "host" ,
1257
1271
"Volumes" : {},
1258
1272
"NetworkDisabled" : True ,
1259
1273
"Hostname" : "test" ,
@@ -1335,6 +1349,7 @@ async def test_update_running(vm):
1335
1349
"Memory" : 0 ,
1336
1350
"NanoCpus" : 0
1337
1351
},
1352
+ "UsernsMode" : "host" ,
1338
1353
"Volumes" : {},
1339
1354
"NetworkDisabled" : True ,
1340
1355
"Hostname" : "test" ,
@@ -1430,7 +1445,37 @@ async def test_add_ubridge_connection(vm):
1430
1445
call .send ('bridge start bridge0' )
1431
1446
]
1432
1447
assert 'bridge0' in vm ._bridges
1433
- # We need to check any_order ortherwise mock is confused by asyncio
1448
+ # We need to check any_order otherwise mock is confused by asyncio
1449
+ vm ._ubridge_hypervisor .assert_has_calls (calls , any_order = True )
1450
+
1451
+
1452
+ async def test_add_ubridge_connections_with_base_mac_address (vm ):
1453
+
1454
+ vm ._ubridge_hypervisor = MagicMock ()
1455
+ vm ._namespace = 42
1456
+ vm .adapters = 2
1457
+ vm .mac_address = "02:42:42:42:42:00"
1458
+
1459
+ nio_params = {
1460
+ "type" : "nio_udp" ,
1461
+ "lport" : 4242 ,
1462
+ "rport" : 4343 ,
1463
+ "rhost" : "127.0.0.1" }
1464
+
1465
+ nio = vm .manager .create_nio (nio_params )
1466
+ await vm ._add_ubridge_connection (nio , 0 )
1467
+
1468
+ nio = vm .manager .create_nio (nio_params )
1469
+ await vm ._add_ubridge_connection (nio , 1 )
1470
+
1471
+ calls = [
1472
+ call .send ('bridge create bridge0' ),
1473
+ call .send ('bridge create bridge1' ),
1474
+ call .send ('docker set_mac_addr tap-gns3-e0 02:42:42:42:42:00' ),
1475
+ call .send ('docker set_mac_addr tap-gns3-e0 02:42:42:42:42:01' )
1476
+ ]
1477
+
1478
+ # We need to check any_order otherwise mock is confused by asyncio
1434
1479
vm ._ubridge_hypervisor .assert_has_calls (calls , any_order = True )
1435
1480
1436
1481
@@ -1654,6 +1699,7 @@ async def test_start_vnc_missing(vm):
1654
1699
@pytest .mark .asyncio
1655
1700
async def test_start_aux (vm ):
1656
1701
1702
+ vm .aux_type = "telnet"
1657
1703
with asyncio_patch ("asyncio.subprocess.create_subprocess_exec" , return_value = MagicMock ()) as mock_exec :
1658
1704
await vm ._start_aux ()
1659
1705
mock_exec .assert_called_with (
0 commit comments