diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/assemble | |
parent | Initial commit. (diff) | |
download | ansible-core-upstream.tar.xz ansible-core-upstream.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/assemble')
-rw-r--r-- | test/integration/targets/assemble/aliases | 1 | ||||
-rw-r--r-- | test/integration/targets/assemble/files/fragment1 | 1 | ||||
-rw-r--r-- | test/integration/targets/assemble/files/fragment2 | 1 | ||||
-rw-r--r-- | test/integration/targets/assemble/files/fragment3 | 1 | ||||
-rw-r--r-- | test/integration/targets/assemble/files/fragment4 | 1 | ||||
-rw-r--r-- | test/integration/targets/assemble/files/fragment5 | 1 | ||||
-rw-r--r-- | test/integration/targets/assemble/meta/main.yml | 21 | ||||
-rw-r--r-- | test/integration/targets/assemble/tasks/main.yml | 154 |
8 files changed, 181 insertions, 0 deletions
diff --git a/test/integration/targets/assemble/aliases b/test/integration/targets/assemble/aliases new file mode 100644 index 0000000..765b70d --- /dev/null +++ b/test/integration/targets/assemble/aliases @@ -0,0 +1 @@ +shippable/posix/group2 diff --git a/test/integration/targets/assemble/files/fragment1 b/test/integration/targets/assemble/files/fragment1 new file mode 100644 index 0000000..a00d3ea --- /dev/null +++ b/test/integration/targets/assemble/files/fragment1 @@ -0,0 +1 @@ +this is fragment 1 diff --git a/test/integration/targets/assemble/files/fragment2 b/test/integration/targets/assemble/files/fragment2 new file mode 100644 index 0000000..860f760 --- /dev/null +++ b/test/integration/targets/assemble/files/fragment2 @@ -0,0 +1 @@ +this is fragment 2 diff --git a/test/integration/targets/assemble/files/fragment3 b/test/integration/targets/assemble/files/fragment3 new file mode 100644 index 0000000..df95b24 --- /dev/null +++ b/test/integration/targets/assemble/files/fragment3 @@ -0,0 +1 @@ +this is fragment 3 diff --git a/test/integration/targets/assemble/files/fragment4 b/test/integration/targets/assemble/files/fragment4 new file mode 100644 index 0000000..c83252b --- /dev/null +++ b/test/integration/targets/assemble/files/fragment4 @@ -0,0 +1 @@ +this is fragment 4 diff --git a/test/integration/targets/assemble/files/fragment5 b/test/integration/targets/assemble/files/fragment5 new file mode 100644 index 0000000..8a527d1 --- /dev/null +++ b/test/integration/targets/assemble/files/fragment5 @@ -0,0 +1 @@ +this is fragment 5 diff --git a/test/integration/targets/assemble/meta/main.yml b/test/integration/targets/assemble/meta/main.yml new file mode 100644 index 0000000..d057311 --- /dev/null +++ b/test/integration/targets/assemble/meta/main.yml @@ -0,0 +1,21 @@ +# test code for the assemble module +# (c) 2014, James Cammarata <jcammarata@ansible.com> + +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +dependencies: + - prepare_tests + - setup_remote_tmp_dir diff --git a/test/integration/targets/assemble/tasks/main.yml b/test/integration/targets/assemble/tasks/main.yml new file mode 100644 index 0000000..14eea3f --- /dev/null +++ b/test/integration/targets/assemble/tasks/main.yml @@ -0,0 +1,154 @@ +# test code for the assemble module +# (c) 2014, James Cammarata <jcammarata@ansible.com> + +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +- name: copy the files to a new directory + copy: src="./" dest="{{remote_tmp_dir}}/src" + register: result + +- name: create unicode file for test + shell: echo "π" > {{ remote_tmp_dir }}/src/ßΩ.txt + register: result + +- name: assert that the new file was created + assert: + that: + - "result.changed == true" + +- name: test assemble with all fragments + assemble: src="{{remote_tmp_dir}}/src" dest="{{remote_tmp_dir}}/assembled1" + register: result + +- name: assert the fragments were assembled + assert: + that: + - "result.state == 'file'" + - "result.changed == True" + - "result.checksum == '74152e9224f774191bc0bedf460d35de86ad90e6'" + +- name: test assemble with all fragments + assemble: src="{{remote_tmp_dir}}/src" dest="{{remote_tmp_dir}}/assembled1" + register: result + +- name: assert that the same assemble made no changes + assert: + that: + - "result.state == 'file'" + - "result.changed == False" + - "result.checksum == '74152e9224f774191bc0bedf460d35de86ad90e6'" + +- name: test assemble with all fragments and decrypt=True + assemble: src="{{remote_tmp_dir}}/src" dest="{{remote_tmp_dir}}/assembled2" decrypt=yes + register: result + +- name: assert the fragments were assembled with decrypt=True + assert: + that: + - "result.state == 'file'" + - "result.changed == True" + - "result.checksum == '74152e9224f774191bc0bedf460d35de86ad90e6'" + +- name: test assemble with all fragments and decrypt=True + assemble: src="{{remote_tmp_dir}}/src" dest="{{remote_tmp_dir}}/assembled2" decrypt=yes + register: result + +- name: assert that the same assemble made no changes with decrypt=True + assert: + that: + - "result.state == 'file'" + - "result.changed == False" + - "result.checksum == '74152e9224f774191bc0bedf460d35de86ad90e6'" + +- name: test assemble with fragments matching a regex + assemble: src="{{remote_tmp_dir}}/src" dest="{{remote_tmp_dir}}/assembled3" regexp="^fragment[1-3]$" + register: result + +- name: assert the fragments were assembled with a regex + assert: + that: + - "result.state == 'file'" + - "result.checksum == 'edfe2d7487ef8f5ebc0f1c4dc57ba7b70a7b8e2b'" + +- name: test assemble with fragments matching a regex and decrypt=True + assemble: src="{{remote_tmp_dir}}/src" dest="{{remote_tmp_dir}}/assembled4" regexp="^fragment[1-3]$" decrypt=yes + register: result + +- name: assert the fragments were assembled with a regex and decrypt=True + assert: + that: + - "result.state == 'file'" + - "result.checksum == 'edfe2d7487ef8f5ebc0f1c4dc57ba7b70a7b8e2b'" + +- name: test assemble with a delimiter + assemble: src="{{remote_tmp_dir}}/src" dest="{{remote_tmp_dir}}/assembled5" delimiter="#--- delimiter ---#" + register: result + +- name: assert the fragments were assembled with a delimiter + assert: + that: + - "result.state == 'file'" + - "result.checksum == 'd986cefb82e34e4cf14d33a3cda132ff45aa2980'" + +- name: test assemble with a delimiter and decrypt=True + assemble: src="{{remote_tmp_dir}}/src" dest="{{remote_tmp_dir}}/assembled6" delimiter="#--- delimiter ---#" decrypt=yes + register: result + +- name: assert the fragments were assembled with a delimiter and decrypt=True + assert: + that: + - "result.state == 'file'" + - "result.checksum == 'd986cefb82e34e4cf14d33a3cda132ff45aa2980'" + +- name: test assemble with remote_src=False + assemble: src="./" dest="{{remote_tmp_dir}}/assembled7" remote_src=no + register: result + +- name: assert the fragments were assembled without remote + assert: + that: + - "result.state == 'file'" + - "result.checksum == '048a1bd1951aa5ccc427eeb4ca19aee45e9c68b3'" + +- name: test assemble with remote_src=False and decrypt=True + assemble: src="./" dest="{{remote_tmp_dir}}/assembled8" remote_src=no decrypt=yes + register: result + +- name: assert the fragments were assembled without remote and decrypt=True + assert: + that: + - "result.state == 'file'" + - "result.checksum == '048a1bd1951aa5ccc427eeb4ca19aee45e9c68b3'" + +- name: test assemble with remote_src=False and a delimiter + assemble: src="./" dest="{{remote_tmp_dir}}/assembled9" remote_src=no delimiter="#--- delimiter ---#" + register: result + +- name: assert the fragments were assembled without remote + assert: + that: + - "result.state == 'file'" + - "result.checksum == '505359f48c65b3904127cf62b912991d4da7ed6d'" + +- name: test assemble with remote_src=False and a delimiter and decrypt=True + assemble: src="./" dest="{{remote_tmp_dir}}/assembled10" remote_src=no delimiter="#--- delimiter ---#" decrypt=yes + register: result + +- name: assert the fragments were assembled without remote + assert: + that: + - "result.state == 'file'" + - "result.checksum == '505359f48c65b3904127cf62b912991d4da7ed6d'" |