Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos.toolbox
Commits
c13f9622
Commit
c13f9622
authored
Sep 23, 2014
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slaprunner.test: Small code cleaning
parent
f629729b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
23 deletions
+20
-23
slapos/runner/runnertest.py
slapos/runner/runnertest.py
+20
-23
No files found.
slapos/runner/runnertest.py
View file @
c13f9622
...
...
@@ -187,35 +187,33 @@ class SlaprunnerTestCase(unittest.TestCase):
return
getProfilePath
(
self
.
app
.
config
[
'etc_dir'
],
self
.
app
.
config
[
'software_profile'
])
def
proxyStatus
(
self
,
status
=
True
,
sleep_time
=
0
):
def
proxyStatus
(
self
,
status
=
True
):
"""Helper for testslapproxy status"""
proxy
=
sup_process
.
isRunning
(
self
.
app
.
config
,
'slapproxy'
)
if
proxy
!=
status
and
sleep_time
!=
0
:
time
.
sleep
(
sleep_time
)
proxy
=
sup_process
.
isRunning
(
self
.
app
.
config
,
'slapproxy'
)
self
.
assertEqual
(
proxy
,
status
)
def
setupProjectFolder
(
self
,
withSoftware
=
False
):
def
setupProjectFolder
(
self
):
"""Helper to create a project folder as for slapos.git"""
base
=
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
'slapos'
)
software
=
os
.
path
.
join
(
base
,
'software'
)
os
.
mkdir
(
base
)
os
.
mkdir
(
software
)
if
withSoftware
:
testSoftware
=
os
.
path
.
join
(
software
,
'slaprunner-test'
)
sr
=
"[buildout]
\
n
\
n
"
sr
+=
"parts = command
\
n
\
n
unzip = true
\
n
networkcache-section = networkcache
\
n
\
n
"
sr
+=
"find-links += http://www.nexedi.org/static/packages/source/slapos.buildout/
\
n
\
n
"
sr
+=
"[networkcache]
\
n
download-cache-url = http://www.shacache.org/shacache"
sr
+=
"
\
n
download-dir-url = http://www.shacache.org/shadir
\
n
\
n
"
sr
+=
"[command]
\
n
recipe = zc.recipe.egg
\
n
eggs = plone.recipe.command
\
n
zc.buildout
\
n
\
n
"
os
.
mkdir
(
testSoftware
)
open
(
os
.
path
.
join
(
testSoftware
,
self
.
app
.
config
[
'software_profile'
]),
'w'
).
write
(
sr
)
def
setupSoftwareFolder
(
self
):
"""Helper to setup compiled software release dir"""
self
.
setupProjectFolder
(
withSoftware
=
True
)
def
setupTestSoftware
(
self
):
"""Helper to setup Basic SR for testing purposes"""
self
.
setupProjectFolder
()
base
=
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
'slapos'
)
software
=
os
.
path
.
join
(
base
,
'software'
)
testSoftware
=
os
.
path
.
join
(
software
,
'slaprunner-test'
)
sr
=
"[buildout]
\
n
\
n
"
sr
+=
"parts = command
\
n
\
n
unzip = true
\
n
networkcache-section = networkcache
\
n
\
n
"
sr
+=
"find-links += http://www.nexedi.org/static/packages/source/slapos.buildout/
\
n
\
n
"
sr
+=
"[networkcache]
\
n
download-cache-url = http://www.shacache.org/shacache"
sr
+=
"
\
n
download-dir-url = http://www.shacache.org/shadir
\
n
\
n
"
sr
+=
"[command]
\
n
recipe = zc.recipe.egg
\
n
eggs = plone.recipe.command
\
n
zc.buildout
\
n
\
n
"
os
.
mkdir
(
testSoftware
)
open
(
os
.
path
.
join
(
testSoftware
,
self
.
app
.
config
[
'software_profile'
]),
'w'
).
write
(
sr
)
md5
=
hashlib
.
md5
(
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
"slapos/software/slaprunner-test"
,
self
.
app
.
config
[
'software_profile'
])
...
...
@@ -367,7 +365,7 @@ class SlaprunnerTestCase(unittest.TestCase):
def
test_updateInstanceParameter
(
self
):
"""Scenarion 5: Update parameters of current sofware profile"""
self
.
setAccount
()
self
.
setup
SoftwareFolder
()
self
.
setup
TestSoftware
()
#Set current projet and run Slapgrid-cp
software
=
os
.
path
.
join
(
self
.
software
,
'slaprunner-test'
)
response
=
loadJson
(
self
.
app
.
post
(
'/setCurrentProject'
,
...
...
@@ -425,7 +423,6 @@ class SlaprunnerTestCase(unittest.TestCase):
time
.
sleep
(
5
)
#Check that all partitions has been created
assert
"create-file"
in
open
(
self
.
app
.
config
[
'instance_log'
]).
read
()
instanceDir
=
os
.
listdir
(
self
.
app
.
config
[
'instance_root'
])
for
num
in
range
(
int
(
self
.
app
.
config
[
'partition_amount'
])):
partition
=
os
.
path
.
join
(
self
.
app
.
config
[
'instance_root'
],
self
.
partitionPrefix
+
str
(
num
))
...
...
@@ -454,7 +451,7 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
assertEqual
(
response
,
"0"
)
# Test if auto_deploy parameter starts the deployment of SR
self
.
updateConfigParameter
(
'auto_deploy'
,
True
)
self
.
setup
SoftwareFolder
()
self
.
setup
TestSoftware
()
response
=
isSoftwareReleaseReady
(
self
.
app
.
config
)
self
.
assertEqual
(
response
,
"2"
)
# Test that the new call to isSoftwareReleaseReady
...
...
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