Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/lookup_random_pet/test.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - hosts: localhost
7 gather_facts: false
8 tasks:
9 - name: Call plugin
10 set_fact:
11 result1: "{{ query('community.general.random_pet', words=3) }}"
12 result2: "{{ query('community.general.random_pet', length=3) }}"
13 result3: "{{ query('community.general.random_pet', prefix='kubernetes') }}"
14 result4: "{{ query('community.general.random_pet', separator='_') }}"
15 result5: "{{ query('community.general.random_pet', words=2, length=6, prefix='kubernetes', separator='_') }}"
16
17 - name: Check results
18 assert:
19 that:
20 - result1 | length == 1
21 - result1[0].split('-') | length == 3
22 - result2 | length == 1
23 - result2[0].split('-')[0] | length <= 3
24 - result3 | length == 1
25 - result3[0].split('-')[0] == 'kubernetes'
26 - result4 | length == 1
27 - result4[0].split('_') | length == 2
28 - result5 | length == 1
29 - result5[0].split('_') | length == 3
30 - result5[0].split('_')[0] == 'kubernetes'