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
Lisa Casino
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
Show 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,21 +187,23 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -187,21 +187,23 @@ 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
:
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'
)
testSoftware
=
os
.
path
.
join
(
software
,
'slaprunner-test'
)
sr
=
"[buildout]
\
n
\
n
"
sr
=
"[buildout]
\
n
\
n
"
sr
+=
"parts = command
\
n
\
n
unzip = true
\
n
networkcache-section = networkcache
\
n
\
n
"
sr
+=
"parts = command
\
n
\
n
unzip = true
\
n
networkcache-section = networkcache
\
n
\
n
"
...
@@ -212,10 +214,6 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -212,10 +214,6 @@ class SlaprunnerTestCase(unittest.TestCase):
os
.
mkdir
(
testSoftware
)
os
.
mkdir
(
testSoftware
)
open
(
os
.
path
.
join
(
testSoftware
,
self
.
app
.
config
[
'software_profile'
]),
open
(
os
.
path
.
join
(
testSoftware
,
self
.
app
.
config
[
'software_profile'
]),
'w'
).
write
(
sr
)
'w'
).
write
(
sr
)
def
setupSoftwareFolder
(
self
):
"""Helper to setup compiled software release dir"""
self
.
setupProjectFolder
(
withSoftware
=
True
)
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