summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/dns/tests/integration
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
commit38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch)
tree356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/community/dns/tests/integration
parentAdding upstream version 7.7.0+dfsg. (diff)
downloadansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz
ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/community/dns/tests/integration')
-rwxr-xr-xansible_collections/community/dns/tests/integration/replace-requirements.sh10
-rw-r--r--ansible_collections/community/dns/tests/integration/requirements-stable-2.10.txt (renamed from ansible_collections/community/dns/tests/integration/targets/wait_for_txt/runme.yml)7
-rw-r--r--ansible_collections/community/dns/tests/integration/requirements-stable-2.9.txt7
-rw-r--r--ansible_collections/community/dns/tests/integration/requirements.txt7
-rw-r--r--ansible_collections/community/dns/tests/integration/targets/lookup_lookup/aliases5
-rw-r--r--ansible_collections/community/dns/tests/integration/targets/lookup_lookup/tasks/main.yml26
-rw-r--r--ansible_collections/community/dns/tests/integration/targets/lookup_lookup_as_dict/aliases5
-rw-r--r--ansible_collections/community/dns/tests/integration/targets/lookup_lookup_as_dict/tasks/main.yml31
-rw-r--r--ansible_collections/community/dns/tests/integration/targets/nameserver_info/tasks/main.yml78
-rw-r--r--ansible_collections/community/dns/tests/integration/targets/nameserver_record_info/tasks/main.yml56
-rw-r--r--ansible_collections/community/dns/tests/integration/targets/wait_for_txt/aliases1
-rwxr-xr-xansible_collections/community/dns/tests/integration/targets/wait_for_txt/runme.sh16
-rw-r--r--ansible_collections/community/dns/tests/integration/targets/wait_for_txt/tasks/main.yml2
13 files changed, 229 insertions, 22 deletions
diff --git a/ansible_collections/community/dns/tests/integration/replace-requirements.sh b/ansible_collections/community/dns/tests/integration/replace-requirements.sh
new file mode 100755
index 000000000..c3a52f5d1
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/replace-requirements.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+DIRECTORY="$(dirname "$0")"
+
+if [ -e "${DIRECTORY}/$1" ]; then
+ cp "${DIRECTORY}/$1" "${DIRECTORY}/requirements.txt"
+fi
diff --git a/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/runme.yml b/ansible_collections/community/dns/tests/integration/requirements-stable-2.10.txt
index bcecb88e9..af90be668 100644
--- a/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/runme.yml
+++ b/ansible_collections/community/dns/tests/integration/requirements-stable-2.10.txt
@@ -1,8 +1,7 @@
----
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
-- hosts: localhost
- roles:
- - { role: wait_for_txt }
+ipaddress ; python_version < '3.3'
+
+dnspython < 2.4.0
diff --git a/ansible_collections/community/dns/tests/integration/requirements-stable-2.9.txt b/ansible_collections/community/dns/tests/integration/requirements-stable-2.9.txt
new file mode 100644
index 000000000..af90be668
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/requirements-stable-2.9.txt
@@ -0,0 +1,7 @@
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+ipaddress ; python_version < '3.3'
+
+dnspython < 2.4.0
diff --git a/ansible_collections/community/dns/tests/integration/requirements.txt b/ansible_collections/community/dns/tests/integration/requirements.txt
new file mode 100644
index 000000000..5e4bca63f
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/requirements.txt
@@ -0,0 +1,7 @@
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+ipaddress ; python_version < '3.3'
+
+dnspython
diff --git a/ansible_collections/community/dns/tests/integration/targets/lookup_lookup/aliases b/ansible_collections/community/dns/tests/integration/targets/lookup_lookup/aliases
new file mode 100644
index 000000000..abc0d5476
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/targets/lookup_lookup/aliases
@@ -0,0 +1,5 @@
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+shippable/posix/group1
diff --git a/ansible_collections/community/dns/tests/integration/targets/lookup_lookup/tasks/main.yml b/ansible_collections/community/dns/tests/integration/targets/lookup_lookup/tasks/main.yml
new file mode 100644
index 000000000..52ba9a46c
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/targets/lookup_lookup/tasks/main.yml
@@ -0,0 +1,26 @@
+---
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+- name: Look up some records
+ ansible.builtin.set_fact:
+ ansible_a: >-
+ {{ query('community.dns.lookup', 'ansible.com', type='A') }}
+ ansible_aaaa: >-
+ {{ query('community.dns.lookup', 'ansible.com', type='AAAA', server='9.9.9.9') }}
+ ansible_txt: >-
+ {{ query('community.dns.lookup', 'ansible.com', type='TXT', server=['1.1.1.1', '8.8.8.8', 'dns9.quad9.net.']) }}
+ ansible_empty: >-
+ {{ query('community.dns.lookup', 'does-not-exist.ansible.com') }}
+
+- name: Check results
+ assert:
+ that:
+ - ansible_a | length > 0
+ - ansible_a[0] is regex("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$")
+ - ansible_aaaa | length > 0
+ - ansible_aaaa[0] is regex("^[0-9a-fA-F:]+$")
+ - ansible_txt | length > 0
+ - ansible_txt[0] is string
+ - ansible_empty | length == 0
diff --git a/ansible_collections/community/dns/tests/integration/targets/lookup_lookup_as_dict/aliases b/ansible_collections/community/dns/tests/integration/targets/lookup_lookup_as_dict/aliases
new file mode 100644
index 000000000..abc0d5476
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/targets/lookup_lookup_as_dict/aliases
@@ -0,0 +1,5 @@
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+shippable/posix/group1
diff --git a/ansible_collections/community/dns/tests/integration/targets/lookup_lookup_as_dict/tasks/main.yml b/ansible_collections/community/dns/tests/integration/targets/lookup_lookup_as_dict/tasks/main.yml
new file mode 100644
index 000000000..3ba6f52f0
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/targets/lookup_lookup_as_dict/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+- name: Look up some records
+ ansible.builtin.set_fact:
+ ansible_a: >-
+ {{ query('community.dns.lookup_as_dict', 'ansible.com', type='A') }}
+ ansible_aaaa: >-
+ {{ query('community.dns.lookup_as_dict', 'ansible.com', type='AAAA', server='9.9.9.9') }}
+ ansible_txt: >-
+ {{ query('community.dns.lookup_as_dict', 'ansible.com', type='TXT', server=['1.1.1.1', '8.8.8.8', 'dns9.quad9.net.']) }}
+ ansible_empty: >-
+ {{ query('community.dns.lookup_as_dict', 'does-not-exist.ansible.com') }}
+
+- name: Check results
+ assert:
+ that:
+ - ansible_a | length > 0
+ - ansible_a[0].address is string
+ - ansible_a[0].address is regex("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$")
+ - ansible_aaaa | length > 0
+ - ansible_aaaa[0].address is string
+ - ansible_aaaa[0].address is regex("^[0-9a-fA-F:]+$")
+ - ansible_txt | length > 0
+ - ansible_txt[0].strings is sequence
+ - ansible_txt[0].strings[0] is string
+ - ansible_txt[0].value is string
+ - ansible_txt | map(attribute='strings') | map('join') | list == ansible_txt | map(attribute='value') | list
+ - ansible_empty | length == 0
diff --git a/ansible_collections/community/dns/tests/integration/targets/nameserver_info/tasks/main.yml b/ansible_collections/community/dns/tests/integration/targets/nameserver_info/tasks/main.yml
new file mode 100644
index 000000000..0b074df5a
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/targets/nameserver_info/tasks/main.yml
@@ -0,0 +1,78 @@
+---
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+- name: Retrieve name servers of two DNS names
+ community.dns.nameserver_info:
+ name:
+ - www.example.com
+ - example.org
+ register: result
+
+- name: Show TXT values for www.example.com for all nameservers
+ ansible.builtin.debug:
+ msg: '{{ result }}'
+
+- name: Show nameservers for www.example.com
+ ansible.builtin.debug:
+ msg: '{{ result.results[0].nameservers }}'
+
+- name: Show TXT values for www.example.com for all nameservers
+ ansible.builtin.debug:
+ msg: '{{ result.results[0].nameservers[0] }}'
+
+- name: Validate results
+ assert:
+ that:
+ - result.results[0].nameservers[0] == 'a.iana-servers.net.'
+ - result.results[0].nameservers[1] == 'b.iana-servers.net.'
+ - result.results[0].nameservers[0] != 'b.iana-servers.net.'
+
+- name: Retrieve name servers of two DNS names using custom DNS servers
+ community.dns.nameserver_info:
+ name:
+ - www.example.com
+ - example.org
+ server:
+ # Quad9 servers (https://en.wikipedia.org/wiki/Quad9#Service)
+ - 9.9.9.9
+ - 149.112.112.112
+ - 2620:fe::9
+ - 2620:fe::fe
+ register: result
+
+- name: Show TXT values for www.example.com for all nameservers
+ ansible.builtin.debug:
+ msg: '{{ result }}'
+
+- name: Show nameservers for www.example.com
+ ansible.builtin.debug:
+ msg: '{{ result.results[0].nameservers }}'
+
+- name: Show TXT values for www.example.com for first nameserver
+ ansible.builtin.debug:
+ msg: '{{ result.results[0].nameservers[0] }}'
+
+- name: Validate results
+ assert:
+ that:
+ - result.results[0].nameservers[0] == 'a.iana-servers.net.'
+ - result.results[0].nameservers[1] == 'b.iana-servers.net.'
+ - result.results[0].nameservers[0] != 'b.iana-servers.net.'
+
+- name: Retrieve name servers of a DNS name that do not exist
+ community.dns.nameserver_info:
+ name:
+ - foo.bar.example.com
+ register: result
+
+- name: Show TXT values for www.example.com for all nameservers
+ ansible.builtin.debug:
+ msg: '{{ result }}'
+
+- name: Validate results
+ assert:
+ that:
+ - result.results[0].nameservers[0] == 'a.iana-servers.net.'
+ - result.results[0].nameservers[1] == 'b.iana-servers.net.'
diff --git a/ansible_collections/community/dns/tests/integration/targets/nameserver_record_info/tasks/main.yml b/ansible_collections/community/dns/tests/integration/targets/nameserver_record_info/tasks/main.yml
new file mode 100644
index 000000000..b03b641fe
--- /dev/null
+++ b/ansible_collections/community/dns/tests/integration/targets/nameserver_record_info/tasks/main.yml
@@ -0,0 +1,56 @@
+---
+# Copyright (c) Ansible Project
+# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+- name: Retrieve TXT values from all nameservers for two DNS names
+ community.dns.nameserver_record_info:
+ name:
+ - www.example.com
+ - example.org
+ type: TXT
+ register: result
+
+- name: Show TXT values for www.example.com for all nameservers
+ ansible.builtin.debug:
+ msg: '{{ result }}'
+
+- name: Show TXT values for www.example.com for first nameserver
+ ansible.builtin.debug:
+ msg: '{{ result.results[0].result[0].nameserver }}'
+
+- name: Validate results
+ assert:
+ that:
+ - result.results[0].result[0].nameserver == 'a.iana-servers.net.'
+ - result.results[0].result[1].nameserver == 'b.iana-servers.net.'
+ - result.results[0].result[0].nameserver != 'b.iana-servers.net.'
+
+- name: Retrieve TXT values from all nameservers for two DNS names using custom DNS servers
+ community.dns.nameserver_record_info:
+ name:
+ - www.example.com
+ - example.org
+ type: TXT
+ server:
+ # Quad9 servers (https://en.wikipedia.org/wiki/Quad9#Service)
+ - 9.9.9.9
+ - 149.112.112.112
+ - 2620:fe::9
+ - 2620:fe::fe
+ register: result
+
+- name: Show TXT values for www.example.com for all nameservers
+ ansible.builtin.debug:
+ msg: '{{ result }}'
+
+- name: Show TXT values for www.example.com for all nameservers
+ ansible.builtin.debug:
+ msg: '{{ result.results[0].result[0].nameserver }}'
+
+- name: Validate results
+ assert:
+ that:
+ - result.results[0].result[0].nameserver == 'a.iana-servers.net.'
+ - result.results[0].result[1].nameserver == 'b.iana-servers.net.'
+ - result.results[0].result[0].nameserver != 'b.iana-servers.net.'
diff --git a/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/aliases b/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/aliases
index 34334fd82..abc0d5476 100644
--- a/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/aliases
+++ b/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/aliases
@@ -3,4 +3,3 @@
# SPDX-License-Identifier: GPL-3.0-or-later
shippable/posix/group1
-destructive
diff --git a/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/runme.sh b/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/runme.sh
deleted file mode 100755
index 9265e7ee1..000000000
--- a/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/runme.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) Ansible Project
-# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-set -eux
-
-export ANSIBLE_TEST_PREFER_VENV=1 # see https://github.com/ansible/ansible/pull/73000#issuecomment-757012395; can be removed once Ansible 2.9 and ansible-base 2.10 support has been dropped
-source virtualenv.sh
-
-# Requirements have to be installed prior to running ansible-playbook
-# because plugins and requirements are loaded before the task runs
-
-pip install dnspython
-
-ANSIBLE_ROLES_PATH=../ ansible-playbook runme.yml "$@"
diff --git a/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/tasks/main.yml b/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/tasks/main.yml
index fce443423..b706cfcae 100644
--- a/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/tasks/main.yml
+++ b/ansible_collections/community/dns/tests/integration/targets/wait_for_txt/tasks/main.yml
@@ -8,7 +8,7 @@
records:
- name: github.com
values: |
- {{ query('community.general.dig', 'github.com', 'qtype=TXT') | map('regex_replace', '" "', '') | list }}
+ {{ query('community.dns.lookup_as_dict', 'github.com', type='TXT') | map(attribute='value') | list }}
- name: github.io
values: []
query_timeout: 20