Skip to content
Snippets Groups Projects
Unverified Commit 63ac65aa authored by Varac's avatar Varac
Browse files

Test if DNS results match expected IP

parent b9440e19
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,9 @@ def test_dns(host):
# Get ansible domain
ansible_vars = host.ansible.get_variables()
assert 'domain' in ansible_vars
assert 'ip_address' in ansible_vars
domain = ansible_vars['domain']
expected_ip = ansible_vars['ip_address']
# Get FLD and authorative nameservers for domain
fld = tld.get_fld(domain, fix_protocol=True)
......@@ -42,7 +44,6 @@ def test_dns(host):
results = []
print('\nTesting authorative nameservers:')
print(authorative_nameservers)
for i in authorative_nameservers:
print(i)
results.append(test_nameserver(i, domain))
......@@ -61,6 +62,7 @@ def test_dns(host):
unique = set(results)
print(f'\nResults: {unique}')
assert len(unique) == 1
assert list(unique)[0] == expected_ip
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment