Merge pull request #6093 from risaacson/devel
Further updates to the file tests.
This commit is contained in:
commit
cc55407627
6 changed files with 48 additions and 46 deletions
0
tests_new/integration/roles/test_file/files/foobar/fileA
Normal file
0
tests_new/integration/roles/test_file/files/foobar/fileA
Normal file
0
tests_new/integration/roles/test_file/files/foobar/fileB
Normal file
0
tests_new/integration/roles/test_file/files/foobar/fileB
Normal file
|
@ -19,18 +19,12 @@
|
||||||
- set_fact: output_file={{output_dir}}/foo.txt
|
- set_fact: output_file={{output_dir}}/foo.txt
|
||||||
|
|
||||||
- name: prep with a basic copy
|
- 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
|
- name: verify that we are checking a file and it is present
|
||||||
file: path={{output_file}} state=file
|
file: path={{output_file}} state=file
|
||||||
register: file_result
|
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
|
- name: verify that the file was marked as changed
|
||||||
assert: { that: "file_result.changed == false" }
|
assert: { that: "file_result.changed == false" }
|
||||||
|
|
||||||
|
@ -41,12 +35,6 @@
|
||||||
file: path={{output_dir}}/bar.txt state=absent
|
file: path={{output_dir}}/bar.txt state=absent
|
||||||
register: file2_result
|
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
|
- name: verify that the file was marked as changed
|
||||||
assert: { that: "file2_result.changed == false" }
|
assert: { that: "file2_result.changed == false" }
|
||||||
|
|
||||||
|
@ -57,12 +45,6 @@
|
||||||
file: path={{output_dir}}/baz.txt state=touch
|
file: path={{output_dir}}/baz.txt state=touch
|
||||||
register: file3_result
|
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
|
- name: verify that the file was marked as changed
|
||||||
assert: { that: "file3_result.changed == true" }
|
assert: { that: "file3_result.changed == true" }
|
||||||
|
|
||||||
|
@ -70,34 +52,25 @@
|
||||||
assert: { that: "file3_result.state == \"file\"" }
|
assert: { that: "file3_result.state == \"file\"" }
|
||||||
|
|
||||||
- name: assert that the test file has a mode of 0644
|
- 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
|
- name: change file mode
|
||||||
file: path={{output_file}} mode=0600
|
file: path={{output_dir}}/baz.txt mode=0600
|
||||||
register: file4_result
|
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
|
- name: verify that the file was marked as changed
|
||||||
assert: { that: "file4_result.changed == true" }
|
assert: { that: "file4_result.changed == true" }
|
||||||
|
|
||||||
- name: assert that the test file has a mode of 0600
|
- name: assert that the test file has a mode of 0600
|
||||||
assert: { that: "file4_result.mode == \"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
|
- name: create soft link to file
|
||||||
file: src={{output_file}} dest={{output_dir}}/soft.txt state=link
|
file: src={{output_file}} dest={{output_dir}}/soft.txt state=link
|
||||||
register: file5_result
|
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
|
- name: verify that the file was marked as changed
|
||||||
assert: { that: "file5_result.changed == true" }
|
assert: { that: "file5_result.changed == true" }
|
||||||
|
|
||||||
|
@ -105,12 +78,6 @@
|
||||||
file: src={{output_file}} dest={{output_dir}}/hard.txt state=hard
|
file: src={{output_file}} dest={{output_dir}}/hard.txt state=hard
|
||||||
register: file6_result
|
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
|
- name: verify that the file was marked as changed
|
||||||
assert: { that: "file6_result.changed == true" }
|
assert: { that: "file6_result.changed == true" }
|
||||||
|
|
||||||
|
@ -118,18 +85,17 @@
|
||||||
file: path={{output_dir}}/foobar state=directory
|
file: path={{output_dir}}/foobar state=directory
|
||||||
register: file7_result
|
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
|
- name: verify that the file was marked as changed
|
||||||
assert: { that: "file7_result.changed == true" }
|
assert: { that: "file7_result.changed == true" }
|
||||||
|
|
||||||
- name: assert that the test file has a mode of 0600
|
- name: assert that the test file has a mode of 0600
|
||||||
assert: { that: "file7_result.state == \"directory\"" }
|
assert: { that: "file7_result.state == \"directory\"" }
|
||||||
|
|
||||||
|
# FIXME selinux
|
||||||
|
|
||||||
|
- name: remote directory foobar
|
||||||
|
file: path={{output_dir}}/foobar state=absent
|
||||||
|
|
||||||
- name: remove file foo.txt
|
- name: remove file foo.txt
|
||||||
file: path={{output_dir}}/foo.txt state=absent
|
file: path={{output_dir}}/foo.txt state=absent
|
||||||
|
|
||||||
|
@ -139,6 +105,42 @@
|
||||||
- name: remove file baz.txt
|
- name: remove file baz.txt
|
||||||
file: path={{output_dir}}/foo.txt state=absent
|
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
|
- name: remote directory foobar
|
||||||
file: path={{output_dir}}/foobar state=absent
|
file: path={{output_dir}}/foobar state=absent
|
||||||
|
|
||||||
|
|
0
tests_new/integration/test.sh
Normal file → Executable file
0
tests_new/integration/test.sh
Normal file → Executable file
Loading…
Reference in a new issue