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
0df166e7
Commit
0df166e7
authored
Feb 19, 2014
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy tests WIP, fix bug in assert module upgrades where the wrong value was being checked.
parent
0d64159d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
4 deletions
+48
-4
lib/ansible/runner/action_plugins/assert.py
+1
-1
tests_new/integration/roles/test_copy/files/subdir/bar.txt
+1
-0
tests_new/integration/roles/test_copy/files/subdir/subdir2/baz.txt
+1
-0
tests_new/integration/roles/test_copy/tasks/main.yml
+44
-2
tests_new/integration/test.sh
+1
-1
No files found.
lib/ansible/runner/action_plugins/assert.py
View file @
0df166e7
...
...
@@ -50,7 +50,7 @@ class ActionModule(object):
args
[
'that'
]
=
[
args
[
'that'
]
]
for
that
in
args
[
'that'
]:
result
=
utils
.
check_conditional
(
args
[
'that'
]
,
self
.
runner
.
basedir
,
inject
,
fail_on_undefined
=
True
)
result
=
utils
.
check_conditional
(
that
,
self
.
runner
.
basedir
,
inject
,
fail_on_undefined
=
True
)
if
not
result
:
return
ReturnData
(
conn
=
conn
,
result
=
dict
(
failed
=
True
,
assertion
=
that
,
evaluated_to
=
result
))
...
...
tests_new/integration/roles/test_copy/files/subdir/bar.txt
0 → 100644
View file @
0df166e7
baz
tests_new/integration/roles/test_copy/files/subdir/subdir2/baz.txt
0 → 100644
View file @
0df166e7
baz
tests_new/integration/roles/test_copy/tasks/main.yml
View file @
0df166e7
...
...
@@ -91,9 +91,51 @@
that
:
-
"
not
copy_result4|changed"
# TODO: test recursive copy
# TODO: test copy where destination is a directory like {{output_dir}}/
# test recursive copy
-
name
:
set the output subdirectory
set_fact
:
output_subdir={{output_dir}}/sub
-
name
:
make an output subdirectory
file
:
name={{output_subdir}} state=directory
-
name
:
test recursive copy to directory
copy
:
src=subdir dest={{output_subdir}}
register
:
recursive_copy_result
-
debug
:
var=recursive_copy_result
-
name
:
check that a file in a directory was transferred
stat
:
path={{output_dir}}/sub/subdir/bar.txt
register
:
stat_bar
-
name
:
check that a file in a deeper directory was transferred
stat
:
path={{output_dir}}/sub/subdir/subdir2/bar2.txt
register
:
stat_bar2
-
debug
:
var=stat_bar
-
fail
:
msg="boom!"
when
:
not stat_bar.stat.exists
-
assert
:
{
that
:
"
stat_bar.stat.exists"
}
-
name
:
assert recursive copy things
assert
:
that
:
-
"
stat_bar.stat.exists"
-
"
stat_bar2.stat.exists"
# TODO: test that copy fails if the path does not exist
-
name
:
assert invalid copy location fails
copy
:
src=invalid_file_location_does_not_exist dest={{output_dir}}/file.txt
ignore_errors
:
True
register
:
failed_copy
-
debug
:
var=failed_copy
# TODO: ...
tests_new/integration/test.sh
View file @
0df166e7
ansible-playbook non_destructive.yml
-i
inventory
-e
output_dir
=
~/ansible_testing
-v
ansible-playbook non_destructive.yml
-i
inventory
-e
output_dir
=
~/ansible_testing
-v
$*
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