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
Xavier Thompson
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
Show 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
import
json
import
os
import
shutil
import
time
import
unittest
import
hashlib
from
slapos.runner.utils
import
(
getProfilePath
,
getSession
,
isInstanceRunning
,
isSoftwareRunning
,
readPid
,
startProxy
,
killRunningProcess
)
from
slapos.runner.utils
import
(
getProfilePath
,
getSession
,
isInstanceRunning
,
isSoftwareRunning
,
startProxy
)
from
slapos.runner.process
import
killRunningProcess
,
isRunning
from
slapos.runner
import
views
import
slapos.slap
...
...
@@ -108,9 +110,9 @@ class SlaprunnerTestCase(unittest.TestCase):
shutil
.
rmtree
(
self
.
app
.
config
[
'software_link'
])
self
.
logout
()
#Stop process
killRunningProcess
(
self
.
app
.
config
,
'proxy.pid'
)
killRunningProcess
(
self
.
app
.
config
,
'slapgrid-cp.pid'
)
killRunningProcess
(
self
.
app
.
config
,
'slapgrid-sr.pid'
)
killRunningProcess
(
'slapproxy'
,
recursive
=
True
)
killRunningProcess
(
'slapgrid-cp'
,
recursive
=
True
)
killRunningProcess
(
'slapgrid-sr'
,
recursive
=
True
)
def
configAccount
(
self
,
username
,
password
,
email
,
name
,
rcode
):
"""Helper for configAccount"""
...
...
@@ -154,17 +156,13 @@ class SlaprunnerTestCase(unittest.TestCase):
def
getCurrentSR
(
self
):
return
getProfilePath
(
self
.
app
.
config
[
'etc_dir'
],
self
.
app
.
config
[
'software_profile'
])
def
proxyStatus
(
self
,
status
=
True
):
def
proxyStatus
(
self
,
status
=
True
,
sleep_time
=
0
):
"""Helper for testslapproxy status"""
proxy_pid
=
os
.
path
.
join
(
self
.
app
.
config
[
'run_dir'
],
'proxy.pid'
)
pid
=
readPid
(
proxy_pid
)
proxy
=
False
if
pid
:
try
:
os
.
kill
(
pid
,
0
)
proxy
=
True
except
Exception
:
pass
proxy
=
isRunning
(
'slapproxy'
)
if
proxy
!=
status
and
sleep_time
!=
0
:
time
.
sleep
(
sleep_time
)
proxy
=
isRunning
(
'slapproxy'
)
self
.
assertEqual
(
proxy
,
status
)
def
setupProjectFolder
(
self
,
withSoftware
=
False
):
...
...
@@ -207,8 +205,7 @@ class SlaprunnerTestCase(unittest.TestCase):
def
stopSlapproxy
(
self
):
"""Kill slapproxy process"""
killRunningProcess
(
self
.
app
.
config
,
'proxy.pid'
)
killRunningProcess
(
'slapproxy'
,
recursive
=
True
)
#Begin test case here
...
...
@@ -262,7 +259,7 @@ class SlaprunnerTestCase(unittest.TestCase):
startProxy
(
self
.
app
.
config
)
self
.
proxyStatus
(
True
)
self
.
stopSlapproxy
()
self
.
proxyStatus
(
False
)
self
.
proxyStatus
(
False
,
sleep_time
=
1
)
def
test_cloneProject
(
self
):
"""Start scenario 1 for deploying SR: Clone a project from git repository"""
...
...
@@ -319,7 +316,8 @@ class SlaprunnerTestCase(unittest.TestCase):
assert
software
in
currentSR
self
.
assertFalse
(
isInstanceRunning
(
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
.
stopSlapproxy
()
self
.
logout
()
...
...
@@ -411,7 +409,7 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
test_updateInstanceParameter
()
#Login
self
.
login
(
self
.
users
[
0
],
self
.
users
[
1
])
self
.
proxyStatus
(
False
)
self
.
proxyStatus
(
False
,
sleep_time
=
1
)
#run Software profile
response
=
loadJson
(
self
.
app
.
post
(
'/runSoftwareProfile'
,
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