Skip to content

Commit

Permalink
Ensure default resolver presence in DHCP
Browse files Browse the repository at this point in the history
  • Loading branch information
href committed Dec 22, 2023
1 parent ce81de4 commit 1f41355
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ These tests are run regularly against our public infrastructure as well as our i
| | [test_floating_ip_reassign](./test_load_balancer.py#L540) | default |
| | [test_frontend_allowed_cidr](./test_load_balancer.py#L621) | default |
| | [test_proxy_protocol](./test_load_balancer.py#L696) | default |
| **Private Network** | [test_private_ip_address_on_all_images](./test_private_network.py#L14) | all |
| | [test_private_network_connectivity_on_all_images](./test_private_network.py#L35) | all |
| | [test_multiple_private_network_interfaces](./test_private_network.py#L88) | default |
| | [test_no_private_network_port_security](./test_private_network.py#L145) | default |
| | [test_private_network_without_dhcp](./test_private_network.py#L201) | default |
| | [test_private_network_mtu](./test_private_network.py#L244) | default |
| | [test_private_network_only_on_all_images](./test_private_network.py#L302) | all |
| | [test_private_network_attach_later](./test_private_network.py#L324) | default |
| | [test_private_network_dhcp_dns_replies](./test_private_network.py#L358) | default |
| **Private Network** | [test_private_ip_address_on_all_images](./test_private_network.py#L15) | all |
| | [test_private_network_connectivity_on_all_images](./test_private_network.py#L36) | all |
| | [test_multiple_private_network_interfaces](./test_private_network.py#L89) | default |
| | [test_no_private_network_port_security](./test_private_network.py#L146) | default |
| | [test_private_network_without_dhcp](./test_private_network.py#L202) | default |
| | [test_private_network_mtu](./test_private_network.py#L245) | default |
| | [test_private_network_only_on_all_images](./test_private_network.py#L303) | all |
| | [test_private_network_attach_later](./test_private_network.py#L325) | default |
| | [test_private_network_dhcp_dns_replies](./test_private_network.py#L359) | default |
| **Public Network** | [test_public_ip_address_on_all_images](./test_public_network.py#L22) | all |
| | [test_public_network_connectivity_on_all_images](./test_public_network.py#L51) | all |
| | [test_public_network_mtu](./test_public_network.py#L70) | default |
Expand Down
12 changes: 12 additions & 0 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
6: '2001:4860:4860::8888'
}

# The default resolvers we push, per zone. Subject to change.
DEFAULT_RESOLVERS = {
'rma1': {
4: ('5.102.144.101', '5.102.144.102'),
6: ('2a06:c01:f::101', '2a06:c01:f::102'),
},
'lpg1': {
4: ('185.79.232.101', '185.79.232.102'),
6: ('2a06:c02:f::101', '2a06:c02:f::102'),
},
}

# Unique id that distinguishes acceptance tests generated resources.
RUNNER_ID_HASH = blake2b(API_TOKEN.encode("utf-8"), digest_size=8).hexdigest()
RUNNER_ID = f'at-{RUNNER_ID_HASH}'
Expand Down
8 changes: 7 additions & 1 deletion test_private_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

from constants import DEFAULT_RESOLVERS
from util import in_parallel
from util import retry_for

Expand Down Expand Up @@ -371,14 +372,19 @@ def test_private_network_dhcp_dns_replies(server, private_network):

assert server.private_interface.exists

# No DHCP reply sets a search domain
# By default, DHCP sends a set of default resolvers and no search domain
resolvers = DEFAULT_RESOLVERS[server.zone['slug']]

reply = server.dhcp_reply(server.public_interface.name, ip_version=4)
assert f"domain-name-servers {','.join(resolvers[4])}" in reply
assert "domain-search" not in reply

reply = server.dhcp_reply(server.public_interface.name, ip_version=6)
assert f"dhcp6.name-servers {','.join(resolvers[6])}" in reply
assert "domain-search" not in reply

reply = server.dhcp_reply(server.private_interface.name, ip_version=4)
assert f"domain-name-servers {','.join(resolvers[4])}" in reply
assert "domain-search" not in reply

# The DNS server of the private subnet can be changed
Expand Down

0 comments on commit 1f41355

Please sign in to comment.