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
6f09b41e
Commit
6f09b41e
authored
Apr 17, 2012
by
Jeroen Hoekx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't test modules that aren't present.
Also account for path difference in sleep in different distributions.
parent
9e0b7ee6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
test/TestRunner.py
+14
-1
No files found.
test/TestRunner.py
View file @
6f09b41e
...
...
@@ -14,6 +14,15 @@ try:
except
:
import
simplejson
as
json
from
nose.plugins.skip
import
SkipTest
def
get_binary
(
name
):
for
directory
in
os
.
environ
[
"PATH"
]
.
split
(
os
.
pathsep
):
path
=
os
.
path
.
join
(
directory
,
name
)
if
os
.
path
.
isfile
(
path
)
and
os
.
access
(
path
,
os
.
X_OK
):
return
path
return
None
class
TestRunner
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -73,6 +82,8 @@ class TestRunner(unittest.TestCase):
assert
"ping"
in
result
def
test_facter
(
self
):
if
not
get_binary
(
"facter"
):
raise
SkipTest
result
=
self
.
_run
(
'facter'
,[])
assert
"hostname"
in
result
...
...
@@ -172,7 +183,7 @@ class TestRunner(unittest.TestCase):
def
test_async
(
self
):
# test async launch and job status
# of any particular module
result
=
self
.
_run
(
'command'
,
[
"/bin/sleep"
,
"3"
],
background
=
20
)
result
=
self
.
_run
(
'command'
,
[
get_binary
(
"sleep"
)
,
"3"
],
background
=
20
)
assert
'ansible_job_id'
in
result
assert
'started'
in
result
jid
=
result
[
'ansible_job_id'
]
...
...
@@ -197,6 +208,8 @@ class TestRunner(unittest.TestCase):
assert
open
(
input
)
.
read
()
==
open
(
output
)
.
read
()
def
test_yum
(
self
):
if
not
get_binary
(
"yum"
):
raise
SkipTest
result
=
self
.
_run
(
'yum'
,
[
"list=repos"
])
assert
'failed'
not
in
result
...
...
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