|
17 | 17 | linode_label = DEFAULT_LABEL + timestamp |
18 | 18 |
|
19 | 19 |
|
| 20 | +@pytest.fixture |
| 21 | +def linode_with_vpc_interface_as_args(linode_cloud_firewall): |
| 22 | + """ |
| 23 | + NOTE: This is fixture exists to accommodate a regression test. |
| 24 | + For new tests, use linode_with_vpc_interface_as_json. |
| 25 | + """ |
| 26 | + |
| 27 | + vpc_json = create_vpc_w_subnet() |
| 28 | + |
| 29 | + vpc_region = vpc_json["region"] |
| 30 | + vpc_id = str(vpc_json["id"]) |
| 31 | + subnet_id = str(vpc_json["subnets"][0]["id"]) |
| 32 | + |
| 33 | + linode_json = json.loads( |
| 34 | + exec_test_command( |
| 35 | + BASE_CMD |
| 36 | + + [ |
| 37 | + "create", |
| 38 | + "--type", |
| 39 | + "g6-nanode-1", |
| 40 | + "--region", |
| 41 | + vpc_region, |
| 42 | + "--image", |
| 43 | + DEFAULT_TEST_IMAGE, |
| 44 | + "--root_pass", |
| 45 | + DEFAULT_RANDOM_PASS, |
| 46 | + "--firewall_id", |
| 47 | + linode_cloud_firewall, |
| 48 | + "--interfaces.purpose", |
| 49 | + "vpc", |
| 50 | + "--interfaces.primary", |
| 51 | + "true", |
| 52 | + "--interfaces.subnet_id", |
| 53 | + subnet_id, |
| 54 | + "--interfaces.ipv4.nat_1_1", |
| 55 | + "any", |
| 56 | + "--interfaces.ipv4.vpc", |
| 57 | + "10.0.0.5", |
| 58 | + "--interfaces.ip_ranges", |
| 59 | + json.dumps(["10.0.0.6/32"]), |
| 60 | + "--interfaces.purpose", |
| 61 | + "public", |
| 62 | + "--json", |
| 63 | + "--suppress-warnings", |
| 64 | + ] |
| 65 | + ) |
| 66 | + .stdout.decode() |
| 67 | + .rstrip() |
| 68 | + )[0] |
| 69 | + |
| 70 | + yield linode_json, vpc_json |
| 71 | + |
| 72 | + delete_target_id(target="linodes", id=str(linode_json["id"])) |
| 73 | + delete_target_id(target="vpcs", id=vpc_id) |
| 74 | + |
| 75 | + |
20 | 76 | @pytest.fixture |
21 | 77 | def linode_with_vpc_interface_as_json(linode_cloud_firewall): |
22 | 78 | vpc_json = create_vpc_w_subnet() |
@@ -99,5 +155,9 @@ def assert_interface_configuration( |
99 | 155 | assert public_interface["purpose"] == "public" |
100 | 156 |
|
101 | 157 |
|
| 158 | +def test_with_vpc_interface_as_args(linode_with_vpc_interface_as_args): |
| 159 | + assert_interface_configuration(*linode_with_vpc_interface_as_args) |
| 160 | + |
| 161 | + |
102 | 162 | def test_with_vpc_interface_as_json(linode_with_vpc_interface_as_json): |
103 | 163 | assert_interface_configuration(*linode_with_vpc_interface_as_json) |
0 commit comments