|
5 | 5 | import pytest |
6 | 6 |
|
7 | 7 | from linode_api4 import ApiError, LinodeClient |
8 | | -from linode_api4.objects import ObjectStorageKeys |
| 8 | +from linode_api4.objects import ConfigInterface, ObjectStorageKeys |
9 | 9 |
|
10 | 10 |
|
11 | 11 | @pytest.fixture(scope="session", autouse=True) |
@@ -231,6 +231,38 @@ def test_create_linode_instance_with_image(setup_client_and_linode): |
231 | 231 | assert re.search("linode/debian10", str(linode.image)) |
232 | 232 |
|
233 | 233 |
|
| 234 | +def test_create_linode_with_interfaces(test_linode_client): |
| 235 | + client = test_linode_client |
| 236 | + available_regions = client.regions() |
| 237 | + chosen_region = available_regions[4] |
| 238 | + label = get_test_label() |
| 239 | + |
| 240 | + linode_instance, password = client.linode.instance_create( |
| 241 | + "g6-nanode-1", |
| 242 | + chosen_region, |
| 243 | + label=label, |
| 244 | + image="linode/debian10", |
| 245 | + interfaces=[ |
| 246 | + {"purpose": "public"}, |
| 247 | + ConfigInterface( |
| 248 | + purpose="vlan", label="cool-vlan", ipam_address="10.0.0.4/32" |
| 249 | + ), |
| 250 | + ], |
| 251 | + ) |
| 252 | + |
| 253 | + assert len(linode_instance.configs[0].interfaces) == 2 |
| 254 | + assert linode_instance.configs[0].interfaces[0].purpose == "public" |
| 255 | + assert linode_instance.configs[0].interfaces[1].purpose == "vlan" |
| 256 | + assert linode_instance.configs[0].interfaces[1].label == "cool-vlan" |
| 257 | + assert ( |
| 258 | + linode_instance.configs[0].interfaces[1].ipam_address == "10.0.0.4/32" |
| 259 | + ) |
| 260 | + |
| 261 | + res = linode_instance.delete() |
| 262 | + |
| 263 | + assert res |
| 264 | + |
| 265 | + |
234 | 266 | # LongviewGroupTests |
235 | 267 | def test_get_longview_clients(test_linode_client, test_longview_client): |
236 | 268 | client = test_linode_client |
|
0 commit comments