Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
10e116ea
Commit
10e116ea
authored
Feb 20, 2014
by
Richard C Isaacson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up my asserts
parent
fc648a65
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
36 deletions
+53
-36
tests_new/integration/roles/test_file/tasks/main.yml
+39
-29
tests_new/integration/roles/test_file/tasks/selinux_tests.yml
+5
-4
tests_new/integration/roles/test_unarchive/tasks/main.yml
+9
-3
No files found.
tests_new/integration/roles/test_file/tasks/main.yml
View file @
10e116ea
...
...
@@ -26,43 +26,41 @@
register
:
file_result
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
file_result.changed
==
false"
}
-
name
:
verify that the state is that of a file
assert
:
{
that
:
"
file_result.state
==
'file'"
}
assert
:
that
:
-
"
file_result.changed
==
false"
-
"
file_result.state
==
'file'"
-
name
:
verify that we are checking an absent file
file
:
path={{output_dir}}/bar.txt state=absent
register
:
file2_result
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
file2_result.changed
==
false"
}
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
file2_result.state
==
'absent'"
}
assert
:
that
:
-
"
file2_result.changed
==
false"
-
"
file2_result.state
==
'absent'"
-
name
:
verify we can touch a file
file
:
path={{output_dir}}/baz.txt state=touch
register
:
file3_result
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
file3_result.changed
==
true"
}
-
name
:
verify that the state is that of a file
assert
:
{
that
:
"
file3_result.state
==
'file'"
}
-
name
:
assert that the test file has a mode of 0644
assert
:
{
that
:
"
file3_result.mode
==
'0644'"
}
assert
:
that
:
-
"
file3_result.changed
==
true"
-
"
file3_result.state
==
'file'"
-
"
file3_result.mode
==
'0644'"
-
name
:
change file mode
file
:
path={{output_dir}}/baz.txt mode=0600
register
:
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'"
}
assert
:
that
:
-
"
file4_result.changed
==
true"
-
"
file4_result.mode
==
'0600'"
-
name
:
change ownership and group
file
:
path={{output_dir}}/baz.txt owner=1000 group=1000
...
...
@@ -72,24 +70,28 @@
register
:
file5_result
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
file5_result.changed
==
true"
}
assert
:
that
:
-
"
file5_result.changed
==
true"
-
name
:
create hard link to file
file
:
src={{output_file}} dest={{output_dir}}/hard.txt state=hard
register
:
file6_result
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
file6_result.changed
==
true"
}
assert
:
that
:
-
"
file6_result.changed
==
true"
-
name
:
create a directory
file
:
path={{output_dir}}/foobar state=directory
register
:
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'"
}
assert
:
that
:
-
"
file7_result.changed
==
true"
-
"
file7_result.state
==
'directory'"
-
name
:
determine if selinux is installed
shell
:
which getenforce || exit 0
...
...
@@ -127,14 +129,18 @@
register
:
file8_result
-
name
:
assert that the directory has changed to have owner 1234
assert
:
{
that
:
"
file8_result.uid
==
1234"
}
assert
:
that
:
-
"
file8_result.uid
==
1234"
-
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.uid
!=
1234"
}
assert
:
that
:
-
"
file9_result.uid
!=
1234"
-
name
:
change the ownership of a directory with recurse=yes
file
:
path={{output_dir}}/foobar owner=1235 recurse=yes
...
...
@@ -144,14 +150,18 @@
register
:
file10_result
-
name
:
assert that the directory has changed to have owner 1235
assert
:
{
that
:
"
file10_result.uid
==
1235"
}
assert
:
that
:
-
"
file10_result.uid
==
1235"
-
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 1235
assert
:
{
that
:
"
file11_result.uid
==
1235"
}
assert
:
that
:
-
"
file11_result.uid
==
1235"
-
name
:
remote directory foobar
file
:
path={{output_dir}}/foobar state=absent
tests_new/integration/roles/test_file/tasks/selinux_tests.yml
View file @
10e116ea
...
...
@@ -21,10 +21,10 @@
register
:
file_se_result
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
file_se_result.changed
==
true"
}
-
name
:
assert touch a file for testing matches expected selinux context
assert
:
{
that
:
"
file_se_result.secontext
==
'unconfined_u:object_r:admin_home_t:s0'"
}
assert
:
that
:
-
"
file_se_result.changed
==
true"
-
"
file_se_result.secontext
==
'unconfined_u:object_r:admin_home_t:s0'"
-
name
:
remove the file used for testing
file
:
path={{output_dir}}/foo-se.txt state=absent
\ No newline at end of file
tests_new/integration/roles/test_unarchive/tasks/main.yml
View file @
10e116ea
...
...
@@ -36,7 +36,9 @@
register
:
unarchive01
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
unarchive01.changed
==
true"
}
assert
:
that
:
-
"
unarchive01.changed
==
true"
-
name
:
verify that the file was unarchived
file
:
path={{output_dir}}/test-unarchive-tar/foo-unarchive.txt state=file
...
...
@@ -52,7 +54,9 @@
register
:
unarchive02
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
unarchive02.changed
==
true"
}
assert
:
that
:
-
"
unarchive02.changed
==
true"
-
name
:
verify that the file was unarchived
file
:
path={{output_dir}}/test-unarchive-tar-gz/foo-unarchive.txt state=file
...
...
@@ -68,7 +72,9 @@
register
:
unarchive03
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
unarchive03.changed
==
true"
}
assert
:
that
:
-
"
unarchive03.changed
==
true"
-
name
:
verify that the file was unarchived
file
:
path={{output_dir}}/test-unarchive-zip/foo-unarchive.txt state=file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment