diff options
author | Matt Clay <matt@mystile.com> | 2019-01-25 19:37:56 -0800 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2019-01-25 20:46:53 -0800 |
commit | a8116497ba302de524489ffd47444517b520e9a7 (patch) | |
tree | 3c4d07baddd98426280787f82c1231fefbd8cead /test/integration/targets/ini_file | |
parent | 73636175da5f44eff2d2ac9623e38ed35d6e6309 (diff) | |
download | ansible-a8116497ba302de524489ffd47444517b520e9a7.tar.gz |
More test fixes for split controller/remote tests.
Diffstat (limited to 'test/integration/targets/ini_file')
-rw-r--r-- | test/integration/targets/ini_file/meta/main.yml | 2 | ||||
-rw-r--r-- | test/integration/targets/ini_file/tasks/main.yml | 116 |
2 files changed, 90 insertions, 28 deletions
diff --git a/test/integration/targets/ini_file/meta/main.yml b/test/integration/targets/ini_file/meta/main.yml new file mode 100644 index 0000000000..1810d4bec9 --- /dev/null +++ b/test/integration/targets/ini_file/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - setup_remote_tmp_dir diff --git a/test/integration/targets/ini_file/tasks/main.yml b/test/integration/targets/ini_file/tasks/main.yml index 4c44d918d0..c54b905ab2 100644 --- a/test/integration/targets/ini_file/tasks/main.yml +++ b/test/integration/targets/ini_file/tasks/main.yml @@ -18,7 +18,7 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. - name: record the output directory - set_fact: output_file={{output_dir}}/foo.ini + set_fact: output_file={{ remote_tmp_dir }}/foo.ini - name: add "fav=lemonade" is in section "[drinks]" in specified file ini_file: @@ -34,13 +34,18 @@ - result1.changed == True - result1.msg == 'section and option added' +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - expected1: |- + expected1: | [drinks] fav = lemonade - content1: "{{ lookup('file', output_file) }}" + content1: "{{ output_content.content | b64decode }}" - name: Verify content of ini file is as expected assert: @@ -69,14 +74,19 @@ value: coke register: result3 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - expected3: |- + expected3: | [drinks] fav = lemonade beverage = coke - content3: "{{ lookup('file', output_file) }}" + content3: "{{ output_content.content | b64decode }}" - name: assert 'changed' is true and content is OK assert: @@ -93,9 +103,14 @@ state: absent register: result4 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: get ini file content set_fact: - content4: "{{ lookup('file', output_file) }}" + content4: "{{ output_content.content | b64decode }}" - name: assert changed and content is as expected assert: @@ -111,16 +126,21 @@ state: absent register: result5 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: get current ini file content set_fact: - content5: "{{ lookup('file', output_file) }}" + content5: "{{ output_content.content | b64decode }}" - name: assert changed and content is empty assert: that: - result5.changed == True - result5.msg == 'section removed' - - content5 == "" + - content5 == "\n" # allow_no_value @@ -163,11 +183,16 @@ - { o: "skip-name-resolve", v: null } - { o: "max_connections", v: "500" } +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - content7: "{{ lookup('file', output_file) }}" - expected7: |- - + content7: "{{ output_content.content | b64decode }}" + expected7: | + [mysqld] skip-name skip-name-resolve @@ -186,11 +211,16 @@ value: myvalue register: result8 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - content8: "{{ lookup('file', output_file) }}" - expected8: |- - + content8: "{{ output_content.content | b64decode }}" + expected8: | + [mysqld] skip-name = myvalue skip-name-resolve @@ -211,11 +241,16 @@ allow_no_value: yes register: result9 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - content9: "{{ lookup('file', output_file) }}" - expected9: |- - + content9: "{{ output_content.content | b64decode }}" + expected9: | + [mysqld] skip-name skip-name-resolve @@ -236,11 +271,16 @@ state: absent register: result10 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - content10: "{{ lookup('file', output_file) }}" - expected10: |- - + content10: "{{ output_content.content | b64decode }}" + expected10: | + [mysqld] skip-name max_connections = 500 @@ -266,10 +306,15 @@ value: coke register: result11 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - expected11: "beverage = coke" - content11: "{{ lookup('file', output_file) }}" + expected11: "beverage = coke\n\n" + content11: "{{ output_content.content | b64decode }}" - name: assert 'changed' is true and content is OK (no section) assert: @@ -286,11 +331,16 @@ section: register: result12 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - expected12: "beverage = water" + expected12: "beverage = water\n\n" - content12: "{{ lookup('file', output_file) }}" + content12: "{{ output_content.content | b64decode }}" - name: assert 'changed' is true and content is OK (no section) assert: @@ -307,16 +357,21 @@ state: absent register: result13 +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: get current ini file content set_fact: - content13: "{{ lookup('file', output_file) }}" + content13: "{{ output_content.content | b64decode }}" - name: assert changed (no section) assert: that: - result13 is changed - result13.msg == 'option changed' - - content13 == "" + - content13 == "\n" - name: Check add option without section before existing section block: @@ -333,14 +388,19 @@ option: like value: tea +- name: read content from output file + slurp: + src: "{{ output_file }}" + register: output_content + - name: set expected content and get current ini file content set_fact: - expected14: |- + expected14: | like = tea [drinks] beverage = water - content14: "{{ lookup('file', output_file) }}" + content14: "{{ output_content.content | b64decode }}" - name: Verify content of ini file is as expected assert: |