|
8 | 8 | from tests.integration.helpers import ( |
9 | 9 | BASE_CMDS, |
10 | 10 | assert_headers_in_lines, |
11 | | - delete_target_id, |
12 | 11 | exec_test_command, |
13 | 12 | ) |
14 | | -from tests.integration.linodes.helpers import ( |
15 | | - create_linode, |
16 | | - create_linode_and_wait, |
17 | | - DEFAULT_REGION |
| 13 | +from tests.integration.linodes.helpers import DEFAULT_REGION |
| 14 | +from tests.integration.networking.fixtures import ( |
| 15 | + create_reserved_ip, |
| 16 | + get_command_heads_and_vals, |
| 17 | + test_linode_id, |
| 18 | + test_linode_id_shared_ipv4 |
18 | 19 | ) |
19 | | -from tests.integration.sharegroups.fixtures import get_region # noqa: F401 |
20 | 20 |
|
21 | 21 |
|
22 | 22 | RESERVED_IP_HEADERS = [ |
23 | 23 | "address", "type", "public", "rdns", "linode_id", "reserved", "tags" |
24 | 24 | ] |
25 | 25 |
|
26 | 26 |
|
27 | | -@pytest.fixture |
28 | | -def create_reserved_ip(request): |
29 | | - tags = getattr(request, "param", None) |
30 | | - command = BASE_CMDS["networking"] + [ |
31 | | - "reserved-ip-add", |
32 | | - "--region", |
33 | | - DEFAULT_REGION, |
34 | | - "--text", |
35 | | - "--delimiter", |
36 | | - "," |
37 | | - ] |
38 | | - |
39 | | - if tags: |
40 | | - command += ["--tags", tags] |
41 | | - |
42 | | - headers, values = get_command_heads_and_vals(command) |
43 | | - yield headers, values |
44 | | - |
45 | | - delete_target_id("networking", values[0], "reserved-ip-delete") |
46 | | - |
47 | | - |
48 | | -@pytest.fixture(scope="package") |
49 | | -def test_linode_id(linode_cloud_firewall): |
50 | | - linode_id = create_linode_and_wait(firewall_id=linode_cloud_firewall) |
51 | | - |
52 | | - yield linode_id |
53 | | - |
54 | | - delete_target_id(target="linodes", id=linode_id) |
55 | | - |
56 | | - |
57 | | -@pytest.fixture(scope="package") |
58 | | -def test_linode_id_shared_ipv4(linode_cloud_firewall): |
59 | | - target_region = "us-mia" |
60 | | - |
61 | | - linode_ids = ( |
62 | | - create_linode( |
63 | | - test_region=target_region, firewall_id=linode_cloud_firewall |
64 | | - ), |
65 | | - create_linode( |
66 | | - test_region=target_region, firewall_id=linode_cloud_firewall |
67 | | - ), |
68 | | - ) |
69 | | - |
70 | | - yield linode_ids |
71 | | - |
72 | | - for id in linode_ids: |
73 | | - delete_target_id(target="linodes", id=id) |
74 | | - |
75 | | - |
76 | | -def get_command_heads_and_vals(command): |
77 | | - result = exec_test_command(command).splitlines() |
78 | | - headers = [item for item in result[0].split(",")] |
79 | | - values = [item for item in result[1].split(",")] |
80 | | - |
81 | | - return headers, values |
82 | | - |
83 | | - |
84 | 27 | def has_shared_ip(linode_id: int, ip: str) -> bool: |
85 | 28 | shared_ips = json.loads( |
86 | 29 | exec_test_command( |
|
0 commit comments