File tree 15 files changed +43
-40
lines changed
tests/integration/targets
filter_groupby_as_dict/tasks
filter_replace_keys/tasks
15 files changed +43
-40
lines changed Original file line number Diff line number Diff line change 33
33
that :
34
34
- result is changed
35
35
- result.binding_rule.AuthMethod == 'test'
36
- - result.binding .Description == 'test-binding : my description'
36
+ - " result.binding_rule .Description == 'test-binding: my description'"
37
37
- result.operation == 'create'
38
38
39
39
- name : Update a binding rule
46
46
- assert :
47
47
that :
48
48
- result is changed
49
- - result.binding .Description == 'test-binding : my description'
49
+ - " result.binding_rule .Description == 'test-binding: my description'"
50
50
- result.operation == 'update'
51
51
52
52
- name : Update a binding rule (noop)
58
58
- assert :
59
59
that :
60
60
- result is not changed
61
- - result.binding .Description == 'test-binding : my description'
61
+ - " result.binding_rule .Description == 'test-binding: my description'"
62
62
- result.operation is not defined
63
63
64
64
- name : Delete a binding rule
Original file line number Diff line number Diff line change 22
22
- assert :
23
23
that :
24
24
- simple_create_result is changed
25
- - simple_create_result.token.AccessorID
25
+ - simple_create_result.token.AccessorID is truthy
26
26
- simple_create_result.operation == 'create'
27
27
28
28
- name : Create token
84
84
- assert :
85
85
that :
86
86
- result is changed
87
- - not result.token
87
+ - result.token is falsy
88
88
- result.operation == 'remove'
Original file line number Diff line number Diff line change 123
123
register : releases_path
124
124
- stat : path={{ deploy_helper.shared_path }}
125
125
register : shared_path
126
+ when : deploy_helper.shared_path is truthy
126
127
- name : Assert State=present with shared_path set to False
127
128
assert :
128
129
that :
129
130
- " releases_path.stat.exists"
130
- - " not shared_path.stat.exists"
131
+ - " deploy_helper.shared_path is falsy or not shared_path.stat.exists"
131
132
132
133
# Setup older releases for tests
133
134
- file : path={{ deploy_helper.releases_path }}/{{ item }} state=directory
Original file line number Diff line number Diff line change 30
30
assert :
31
31
that :
32
32
- integer_result is failed
33
- - integer_result.msg is match ('Invalid value type.* ')
33
+ - integer_result.msg is search ('Invalid value type')
34
34
- non_uniform_list_result is failed
35
- - non_uniform_list_result.msg is match('Unexpected templating type error.* can only concatenate str.* ')
35
+ - non_uniform_list_result.msg is search(' can only concatenate str')
Original file line number Diff line number Diff line change 26
26
assert :
27
27
that :
28
28
- res is failed
29
- - res.msg is match ('Argument for community.general.counter must be a sequence')
29
+ - res.msg is search ('Argument for community.general.counter must be a sequence')
30
30
31
31
- name : test fail element not hashable
32
32
debug :
38
38
assert :
39
39
that :
40
40
- res is failed
41
- - res.msg is match ('community.general.counter needs a sequence with hashable elements')
41
+ - res.msg is search ('community.general.counter needs a sequence with hashable elements')
Original file line number Diff line number Diff line change 51
51
assert :
52
52
that :
53
53
- _invalid_csv_strict_true is failed
54
- - _invalid_csv_strict_true.msg is match ('Unable to process file:.*')
54
+ - _invalid_csv_strict_true.msg is search ('Unable to process file:.*')
Original file line number Diff line number Diff line change 16
16
17
17
- assert :
18
18
that :
19
- - result.msg == 'Input is not a sequence'
19
+ - result.msg is search( 'Input is not a sequence')
20
20
21
21
- name : ' Test error: list element not a mapping'
22
22
set_fact :
26
26
27
27
- assert :
28
28
that :
29
- - " result.msg == 'Sequence element #0 is not a mapping'"
29
+ - " result.msg is search( 'Sequence element #0 is not a mapping') "
30
30
31
31
- name : ' Test error: list element does not have attribute'
32
32
set_fact :
36
36
37
37
- assert :
38
38
that :
39
- - " result.msg == 'Attribute not contained in element #1 of sequence'"
39
+ - " result.msg is search( 'Attribute not contained in element #1 of sequence') "
40
40
41
41
- name : ' Test error: attribute collision'
42
42
set_fact :
46
46
47
47
- assert :
48
48
that :
49
- - result.msg == "Multiple sequence entries have attribute value 'a'" or result.msg == "Multiple sequence entries have attribute value u 'a'"
49
+ - result.msg is search( "Multiple sequence entries have attribute value u? 'a'")
Original file line number Diff line number Diff line change 31
31
32
32
- name : Register result of invalid salt
33
33
debug :
34
- var : " invalid_input | community.general.hashids_encode(salt=10)"
34
+ var : " single_int | community.general.hashids_encode(salt=10)"
35
35
register : invalid_salt_message
36
36
ignore_errors : true
37
37
42
42
43
43
- name : Register result of invalid alphabet
44
44
debug :
45
- var : " invalid_input | community.general.hashids_encode(alphabet='abc')"
45
+ var : " single_int | community.general.hashids_encode(alphabet='abc')"
46
46
register : invalid_alphabet_message
47
47
ignore_errors : true
48
48
53
53
54
54
- name : Register result of invalid min_length
55
55
debug :
56
- var : " invalid_input | community.general.hashids_encode(min_length='foo')"
56
+ var : " single_int | community.general.hashids_encode(min_length='foo')"
57
57
register : invalid_min_length_message
58
58
ignore_errors : true
59
59
Original file line number Diff line number Diff line change 6
6
- name : Debug ansible_version
7
7
ansible.builtin.debug :
8
8
var : ansible_version
9
- when : not quite_test | d (true) | bool
9
+ when : not (quiet_test | default (true) | bool)
10
10
tags : ansible_version
11
11
12
12
- name : Tests
19
19
fail_msg : |
20
20
[ERR] result:
21
21
{{ result | to_yaml }}
22
- quiet : " {{ quiet_test | d (true) | bool }}"
22
+ quiet : " {{ quiet_test | default (true) | bool }}"
23
23
loop : " {{ tests | subelements('group') }}"
24
24
loop_control :
25
25
loop_var : i
26
- label : " {{ i.1.mp | d ('default') }}: {{ i.1.tt }}"
26
+ label : " {{ i.1.mp | default ('default') }}: {{ i.1.tt }}"
27
27
vars :
28
28
input : " {{ i.0.input }}"
29
29
target : " {{ i.1.tt }}"
30
- mp : " {{ i.1.mp | d ('default') }}"
30
+ mp : " {{ i.1.mp | default ('default') }}"
31
31
result : " {{ lookup('template', i.0.template) }}"
Original file line number Diff line number Diff line change 19
19
assert :
20
20
that :
21
21
- _bad_random_mac_filter is failed
22
- - " _bad_random_mac_filter.msg is match ('Invalid value type (.*int.*) for random_mac .*')"
22
+ - " _bad_random_mac_filter.msg is search ('Invalid value type (.*int.*) for random_mac .*')"
23
23
24
24
- name : Test random_mac filter bad argument value
25
25
debug :
31
31
assert :
32
32
that :
33
33
- _bad_random_mac_filter is failed
34
- - " _bad_random_mac_filter.msg is match ('Invalid value (.*) for random_mac: .* not hexa byte')"
34
+ - " _bad_random_mac_filter.msg is search ('Invalid value (.*) for random_mac: .* not hexa byte')"
35
35
36
36
- name : Test random_mac filter prefix too big
37
37
debug :
43
43
assert :
44
44
that :
45
45
- _bad_random_mac_filter is failed
46
- - " _bad_random_mac_filter.msg is match ('Invalid value (.*) for random_mac: 5 colon.* separated items max')"
46
+ - " _bad_random_mac_filter.msg is search ('Invalid value (.*) for random_mac: 5 colon.* separated items max')"
47
47
48
48
- name : Verify random_mac filter
49
49
assert :
Original file line number Diff line number Diff line change 6
6
- name : Debug ansible_version
7
7
ansible.builtin.debug :
8
8
var : ansible_version
9
- when : not quite_test | d (true) | bool
9
+ when : not (quiet_test | default (true) | bool)
10
10
tags : ansible_version
11
11
12
12
- name : Tests
19
19
fail_msg : |
20
20
[ERR] result:
21
21
{{ result | to_yaml }}
22
- quiet : " {{ quiet_test | d (true) | bool }}"
22
+ quiet : " {{ quiet_test | default (true) | bool }}"
23
23
loop : " {{ tests | subelements('group') }}"
24
24
loop_control :
25
25
loop_var : i
26
- label : " {{ i.1.mp | d ('default') }}: {{ i.1.tt }}"
26
+ label : " {{ i.1.mp | default ('default') }}: {{ i.1.tt }}"
27
27
vars :
28
28
input : " {{ i.0.input }}"
29
29
target : " {{ i.1.tt }}"
30
- mp : " {{ i.1.mp | d ('default') }}"
30
+ mp : " {{ i.1.mp | default ('default') }}"
31
31
result : " {{ lookup('template', i.0.template) }}"
Original file line number Diff line number Diff line change 6
6
- name : Debug ansible_version
7
7
ansible.builtin.debug :
8
8
var : ansible_version
9
- when : not quite_test | d (true) | bool
9
+ when : not (quiet_test | default (true) | bool)
10
10
tags : ansible_version
11
11
12
12
- name : Tests
19
19
fail_msg : |
20
20
[ERR] result:
21
21
{{ result | to_yaml }}
22
- quiet : " {{ quiet_test | d (true) | bool }}"
22
+ quiet : " {{ quiet_test | default (true) | bool }}"
23
23
loop : " {{ tests | subelements('group') }}"
24
24
loop_control :
25
25
loop_var : i
26
- label : " {{ i.1.mp | d ('default') }}: {{ i.1.tt }}"
26
+ label : " {{ i.1.mp | default ('default') }}: {{ i.1.tt }}"
27
27
vars :
28
28
input : " {{ i.0.input }}"
29
29
target : " {{ i.1.tt }}"
30
- mp : " {{ i.1.mp | d ('default') }}"
30
+ mp : " {{ i.1.mp | default ('default') }}"
31
31
result : " {{ lookup('template', i.0.template) }}"
Original file line number Diff line number Diff line change 51
51
- orig_stat.stat.size == stat_test_1.stat.size
52
52
- orig_stat.stat.checksum == stat_test_1.stat.checksum
53
53
- orig_stat.stat.mtime == stat_test_1.stat.mtime
54
- - stat_test_1.stat.checksum == expected_content | checksum
54
+ - stat_test_1.stat.checksum == ( expected_content | trim + '\n') | checksum
55
55
vars :
56
56
expected_content : |
57
57
# Copyright (c) Ansible Project
83
83
assert :
84
84
that :
85
85
- bl_test_2 is changed
86
- - slurp_test_2.content|b64decode == content
86
+ - slurp_test_2.content|b64decode == ( content | trim + '\n')
87
87
vars :
88
88
content : |
89
89
# Copyright (c) Ansible Project
111
111
assert :
112
112
that :
113
113
- bl_test_3 is changed
114
- - slurp_test_3.content|b64decode == content
114
+ - slurp_test_3.content|b64decode == ( content | trim + '\n')
115
115
vars :
116
116
content : |
117
117
# Copyright (c) Ansible Project
Original file line number Diff line number Diff line change 151
151
- result.end_state.config.enabled == ["true"]
152
152
- result.end_state.config.algorithm == ["RS256"]
153
153
- result.end_state.config.priority == ["140"]
154
- - result.msg == "Realm key testkey would be changed : config.priority ['150'] -> ['140']"
154
+ - >-
155
+ result.msg == "Realm key testkey would be changed: config.priority ['150'] -> ['140']"
155
156
156
157
- name : Update custom realm key
157
158
community.general.keycloak_realm_key :
184
185
- result.end_state.config.enabled == ["true"]
185
186
- result.end_state.config.algorithm == ["RS256"]
186
187
- result.end_state.config.priority == ["140"]
187
- - result.msg == "Realm key testkey changed : config.priority ['150'] -> ['140']"
188
+ - >-
189
+ result.msg == "Realm key testkey changed: config.priority ['150'] -> ['140']"
188
190
189
191
- name : Update custom realm key (test for idempotency)
190
192
community.general.keycloak_realm_key :
Original file line number Diff line number Diff line change 25
25
- name : install cron package
26
26
package :
27
27
name : ' {{ cron_pkg }}'
28
- when : cron_pkg | default(false, true)
28
+ when : ( cron_pkg | default(false, true)) is truthy
29
29
register : cron_package_installed
30
30
until : cron_package_installed is success
31
- - when : faketime_pkg | default(false, true)
31
+ - when : ( faketime_pkg | default(false, true)) is truthy
32
32
block :
33
33
- name : install cron and faketime packages
34
34
package :
You can’t perform that action at this time.
0 commit comments