diff --git a/tests/files/test_multistropts.ini.expected b/tests/files/test_multistropts.ini.expected new file mode 100644 index 0000000..1847ea2 --- /dev/null +++ b/tests/files/test_multistropts.ini.expected @@ -0,0 +1,7 @@ +[multistropts] +test = test1 +test = test2 +test = test3 + +[testsection] +test = output diff --git a/tests/templates/test_multistropts.ini b/tests/templates/test_multistropts.ini new file mode 100644 index 0000000..ba2d61c --- /dev/null +++ b/tests/templates/test_multistropts.ini @@ -0,0 +1,5 @@ +[multistropts] +test = test1 +test = test2 +test = test3 + diff --git a/tests/test-common-tasks.yml b/tests/test-common-tasks.yml index 0d94a00..9964da5 100644 --- a/tests/test-common-tasks.yml +++ b/tests/test-common-tasks.yml @@ -128,6 +128,42 @@ that: - "((hostvars_file.content | b64decode | from_yaml).test_hostvar) == (test_config_yml_hostvars_overrides.test_hostvar)" +# Test multistropt ordering +- name: Template MultiStrOpts using overrides + config_template: + src: test_multistropts.ini + dest: /tmp/test_multistropts.ini + config_overrides: + testsection: + test: output + config_type: ini +- name: Create expected MultiStrOpts file + copy: + src: files/test_multistropts.ini.expected + dest: /tmp/test_multistropts.ini.expected + +- name: Read test_multistropts.ini + slurp: + src: /tmp/test_multistropts.ini + register: multistropts_file +- name: Read test_multistropts.ini.expected + slurp: + src: /tmp/test_multistropts.ini.expected + register: multistropts_expected_file +- name: Set content facts + set_fact: + _multistropts_file: "{{ (multistropts_file.content | b64decode).strip() }}" + _multistropts_expected_file: "{{ (multistropts_expected_file.content | b64decode).strip() }}" +- name: Show rendered file + debug: + msg: "multistropts rendered - {{ _multistropts_file }}" +- name: Show expected file + debug: + msg: "multistropts expected - {{ _multistropts_expected_file }}" +- name: Compare files + assert: + that: + - _multistropts_file == _multistropts_expected_file # Test content attribute with a dictionary input and config_type equal to 'json' - name: Template test JSON template with content attribute