mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-08 22:34:26 +00:00
ipaservice: Updated and new tests for certificates and multi service handling
The tests test_services_absent.yml, test_services_present.yml and test_services_present_slice.yml have been updated to use in memory data for testing instead of loading json files. This made is simpler to use variables from the playbook for example for fqdn host names. New tests for certificates with and without trailing new lines have been added for single service and multiple service handling.
This commit is contained in:
98
tests/service/generate_test_data.yml
Normal file
98
tests/service/generate_test_data.yml
Normal file
@@ -0,0 +1,98 @@
|
||||
# Generate lists for hosts and services
|
||||
---
|
||||
- name: Get Domain from server name
|
||||
ansible.builtin.set_fact:
|
||||
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join('.') }}"
|
||||
when: ipaserver_domain is not defined
|
||||
|
||||
- name: Create present services.json data
|
||||
ansible.builtin.shell: |
|
||||
echo "["
|
||||
for i in $(seq 1 "{{ NUM }}"); do
|
||||
echo " {"
|
||||
echo " \"name\": \"HTTP/www$i.{{ DOMAIN }}\","
|
||||
echo " \"principal\": \"host/test$i.{{ DOMAIN }}\","
|
||||
echo " \"force\": \"true\""
|
||||
if [ "$i" -lt "{{ NUM }}" ]; then
|
||||
echo " },"
|
||||
else
|
||||
echo " }"
|
||||
fi
|
||||
done
|
||||
echo "]"
|
||||
vars:
|
||||
NUM: 500
|
||||
DOMAIN: "{{ ipaserver_domain }}"
|
||||
register: command
|
||||
|
||||
- name: Set service_list
|
||||
ansible.builtin.set_fact:
|
||||
service_list: "{{ command.stdout | from_json }}"
|
||||
|
||||
- name: Create absent services.json data
|
||||
ansible.builtin.shell: |
|
||||
echo "["
|
||||
for i in $(seq 1 "{{ NUM }}"); do
|
||||
echo " {"
|
||||
echo " \"name\": \"HTTP/www$i.{{ DOMAIN }}\","
|
||||
echo " \"continue\": \"true\""
|
||||
if [ "$i" -lt "{{ NUM }}" ]; then
|
||||
echo " },"
|
||||
else
|
||||
echo " }"
|
||||
fi
|
||||
done
|
||||
echo "]"
|
||||
vars:
|
||||
NUM: 500
|
||||
DOMAIN: "{{ ipaserver_domain }}"
|
||||
register: command
|
||||
|
||||
- name: Set service_absent_list
|
||||
ansible.builtin.set_fact:
|
||||
service_absent_list: "{{ command.stdout | from_json }}"
|
||||
|
||||
- name: Create present hosts.json data
|
||||
ansible.builtin.shell: |
|
||||
echo "["
|
||||
for i in $(seq 1 "{{ NUM }}"); do
|
||||
echo " {"
|
||||
echo " \"name\": \"www$i.{{ DOMAIN }}\","
|
||||
echo " \"force\": \"true\""
|
||||
if [ "$i" -lt "{{ NUM }}" ]; then
|
||||
echo " },"
|
||||
else
|
||||
echo " }"
|
||||
fi
|
||||
done
|
||||
echo "]"
|
||||
vars:
|
||||
NUM: 500
|
||||
DOMAIN: "{{ ipaserver_domain }}"
|
||||
register: command
|
||||
|
||||
- name: Set host_list
|
||||
ansible.builtin.set_fact:
|
||||
host_list: "{{ command.stdout | from_json }}"
|
||||
|
||||
- name: Create absent hosts.json data
|
||||
ansible.builtin.shell: |
|
||||
echo "["
|
||||
for i in $(seq 1 "{{ NUM }}"); do
|
||||
echo " {"
|
||||
echo " \"name\": \"www$i.{{ DOMAIN }}\""
|
||||
if [ "$i" -lt "{{ NUM }}" ]; then
|
||||
echo " },"
|
||||
else
|
||||
echo " }"
|
||||
fi
|
||||
done
|
||||
echo "]"
|
||||
vars:
|
||||
NUM: 500
|
||||
DOMAIN: "{{ ipaserver_domain }}"
|
||||
register: command
|
||||
|
||||
- name: Set host_absent_list
|
||||
ansible.builtin.set_fact:
|
||||
host_absent_list: "{{ command.stdout | from_json }}"
|
||||
Reference in New Issue
Block a user