43942efb5d
As effort to sunset tests repo, we replace functional test that were running for the role with a molecule. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/938220 Change-Id: I2c11008541775e035256489383aa9db31a098635
286 lines
7.3 KiB
YAML
286 lines
7.3 KiB
YAML
---
|
|
# Copyright 2018, Rackspace US
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Test config_template
|
|
hosts: all
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- name: Read test data
|
|
delegate_to: localhost
|
|
block:
|
|
- name: Read expected test_extend.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_extend.yml.expected"
|
|
register: extend_file_expected
|
|
|
|
- name: Read expected test_no_extend.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_no_extend.yml.expected"
|
|
register: no_extend_file_expected
|
|
|
|
- name: Read expected test_content_no_overrides.json
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_content_no_overrides.json.expected"
|
|
register: content_no_overrides_file_expected
|
|
|
|
- name: Read expected test_multiline_strs.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_multiline_strs.yml.expected"
|
|
register: multiline_strs_file_expected
|
|
|
|
- name: Read expected test_multiline_strs.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_multiline_strs.json.expected"
|
|
register: multiline_strs_json_file_expected
|
|
|
|
- name: Read expected test_list_only_extend.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_list_only_extend.yml.expected"
|
|
register: test_list_only_extend_file_expected
|
|
|
|
- name: Read expected test_list_only_replace.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_list_only_replace.yml.expected"
|
|
register: test_list_only_replace_file_expected
|
|
|
|
- name: Read expected test_jinja_variables.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_jinja_variables.yml.expected"
|
|
register: test_jinja_variables_expected
|
|
|
|
- name: Read expected test_jinja_variables.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_raw_content.ini.expected"
|
|
register: test_raw_content_expected
|
|
|
|
- import_tasks: test-common-tasks.yml
|
|
|
|
handlers:
|
|
- name: test_extend_yml check diff
|
|
assert:
|
|
that:
|
|
- test_extend_yml.diff[0].prepared|from_json == diff_extend_yml
|
|
|
|
- name: test_no_extend_yml check diff
|
|
assert:
|
|
that:
|
|
- test_no_extend_yml.diff[0].prepared|from_json == diff_no_extend_yml
|
|
|
|
- name: test_hostvars_yml check diff
|
|
assert:
|
|
that:
|
|
- test_hostvars_yml.diff[0].prepared|from_yaml == diff_hostvars_yml
|
|
|
|
- name: test_content_no_overrides_json check diff
|
|
assert:
|
|
that:
|
|
- test_content_no_overrides_json.diff[0].prepared|from_json == diff_content_no_overrides_json
|
|
|
|
- name: test_diff_ini check diff
|
|
tags: test
|
|
assert:
|
|
that:
|
|
- test_diff_ini.diff[0].prepared|from_json == diff_diff_ini
|
|
|
|
- name: test_diff_remove_ini check diff
|
|
tags: test
|
|
assert:
|
|
that:
|
|
- test_diff_remove_ini.diff[0].prepared|from_json == diff_diff_remove_ini
|
|
|
|
vars:
|
|
test_config_ini_overrides:
|
|
DEFAULT:
|
|
new_key: "new_value"
|
|
foo:
|
|
baz: "bar"
|
|
section1:
|
|
key1: "String1"
|
|
key10: 10
|
|
key11: 11
|
|
key2: "string2"
|
|
key3: "string3"
|
|
key4: "string4"
|
|
key5: "string5"
|
|
key6: "string6"
|
|
key7: 1
|
|
key8: 2
|
|
key9: 3
|
|
section10:
|
|
key1: 1
|
|
section11:
|
|
key1: 1
|
|
section2:
|
|
key1: "value1"
|
|
section3:
|
|
key1: "value1"
|
|
section4:
|
|
key1: "value1"
|
|
section5:
|
|
key1: "value1"
|
|
section6:
|
|
key1: "value1"
|
|
section7:
|
|
key1: "value1"
|
|
section8:
|
|
key1: 1
|
|
section9:
|
|
key1: 1
|
|
test_config_yml_overrides:
|
|
list_one:
|
|
- four
|
|
- 4
|
|
test_config_yml_hostvars_overrides:
|
|
test_hostvar: "{{ ansible_facts['architecture'] }}"
|
|
test_multiline_strs_yml_overrides:
|
|
new_multiline_str: |
|
|
This should not
|
|
be a list
|
|
test_multiline_strs_json_overrides:
|
|
"list": "Curious cat investigates\n, a ball of yarn in sight"
|
|
"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - htop"
|
|
test_list_only_overrides:
|
|
- things: stuff
|
|
test_default_section_overrides:
|
|
global:
|
|
test2: 2
|
|
section1:
|
|
setting2: 2
|
|
test_diff_overrides:
|
|
section1:
|
|
baz: "hotel"
|
|
section3:
|
|
alfa: "bravo"
|
|
test_jinja_variables:
|
|
section1:
|
|
baz: "baz"
|
|
test_raw_content_variable: "delta"
|
|
test_raw_content_overrides:
|
|
section2:
|
|
alfa: "{{ test_raw_content_variable }}"
|
|
test_enhanced_comments_ini_overrides:
|
|
DEFAULT:
|
|
default_availability_zone: zone1
|
|
instance_usage_audit_period: blah blah blah
|
|
password_length: 100
|
|
test:
|
|
- test1
|
|
- test2
|
|
TestSection:
|
|
things: stuff
|
|
SubSection:
|
|
testop2: below 9000
|
|
diff_ini:
|
|
added:
|
|
DEFAULT:
|
|
new_key: "new_value"
|
|
foo:
|
|
baz: "bar"
|
|
section1:
|
|
key1: "String1"
|
|
key10: "10"
|
|
key11: "11"
|
|
key2: "string2"
|
|
key3: "string3"
|
|
key4: "string4"
|
|
key5: "string5"
|
|
key6: "string6"
|
|
key7: "1"
|
|
key8: "2"
|
|
key9: "3"
|
|
section10:
|
|
key1: "1"
|
|
section11:
|
|
key1: "1"
|
|
section2:
|
|
key1: "value1"
|
|
section3:
|
|
key1: "value1"
|
|
section4:
|
|
key1: "value1"
|
|
section5:
|
|
key1: "value1"
|
|
section6:
|
|
key1: "value1"
|
|
section7:
|
|
key1: "value1"
|
|
section8:
|
|
key1: "1"
|
|
section9:
|
|
key1: "1"
|
|
changed: {}
|
|
removed: {}
|
|
diff_extend_yml:
|
|
added:
|
|
list_one:
|
|
- "one"
|
|
- "two"
|
|
- "three"
|
|
- "four"
|
|
- 4
|
|
list_two:
|
|
- "one"
|
|
- "two"
|
|
changed: {}
|
|
removed: {}
|
|
diff_no_extend_yml:
|
|
added:
|
|
list_one:
|
|
- "four"
|
|
- 4
|
|
list_two:
|
|
- "one"
|
|
- "two"
|
|
changed: {}
|
|
removed: {}
|
|
diff_hostvars_yml:
|
|
added:
|
|
list_one:
|
|
- "one"
|
|
- "two"
|
|
- "three"
|
|
list_two:
|
|
- "one"
|
|
- "two"
|
|
test_hostvar: "{{ ansible_facts['architecture'] }}"
|
|
changed: {}
|
|
removed: {}
|
|
diff_content_no_overrides_json:
|
|
added:
|
|
alfa: "bravo"
|
|
charlie: "echo"
|
|
foxtrot:
|
|
golf: "hotel"
|
|
changed: {}
|
|
removed: {}
|
|
diff_diff_ini:
|
|
added:
|
|
section3:
|
|
alfa: "bravo"
|
|
changed:
|
|
section1:
|
|
baz:
|
|
current_val: "baz"
|
|
new_val: "hotel"
|
|
removed: {}
|
|
diff_diff_remove_ini:
|
|
added: {}
|
|
changed: {}
|
|
removed:
|
|
section2:
|
|
foo: "bar"
|