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
Gabriel Monnerat
slapos.toolbox
Commits
bea2a72f
Commit
bea2a72f
authored
Oct 17, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated tests for new process way
parent
e459a6c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
+18
-20
slapos/runner/runnertest.py
slapos/runner/runnertest.py
+18
-20
No files found.
slapos/runner/runnertest.py
View file @
bea2a72f
...
@@ -7,11 +7,13 @@ import datetime
...
@@ -7,11 +7,13 @@ import datetime
import
json
import
json
import
os
import
os
import
shutil
import
shutil
import
time
import
unittest
import
unittest
import
hashlib
import
hashlib
from
slapos.runner.utils
import
(
getProfilePath
,
getSession
,
isInstanceRunning
,
isSoftwareRunning
,
readPid
,
from
slapos.runner.utils
import
(
getProfilePath
,
getSession
,
isInstanceRunning
,
startProxy
,
killRunningProcess
)
isSoftwareRunning
,
startProxy
)
from
slapos.runner.process
import
killRunningProcess
,
isRunning
from
slapos.runner
import
views
from
slapos.runner
import
views
import
slapos.slap
import
slapos.slap
...
@@ -108,9 +110,9 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -108,9 +110,9 @@ class SlaprunnerTestCase(unittest.TestCase):
shutil
.
rmtree
(
self
.
app
.
config
[
'software_link'
])
shutil
.
rmtree
(
self
.
app
.
config
[
'software_link'
])
self
.
logout
()
self
.
logout
()
#Stop process
#Stop process
killRunningProcess
(
self
.
app
.
config
,
'proxy.pid'
)
killRunningProcess
(
'slapproxy'
,
recursive
=
True
)
killRunningProcess
(
self
.
app
.
config
,
'slapgrid-cp.pid'
)
killRunningProcess
(
'slapgrid-cp'
,
recursive
=
True
)
killRunningProcess
(
self
.
app
.
config
,
'slapgrid-sr.pid'
)
killRunningProcess
(
'slapgrid-sr'
,
recursive
=
True
)
def
configAccount
(
self
,
username
,
password
,
email
,
name
,
rcode
):
def
configAccount
(
self
,
username
,
password
,
email
,
name
,
rcode
):
"""Helper for configAccount"""
"""Helper for configAccount"""
...
@@ -154,17 +156,13 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -154,17 +156,13 @@ class SlaprunnerTestCase(unittest.TestCase):
def
getCurrentSR
(
self
):
def
getCurrentSR
(
self
):
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
):
def
proxyStatus
(
self
,
status
=
True
,
sleep_time
=
0
):
"""Helper for testslapproxy status"""
"""Helper for testslapproxy status"""
proxy_pid
=
os
.
path
.
join
(
self
.
app
.
config
[
'run_dir'
],
'proxy.pid'
)
proxy
=
isRunning
(
'slapproxy'
)
pid
=
readPid
(
proxy_pid
)
if
proxy
!=
status
and
sleep_time
!=
0
:
proxy
=
False
time
.
sleep
(
sleep_time
)
if
pid
:
proxy
=
isRunning
(
'slapproxy'
)
try
:
os
.
kill
(
pid
,
0
)
proxy
=
True
except
Exception
:
pass
self
.
assertEqual
(
proxy
,
status
)
self
.
assertEqual
(
proxy
,
status
)
def
setupProjectFolder
(
self
,
withSoftware
=
False
):
def
setupProjectFolder
(
self
,
withSoftware
=
False
):
...
@@ -207,8 +205,7 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -207,8 +205,7 @@ class SlaprunnerTestCase(unittest.TestCase):
def
stopSlapproxy
(
self
):
def
stopSlapproxy
(
self
):
"""Kill slapproxy process"""
"""Kill slapproxy process"""
killRunningProcess
(
self
.
app
.
config
,
'proxy.pid'
)
killRunningProcess
(
'slapproxy'
,
recursive
=
True
)
#Begin test case here
#Begin test case here
...
@@ -262,7 +259,7 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -262,7 +259,7 @@ class SlaprunnerTestCase(unittest.TestCase):
startProxy
(
self
.
app
.
config
)
startProxy
(
self
.
app
.
config
)
self
.
proxyStatus
(
True
)
self
.
proxyStatus
(
True
)
self
.
stopSlapproxy
()
self
.
stopSlapproxy
()
self
.
proxyStatus
(
False
)
self
.
proxyStatus
(
False
,
sleep_time
=
1
)
def
test_cloneProject
(
self
):
def
test_cloneProject
(
self
):
"""Start scenario 1 for deploying SR: Clone a project from git repository"""
"""Start scenario 1 for deploying SR: Clone a project from git repository"""
...
@@ -319,7 +316,8 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -319,7 +316,8 @@ class SlaprunnerTestCase(unittest.TestCase):
assert
software
in
currentSR
assert
software
in
currentSR
self
.
assertFalse
(
isInstanceRunning
(
self
.
app
.
config
))
self
.
assertFalse
(
isInstanceRunning
(
self
.
app
.
config
))
self
.
assertFalse
(
isSoftwareRunning
(
self
.
app
.
config
))
self
.
assertFalse
(
isSoftwareRunning
(
self
.
app
.
config
))
#Slapproxy process is supose to be startednewSoftware = os.path.join(self.software, 'slaprunner-test')
#Slapproxy process is supose to be started
#newSoftware = os.path.join(self.software, 'slaprunner-test')
self
.
proxyStatus
(
True
)
self
.
proxyStatus
(
True
)
self
.
stopSlapproxy
()
self
.
stopSlapproxy
()
self
.
logout
()
self
.
logout
()
...
@@ -411,7 +409,7 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -411,7 +409,7 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
test_updateInstanceParameter
()
self
.
test_updateInstanceParameter
()
#Login
#Login
self
.
login
(
self
.
users
[
0
],
self
.
users
[
1
])
self
.
login
(
self
.
users
[
0
],
self
.
users
[
1
])
self
.
proxyStatus
(
False
)
self
.
proxyStatus
(
False
,
sleep_time
=
1
)
#run Software profile
#run Software profile
response
=
loadJson
(
self
.
app
.
post
(
'/runSoftwareProfile'
,
response
=
loadJson
(
self
.
app
.
post
(
'/runSoftwareProfile'
,
data
=
dict
(),
data
=
dict
(),
...
...
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