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
0d64159d
Commit
0d64159d
authored
Feb 19, 2014
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the new "list" format of the assert to make things more readable, name every task.
parent
54117ab2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
15 deletions
+29
-15
tests_new/integration/roles/test_copy/tasks/main.yml
+29
-15
No files found.
tests_new/integration/roles/test_copy/tasks/main.yml
View file @
0d64159d
...
@@ -16,7 +16,8 @@
...
@@ -16,7 +16,8 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
set_fact
:
output_file={{output_dir}}/foo.txt
-
name
:
record the output directory
set_fact
:
output_file={{output_dir}}/foo.txt
-
name
:
initiate a basic copy
-
name
:
initiate a basic copy
copy
:
src=foo.txt dest={{output_file}}
copy
:
src=foo.txt dest={{output_file}}
...
@@ -38,10 +39,14 @@
...
@@ -38,10 +39,14 @@
-
name
:
verify that the file was marked as changed
-
name
:
verify that the file was marked as changed
assert
:
{
that
:
"
copy_result.changed
==
true"
}
assert
:
that
:
-
"
copy_result.changed
==
true"
-
name
:
verify that the file md5sum is correct
-
name
:
verify that the file md5sum is correct
assert
:
{
that
:
"
copy_result.md5sum
==
'c47397529fe81ab62ba3f85e9f4c71f2'"
}
assert
:
that
:
-
"
copy_result.md5sum
==
'c47397529fe81ab62ba3f85e9f4c71f2'"
-
name
:
check the stat results of the file
-
name
:
check the stat results of the file
stat
:
path={{output_file}}
stat
:
path={{output_file}}
...
@@ -49,33 +54,42 @@
...
@@ -49,33 +54,42 @@
-
debug
:
var=stat_results
-
debug
:
var=stat_results
-
assert
:
{
that
:
"
stat_results.stat.exists
==
true"
}
-
name
:
assert the stat results are correct
-
assert
:
{
that
:
"
stat_results.stat.isblk
==
false"
}
assert
:
-
assert
:
{
that
:
"
stat_results.stat.isfifo
==
false"
}
that
:
-
assert
:
{
that
:
"
stat_results.stat.isreg
==
true"
}
-
"
stat_results.stat.exists
==
true"
-
assert
:
{
that
:
"
stat_results.stat.issock
==
false"
}
-
"
stat_results.stat.isblk
==
false"
-
assert
:
{
that
:
"
stat_results.stat.md5
==
'c47397529fe81ab62ba3f85e9f4c71f2'"
}
-
"
stat_results.stat.isfifo
==
false"
-
"
stat_results.stat.isreg
==
true"
-
"
stat_results.stat.issock
==
false"
-
"
stat_results.stat.md5
==
'c47397529fe81ab62ba3f85e9f4c71f2'"
-
name
:
overwrite the file via same means
-
name
:
overwrite the file via same means
copy
:
src=foo.txt dest={{output_file}}
copy
:
src=foo.txt dest={{output_file}}
register
:
copy_result2
register
:
copy_result2
-
name
:
verify the copy was marked unchanged
-
name
:
assert that the file was not changed
assert
:
{
that
:
"
not
copy_result2|changed"
}
assert
:
that
:
-
"
not
copy_result2|changed"
-
name
:
overwrite the file using the content system
-
name
:
overwrite the file using the content system
copy
:
content="modified" dest={{output_file}}
copy
:
content="modified" dest={{output_file}}
register
:
copy_result3
register
:
copy_result3
-
name
:
verify the copy result was marked changed
-
name
:
assert that the file has changed
assert
:
{
that
:
"
copy_result3|changed"
}
assert
:
that
:
-
"
copy_result3|changed"
-
name
:
overwrite the file again using the content system
-
name
:
overwrite the file again using the content system
copy
:
content="modified" dest={{output_file}}
copy
:
content="modified" dest={{output_file}}
register
:
copy_result4
register
:
copy_result4
-
name
:
verify the copy result was marked unchanged
-
name
:
assert that the copy result has not changed
assert
:
{
that
:
"
not
copy_result4|changed"
}
assert
:
that
:
-
"
not
copy_result4|changed"
# TODO: test recursive copy
# TODO: test recursive copy
# TODO: test copy where destination is a directory like {{output_dir}}/
# TODO: test copy where destination is a directory like {{output_dir}}/
...
...
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