44from tests .integration .helpers import (
55 BASE_CMDS ,
66 exec_test_command ,
7+ wait_for_condition ,
78)
89from tests .integration .linodes .fixtures import ( # noqa: F401
910 linode_with_vpc_interface_as_args ,
1415def assert_interface_configuration (
1516 linode_json : Dict [str , Any ], vpc_json : Dict [str , Any ]
1617):
17- config_json = json .loads (
18- exec_test_command (
19- BASE_CMDS ["linodes" ]
20- + [
21- "configs-list" ,
22- str (linode_json ["id" ]),
23- "--json" ,
24- "--suppress-warnings" ,
25- ]
18+ linode_id = str (linode_json ["id" ])
19+ configs = []
20+
21+ def fetch_configs ():
22+ nonlocal configs
23+ configs = json .loads (
24+ exec_test_command (
25+ BASE_CMDS ["linodes" ]
26+ + [
27+ "configs-list" ,
28+ linode_id ,
29+ "--json" ,
30+ "--suppress-warnings" ,
31+ ]
32+ )
2633 )
27- )[0 ]
34+ return len (configs ) > 0
35+
36+ wait_for_condition (5 , 180 , fetch_configs )
37+
38+ assert configs , f"No configs found for Linode { linode_id } "
39+ config_json = configs [0 ]
40+
41+ interfaces = config_json ["interfaces" ]
2842
29- vpc_interface = config_json ["interfaces" ][0 ]
30- public_interface = config_json ["interfaces" ][1 ]
43+ vpc_interface = next ((i for i in interfaces if i ["purpose" ] == "vpc" ), None )
44+ public_interface = next (
45+ (i for i in interfaces if i ["purpose" ] == "public" ), None
46+ )
3147
48+ assert (
49+ vpc_interface
50+ ), "Expected interface with purpose 'vpc' in configuration"
51+ assert (
52+ public_interface
53+ ), "Expected interface with purpose 'public' in configuration"
3254 assert vpc_interface ["primary" ]
3355 assert vpc_interface ["purpose" ] == "vpc"
3456 assert vpc_interface ["subnet_id" ] == vpc_json ["subnets" ][0 ]["id" ]
@@ -38,7 +60,6 @@ def assert_interface_configuration(
3860 assert vpc_interface ["ip_ranges" ][0 ] == "10.0.0.6/32"
3961
4062 assert not public_interface ["primary" ]
41- assert public_interface ["purpose" ] == "public"
4263
4364
4465def test_with_vpc_interface_as_args (linode_with_vpc_interface_as_args ):
0 commit comments