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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lu Xu
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):
...
@@ -187,35 +187,33 @@ class SlaprunnerTestCase(unittest.TestCase):
return
getProfilePath
(
self
.
app
.
config
[
'etc_dir'
],
return
getProfilePath
(
self
.
app
.
config
[
'etc_dir'
],
self
.
app
.
config
[
'software_profile'
])
self
.
app
.
config
[
'software_profile'
])
def
proxyStatus
(
self
,
status
=
True
,
sleep_time
=
0
):
def
proxyStatus
(
self
,
status
=
True
):
"""Helper for testslapproxy status"""
"""Helper for testslapproxy status"""
proxy
=
sup_process
.
isRunning
(
self
.
app
.
config
,
'slapproxy'
)
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
)
self
.
assertEqual
(
proxy
,
status
)
def
setupProjectFolder
(
self
,
withSoftware
=
False
):
def
setupProjectFolder
(
self
):
"""Helper to create a project folder as for slapos.git"""
"""Helper to create a project folder as for slapos.git"""
base
=
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
'slapos'
)
base
=
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
'slapos'
)
software
=
os
.
path
.
join
(
base
,
'software'
)
software
=
os
.
path
.
join
(
base
,
'software'
)
os
.
mkdir
(
base
)
os
.
mkdir
(
base
)
os
.
mkdir
(
software
)
os
.
mkdir
(
software
)
if
withSoftware
:
testSoftware
=
os
.
path
.
join
(
software
,
'slaprunner-test'
)
def
setupTestSoftware
(
self
):
sr
=
"[buildout]
\
n
\
n
"
"""Helper to setup Basic SR for testing purposes"""
sr
+=
"parts = command
\
n
\
n
unzip = true
\
n
networkcache-section = networkcache
\
n
\
n
"
self
.
setupProjectFolder
()
sr
+=
"find-links += http://www.nexedi.org/static/packages/source/slapos.buildout/
\
n
\
n
"
base
=
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
'slapos'
)
sr
+=
"[networkcache]
\
n
download-cache-url = http://www.shacache.org/shacache"
software
=
os
.
path
.
join
(
base
,
'software'
)
sr
+=
"
\
n
download-dir-url = http://www.shacache.org/shadir
\
n
\
n
"
testSoftware
=
os
.
path
.
join
(
software
,
'slaprunner-test'
)
sr
+=
"[command]
\
n
recipe = zc.recipe.egg
\
n
eggs = plone.recipe.command
\
n
zc.buildout
\
n
\
n
"
sr
=
"[buildout]
\
n
\
n
"
os
.
mkdir
(
testSoftware
)
sr
+=
"parts = command
\
n
\
n
unzip = true
\
n
networkcache-section = networkcache
\
n
\
n
"
open
(
os
.
path
.
join
(
testSoftware
,
self
.
app
.
config
[
'software_profile'
]),
sr
+=
"find-links += http://www.nexedi.org/static/packages/source/slapos.buildout/
\
n
\
n
"
'w'
).
write
(
sr
)
sr
+=
"[networkcache]
\
n
download-cache-url = http://www.shacache.org/shacache"
sr
+=
"
\
n
download-dir-url = http://www.shacache.org/shadir
\
n
\
n
"
def
setupSoftwareFolder
(
self
):
sr
+=
"[command]
\
n
recipe = zc.recipe.egg
\
n
eggs = plone.recipe.command
\
n
zc.buildout
\
n
\
n
"
"""Helper to setup compiled software release dir"""
os
.
mkdir
(
testSoftware
)
self
.
setupProjectFolder
(
withSoftware
=
True
)
open
(
os
.
path
.
join
(
testSoftware
,
self
.
app
.
config
[
'software_profile'
]),
'w'
).
write
(
sr
)
md5
=
hashlib
.
md5
(
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
md5
=
hashlib
.
md5
(
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
"slapos/software/slaprunner-test"
,
"slapos/software/slaprunner-test"
,
self
.
app
.
config
[
'software_profile'
])
self
.
app
.
config
[
'software_profile'
])
...
@@ -367,7 +365,7 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -367,7 +365,7 @@ class SlaprunnerTestCase(unittest.TestCase):
def
test_updateInstanceParameter
(
self
):
def
test_updateInstanceParameter
(
self
):
"""Scenarion 5: Update parameters of current sofware profile"""
"""Scenarion 5: Update parameters of current sofware profile"""
self
.
setAccount
()
self
.
setAccount
()
self
.
setup
SoftwareFolder
()
self
.
setup
TestSoftware
()
#Set current projet and run Slapgrid-cp
#Set current projet and run Slapgrid-cp
software
=
os
.
path
.
join
(
self
.
software
,
'slaprunner-test'
)
software
=
os
.
path
.
join
(
self
.
software
,
'slaprunner-test'
)
response
=
loadJson
(
self
.
app
.
post
(
'/setCurrentProject'
,
response
=
loadJson
(
self
.
app
.
post
(
'/setCurrentProject'
,
...
@@ -425,7 +423,6 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -425,7 +423,6 @@ class SlaprunnerTestCase(unittest.TestCase):
time
.
sleep
(
5
)
time
.
sleep
(
5
)
#Check that all partitions has been created
#Check that all partitions has been created
assert
"create-file"
in
open
(
self
.
app
.
config
[
'instance_log'
]).
read
()
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'
])):
for
num
in
range
(
int
(
self
.
app
.
config
[
'partition_amount'
])):
partition
=
os
.
path
.
join
(
self
.
app
.
config
[
'instance_root'
],
partition
=
os
.
path
.
join
(
self
.
app
.
config
[
'instance_root'
],
self
.
partitionPrefix
+
str
(
num
))
self
.
partitionPrefix
+
str
(
num
))
...
@@ -454,7 +451,7 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -454,7 +451,7 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
assertEqual
(
response
,
"0"
)
self
.
assertEqual
(
response
,
"0"
)
# Test if auto_deploy parameter starts the deployment of SR
# Test if auto_deploy parameter starts the deployment of SR
self
.
updateConfigParameter
(
'auto_deploy'
,
True
)
self
.
updateConfigParameter
(
'auto_deploy'
,
True
)
self
.
setup
SoftwareFolder
()
self
.
setup
TestSoftware
()
response
=
isSoftwareReleaseReady
(
self
.
app
.
config
)
response
=
isSoftwareReleaseReady
(
self
.
app
.
config
)
self
.
assertEqual
(
response
,
"2"
)
self
.
assertEqual
(
response
,
"2"
)
# Test that the new call to isSoftwareReleaseReady
# 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