Browse Source

bind: fix tests

keep-around/ef7a3bcfe82f45158da4d217db718070c6d58673
singuliere 2 years ago
parent
commit
ef7a3bcfe8
No known key found for this signature in database GPG Key ID: 900857755EF189C2
  1. 6
      inventory/02-all.yml
  2. 2
      molecule/bind/molecule.yml
  3. 1
      molecule/bind/playbook.yml
  4. 2
      molecule/bind/tests/test_caa.py
  5. 24
      molecule/bind/tests/test_testing_zone.py

6
inventory/02-all.yml

@ -32,3 +32,9 @@ gitlab:
hosts:
gitlab-host:
api-host:
testing:
hosts:
external-host:
bind-client-host:

2
molecule/bind/molecule.yml

@ -18,7 +18,7 @@ provisioner:
lint:
name: ansible-lint
env:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../authorized_keys/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles:../icinga/roles
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../authorized_keys/roles:../jdauphant.nginx/roles:../enough-nginx/roles:../certificate/roles:../icinga/roles
inventory:
links:
group_vars: ../../inventory/group_vars

1
molecule/bind/playbook.yml

@ -1,7 +1,6 @@
---
- import_playbook: ../infrastructure/stretch-playbook.yml
- import_playbook: ../firewall/firewall-playbook.yml
- import_playbook: ../letsencrypt/letsencrypt-playbook.yml
- import_playbook: ../authorized_keys/authorized-keys-playbook.yml
- import_playbook: bind-playbook.yml
- import_playbook: bind-client-playbook.yml

2
molecule/bind/tests/test_caa.py

@ -4,5 +4,7 @@ testinfra_hosts = ['bind-client-host']
def test_caa(host):
domain = host.run("hostname -d").stdout.strip()
cmd = host.run("dig +short CAA " + domain)
print(cmd.stdout)
print(cmd.stderr)
assert 0 == cmd.rc
assert '"letsencrypt.org"' in cmd.stdout.strip()

24
molecule/bind/tests/test_testing_zone.py

@ -1,5 +1,3 @@
import re
testinfra_hosts = ['icinga-host']
@ -59,25 +57,3 @@ def test_clean_update(host):
EOF
'''.format(domain, hostname, domain))
assert 0 == cmd.rc
def test_subdomain_creation(host):
test_domain = host.run("hostname -d").stdout.strip()
bind_host = host.get_host('ansible://bind-host',
ansible_inventory=host.backend.ansible_inventory)
bind_address = bind_host.ansible.get_variables()['ansible_host']
other_bind_address = '1.2.3.4'
localhost = host.get_host('ansible://localhost',
ansible_inventory=host.backend.ansible_inventory)
cmd = localhost.run('ssh -i ../../infrastructure_key '
'-o BatchMode=yes -o StrictHostKeyChecking=no '
'subdomain@{address} {ns_ip} subsubdomain.test.{test_domain}'.format(
ns_ip=other_bind_address,
address=bind_address,
test_domain=test_domain))
assert 0 == cmd.rc
assert "Creating " in cmd.stdout.strip()
domain = re.search(r'Creating (.*)', cmd.stdout).group(1),
cmd = host.run("dig +short ns-{}".format(domain[0]))
assert 0 == cmd.rc
assert cmd.stdout == other_bind_address, "looking for " + domain[0]
Loading…
Cancel
Save