Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nirina Malard
slapos
Commits
595ffec2
Commit
595ffec2
authored
Aug 02, 2019
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slapos.cookbook] fix failures in slapos.test.test_recipe.additional_tests
parent
666d846c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
slapos/test/recipe/test_pbs.py
slapos/test/recipe/test_pbs.py
+2
-2
slapos/test/recipe/test_plugin.py
slapos/test/recipe/test_plugin.py
+6
-5
No files found.
slapos/test/recipe/test_pbs.py
View file @
595ffec2
...
@@ -27,7 +27,7 @@ class PBSTest(unittest.TestCase):
...
@@ -27,7 +27,7 @@ class PBSTest(unittest.TestCase):
local_dir
=
'TEST_LOCAL_DIR'
,
local_dir
=
'TEST_LOCAL_DIR'
,
remote_dir
=
'TEST_REMOTE_DIR'
,
remote_dir
=
'TEST_REMOTE_DIR'
,
rdiff_wrapper_path
=
rdiff_wrapper
.
name
)
rdiff_wrapper_path
=
rdiff_wrapper
.
name
)
content
=
rdiff_wrapper
.
read
()
content
=
open
(
rdiff_wrapper
.
name
,
'r'
)
.
read
()
self
.
assertIn
(
'--remote-schema TEST_REMOTE_SCHEMA'
,
content
)
self
.
assertIn
(
'--remote-schema TEST_REMOTE_SCHEMA'
,
content
)
self
.
assertIn
(
'TEST_LOCAL_DIR'
,
content
)
self
.
assertIn
(
'TEST_LOCAL_DIR'
,
content
)
self
.
assertIn
(
'TEST_REMOTE_DIR'
,
content
)
self
.
assertIn
(
'TEST_REMOTE_DIR'
,
content
)
...
@@ -41,7 +41,7 @@ class PBSTest(unittest.TestCase):
...
@@ -41,7 +41,7 @@ class PBSTest(unittest.TestCase):
remote_dir
=
'TEST_REMOTE_DIR'
,
remote_dir
=
'TEST_REMOTE_DIR'
,
rdiff_wrapper_path
=
rdiff_wrapper
.
name
,
rdiff_wrapper_path
=
rdiff_wrapper
.
name
,
remove_backup_older_than
=
'TEST_OLDER'
)
remove_backup_older_than
=
'TEST_OLDER'
)
content
=
rdiff_wrapper
.
read
()
content
=
open
(
rdiff_wrapper
.
name
,
'r'
)
.
read
()
self
.
assertIn
(
'--remote-schema TEST_REMOTE_SCHEMA'
,
content
)
self
.
assertIn
(
'--remote-schema TEST_REMOTE_SCHEMA'
,
content
)
self
.
assertIn
(
'TEST_LOCAL_DIR'
,
content
)
self
.
assertIn
(
'TEST_LOCAL_DIR'
,
content
)
self
.
assertIn
(
'TEST_REMOTE_DIR'
,
content
)
self
.
assertIn
(
'TEST_REMOTE_DIR'
,
content
)
...
...
slapos/test/recipe/test_plugin.py
View file @
595ffec2
import
os
,
shutil
,
tempfile
,
unittest
import
os
,
shutil
,
tempfile
,
unittest
from
slapos.recipe
import
promise_plugin
from
slapos.recipe
import
promise_plugin
from
slapos.test.utils
import
makeRecipe
from
slapos.test.utils
import
makeRecipe
from
pprint
import
pformat
import
stat
,
json
import
stat
,
json
class
TestPromisePlugin
(
unittest
.
TestCase
):
class
TestPromisePlugin
(
unittest
.
TestCase
):
...
@@ -33,7 +34,7 @@ in multi line
...
@@ -33,7 +34,7 @@ in multi line
recipe
.
install
()
recipe
.
install
()
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
output
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
output
))
with
open
(
self
.
output
)
as
f
:
with
open
(
self
.
output
,
'r'
)
as
f
:
content
=
f
.
read
()
content
=
f
.
read
()
self
.
assertIn
(
"from slapos.promise.plugin.check_site_available import RunPromise"
,
content
)
self
.
assertIn
(
"from slapos.promise.plugin.check_site_available import RunPromise"
,
content
)
self
.
assertEqual
(
stat
.
S_IMODE
(
os
.
stat
(
self
.
output
).
st_mode
),
int
(
'644'
,
8
))
self
.
assertEqual
(
stat
.
S_IMODE
(
os
.
stat
(
self
.
output
).
st_mode
),
int
(
'644'
,
8
))
...
@@ -44,7 +45,7 @@ in multi line
...
@@ -44,7 +45,7 @@ in multi line
param3
=
self
.
options
[
'config-param3'
],
param3
=
self
.
options
[
'config-param3'
],
param4
=
self
.
options
[
'config-param4'
],
param4
=
self
.
options
[
'config-param4'
],
)
)
self
.
assertIn
(
'extra_config_dict =
json.loads("""%s""", strict=False)'
%
json
.
dumps
(
expected_dict
,
indent
=
2
,
sort_keys
=
True
),
content
)
self
.
assertIn
(
'extra_config_dict =
%s'
%
pformat
(
expected_dict
,
indent
=
2
),
content
)
def
test_no_module_set
(
self
):
def
test_no_module_set
(
self
):
recipe
=
makeRecipe
(
recipe
=
makeRecipe
(
...
@@ -67,7 +68,7 @@ in multi line
...
@@ -67,7 +68,7 @@ in multi line
with
open
(
self
.
output
)
as
f
:
with
open
(
self
.
output
)
as
f
:
content
=
f
.
read
()
content
=
f
.
read
()
self
.
assertIn
(
"from slapos.promise.plugin.check_site_available import RunPromise"
,
content
)
self
.
assertIn
(
"from slapos.promise.plugin.check_site_available import RunPromise"
,
content
)
self
.
assertIn
(
'extra_config_dict =
json.loads("""{}""", strict=False)
'
,
content
)
self
.
assertIn
(
'extra_config_dict =
{ }
'
,
content
)
def
test_bad_parameters
(
self
):
def
test_bad_parameters
(
self
):
...
@@ -84,8 +85,8 @@ in multi line
...
@@ -84,8 +85,8 @@ in multi line
with
open
(
self
.
output
)
as
f
:
with
open
(
self
.
output
)
as
f
:
content
=
f
.
read
()
content
=
f
.
read
()
expected_param1
=
'"param1; print
\
\
"toto
\
\
"": "#xxxx
\
\
"
\
\
nimport os; os.stat(f)",'
expected_param1
=
r"""'param1; print "toto"': '#xxxx"\nimport os; os.stat(f)',"""
expected_param2
=
'"param2
\
\
n@domething": "
\
\
"#$$*PPP
\
\
n
\
\
n p = 2*5; print
\
\
"result is %s
\
\
" % p"'
expected_param2
=
r"""'param2\n@domething': '"#$$*PPP\n\n p = 2*5; print "result is %s" % p'"""
self
.
assertIn
(
expected_param1
,
content
)
self
.
assertIn
(
expected_param1
,
content
)
self
.
assertIn
(
expected_param2
,
content
)
self
.
assertIn
(
expected_param2
,
content
)
...
...
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