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
f9618892
Commit
f9618892
authored
Feb 20, 2014
by
Richard Isaacson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6095 from risaacson/devel
File - selinux tests in new framework.
parents
cc554076
101f9a22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
7 deletions
+48
-7
tests_new/integration/roles/test_file/tasks/main.yml
+18
-7
tests_new/integration/roles/test_file/tasks/selinux_tests.yml
+30
-0
No files found.
tests_new/integration/roles/test_file/tasks/main.yml
View file @
f9618892
...
...
@@ -29,7 +29,7 @@
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.state
==
'file'
"
}
-
name
:
verify that we are checking an absent file
file
:
path={{output_dir}}/bar.txt state=absent
...
...
@@ -39,7 +39,7 @@
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.state
==
'absent'
"
}
-
name
:
verify we can touch a file
file
:
path={{output_dir}}/baz.txt state=touch
...
...
@@ -49,10 +49,10 @@
assert
:
{
that
:
"
file3_result.changed
==
true"
}
-
name
:
verify that the state is that of a file
assert
:
{
that
:
"
file3_result.state
==
\"
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.mode
==
'0644'
"
}
-
name
:
change file mode
file
:
path={{output_dir}}/baz.txt mode=0600
...
...
@@ -62,7 +62,7 @@
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.mode
==
'0600'
"
}
-
name
:
change ownership and group
file
:
path={{output_dir}}/baz.txt owner=1000 group=1000
...
...
@@ -89,9 +89,20 @@
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.state
==
'directory'
"
}
# FIXME selinux
-
name
:
determine if selinux is installed
shell
:
which getenforce || exit 0
register
:
selinux_installed
-
name
:
determine if selinux is enabled
shell
:
getenforce | grep -q Disabled || echo yes
register
:
selinux_enabled
when
:
selinux_installed.stdout != ""
ignore_errors
:
true
-
include
:
selinux_tests.yml
when
:
selinux_enabled
-
name
:
remote directory foobar
file
:
path={{output_dir}}/foobar state=absent
...
...
tests_new/integration/roles/test_file/tasks/selinux_tests.yml
0 → 100644
View file @
f9618892
# Test code for the file module - selinux subtasks.
# (c) 2014, Richard Isaacson <richard.c.isaacson@gmail.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
:
touch a file for testing
file
:
path={{output_dir}}/foo-se.txt state=file
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
file_result.changed
==
true"
}
-
name
:
assert touch a file for testing matches expected selinux context
assert
:
{
that
:
"
file_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
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