mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-30 11:24:50 +00:00
tests/user/test_users_present_*: Use new generate_test_data.yml
The new generate_test_data.yml is creating the test data with ansible.builtin.shell and is not calling shell scripts any more. The generation in the yml file and also the set_fact calls make sure that the test data is used.
This commit is contained in:
48
tests/user/generate_test_data.yml
Normal file
48
tests/user/generate_test_data.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
# Generate lists for users
|
||||
---
|
||||
- name: Create present services.json data
|
||||
ansible.builtin.shell: |
|
||||
date=$(date --date='+2 years' "+%Y-%m-%d %H:%M:%S")
|
||||
echo "["
|
||||
for i in $(seq -w 1 "{{ NUM }}"); do
|
||||
echo " {"
|
||||
echo " \"name\": \"testuser_${i}\","
|
||||
echo " \"first\": \"First ${i}\","
|
||||
echo " \"last\": \"Last ${i}\","
|
||||
echo " \"password\": \"user${i}PW\","
|
||||
echo " \"passwordexpiration\": \"${date}\""
|
||||
if [ "$i" -lt "{{ NUM }}" ]; then
|
||||
echo " },"
|
||||
else
|
||||
echo " }"
|
||||
fi
|
||||
done
|
||||
echo "]"
|
||||
vars:
|
||||
NUM: 500
|
||||
register: command
|
||||
|
||||
- name: Set user_list
|
||||
ansible.builtin.set_fact:
|
||||
user_list: "{{ command.stdout | from_json }}"
|
||||
|
||||
- name: Create absent user.json data
|
||||
ansible.builtin.shell: |
|
||||
echo "["
|
||||
for i in $(seq -w 1 "{{ NUM }}"); do
|
||||
echo " {"
|
||||
echo " \"name\": \"testuser_${i}\""
|
||||
if [ "$i" -lt "{{ NUM }}" ]; then
|
||||
echo " },"
|
||||
else
|
||||
echo " }"
|
||||
fi
|
||||
done
|
||||
echo "]"
|
||||
vars:
|
||||
NUM: 500
|
||||
register: command
|
||||
|
||||
- name: Set user_absent_list
|
||||
ansible.builtin.set_fact:
|
||||
user_absent_list: "{{ command.stdout | from_json }}"
|
||||
Reference in New Issue
Block a user