diff --git a/tests_new/integration/roles/test_file/files/foobar/directory/fileC b/tests_new/integration/roles/test_file/files/foobar/directory/fileC new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests_new/integration/roles/test_file/files/foobar/directory/fileD b/tests_new/integration/roles/test_file/files/foobar/directory/fileD new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests_new/integration/roles/test_file/files/foobar/fileA b/tests_new/integration/roles/test_file/files/foobar/fileA new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests_new/integration/roles/test_file/files/foobar/fileB b/tests_new/integration/roles/test_file/files/foobar/fileB new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests_new/integration/roles/test_file/tasks/main.yml b/tests_new/integration/roles/test_file/tasks/main.yml index a65df631897..a6b1a790167 100644 --- a/tests_new/integration/roles/test_file/tasks/main.yml +++ b/tests_new/integration/roles/test_file/tasks/main.yml @@ -19,18 +19,12 @@ - set_fact: output_file={{output_dir}}/foo.txt - name: prep with a basic copy - file: src=foo.txt dest={{output_file}} + copy: src=foo.txt dest={{output_file}} - name: verify that we are checking a file and it is present file: path={{output_file}} state=file register: file_result -- name: assert verify that we are checking a file and it is present worked - assert: - that: - - "'changed' in file_result" - - "'state' in file_result" - - name: verify that the file was marked as changed assert: { that: "file_result.changed == false" } @@ -41,12 +35,6 @@ file: path={{output_dir}}/bar.txt state=absent register: file2_result -- name: assert verify that we are checking an absent file worked - assert: - that: - - "'changed' in file2_result" - - "'state' in file2_result" - - name: verify that the file was marked as changed assert: { that: "file2_result.changed == false" } @@ -57,12 +45,6 @@ file: path={{output_dir}}/baz.txt state=touch register: file3_result -- name: assert verify that we can touch a file worked - assert: - that: - - "'changed' in file3_result" - - "'state' in file3_result" - - name: verify that the file was marked as changed assert: { that: "file3_result.changed == true" } @@ -70,34 +52,25 @@ assert: { that: "file3_result.state == \"file\"" } - name: assert that the test file has a mode of 0644 - assert: { that: "file_result.mode == \"0644\"" } + assert: { that: "file3_result.mode == \"0644\"" } - name: change file mode - file: path={{output_file}} mode=0600 + file: path={{output_dir}}/baz.txt mode=0600 register: file4_result -- name: assert change file mode worked - assert: - that: - - "'changed' in file4_result" - - "'state' in file4_result" - - name: verify that the file was marked as changed assert: { that: "file4_result.changed == true" } - name: assert that the test file has a mode of 0600 assert: { that: "file4_result.mode == \"0600\"" } +- name: change ownership and group + file: path={{output_dir}}/baz.txt owner=1000 group=1000 + - name: create soft link to file file: src={{output_file}} dest={{output_dir}}/soft.txt state=link register: file5_result -- name: assert change file mode worked - assert: - that: - - "'changed' in file5_result" - - "'state' in file5_result" - - name: verify that the file was marked as changed assert: { that: "file5_result.changed == true" } @@ -105,12 +78,6 @@ file: src={{output_file}} dest={{output_dir}}/hard.txt state=hard register: file6_result -- name: assert change file mode worked - assert: - that: - - "'changed' in file6_result" - - "'state' in file6_result" - - name: verify that the file was marked as changed assert: { that: "file6_result.changed == true" } @@ -118,18 +85,17 @@ file: path={{output_dir}}/foobar state=directory register: file7_result -- name: assert change file mode worked - assert: - that: - - "'changed' in file7_result" - - "'state' in file7_result" - - name: verify that the file was marked as changed assert: { that: "file7_result.changed == true" } - name: assert that the test file has a mode of 0600 assert: { that: "file7_result.state == \"directory\"" } +# FIXME selinux + +- name: remote directory foobar + file: path={{output_dir}}/foobar state=absent + - name: remove file foo.txt file: path={{output_dir}}/foo.txt state=absent @@ -139,6 +105,42 @@ - name: remove file baz.txt file: path={{output_dir}}/foo.txt state=absent +- name: copy directory structure over + copy: src=foobar dest={{output_dir}} + +- name: Change ownership of a directory with recurse=no(default) + file: path={{output_dir}}/foobar owner=1000 + +- name: verify that the permission of the directory was set + file: path={{output_dir}}/foobar state=directory + register: file8_result + +- name: assert that the directory has changed to have owner 1000 + assert: { that: "file8_result.owner == '1000'" } + +- name: verify that the permission of a file under the directory was not set + file: path={{output_dir}}/foobar/fileA state=file + register: file9_result + +- name: assert the file owner has not changed to 1000 + assert: { that: "file9_result.owner != '1000'" } + +- name: change the ownership of a directory with recurse=yes + file: path={{output_dir}}/foobar owner=1001 recurse=yes + +- name: verify that the permission of the directory was set + file: path={{output_dir}}/foobar state=directory + register: file10_result + +- name: assert that the directory has changed to have owner 1001 + assert: { that: "file10_result.owner == '1001'" } + +- name: verify that the permission of a file under the directory was not set + file: path={{output_dir}}/foobar/fileA state=file + register: file11_result + +- name: assert that the file has changed to have owner 1001 + assert: { that: "file11_result.owner == '1001'" } + - name: remote directory foobar file: path={{output_dir}}/foobar state=absent - diff --git a/tests_new/integration/test.sh b/tests_new/integration/test.sh old mode 100644 new mode 100755