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
Justin
slapos.toolbox
Commits
07eaa133
Commit
07eaa133
authored
Jan 27, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: tests modified to correctly use config.json
parent
3183f4d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
slapos/runner/runnertest.py
slapos/runner/runnertest.py
+17
-5
No files found.
slapos/runner/runnertest.py
View file @
07eaa133
...
@@ -24,8 +24,7 @@ from slapos.runner.utils import (getProfilePath, getSession, isInstanceRunning,
...
@@ -24,8 +24,7 @@ from slapos.runner.utils import (getProfilePath, getSession, isInstanceRunning,
isSoftwareRunning
,
startProxy
,
isSoftwareRunning
,
startProxy
,
isSoftwareReleaseReady
,
isSoftwareReleaseReady
,
runSlapgridUntilSuccess
,
runSlapgridUntilSuccess
,
getBuildAndRunParams
,
saveBuildAndRunParams
,
getBuildAndRunParams
,
saveBuildAndRunParams
)
MAX_RUN_INSTANCE
,
MAX_RUN_SOFTWARE
)
from
slapos.runner.process
import
killRunningProcess
,
isRunning
from
slapos.runner.process
import
killRunningProcess
,
isRunning
from
slapos.runner
import
views
from
slapos.runner
import
views
import
slapos.slap
import
slapos.slap
...
@@ -98,12 +97,23 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -98,12 +97,23 @@ class SlaprunnerTestCase(unittest.TestCase):
SECRET_KEY
=
"123456"
,
SECRET_KEY
=
"123456"
,
PERMANENT_SESSION_LIFETIME
=
datetime
.
timedelta
(
days
=
31
),
PERMANENT_SESSION_LIFETIME
=
datetime
.
timedelta
(
days
=
31
),
auto_deploy
=
True
,
auto_deploy
=
True
,
autorun
=
False
,
)
)
self
.
app
=
views
.
app
.
test_client
()
self
.
app
=
views
.
app
.
test_client
()
self
.
app
.
config
=
views
.
app
.
config
self
.
app
.
config
=
views
.
app
.
config
#Create password recover code
#Create password recover code
with
open
(
os
.
path
.
join
(
views
.
app
.
config
[
'etc_dir'
],
'.rcode'
),
'w'
)
as
rpwd
:
with
open
(
os
.
path
.
join
(
views
.
app
.
config
[
'etc_dir'
],
'.rcode'
),
'w'
)
as
rpwd
:
rpwd
.
write
(
self
.
rcode
)
rpwd
.
write
(
self
.
rcode
)
#Create config.json
json_file
=
os
.
path
.
join
(
views
.
app
.
config
[
'etc_dir'
],
'config.json'
)
if
not
os
.
path
.
exists
(
json_file
):
params
=
{
'run_instance'
:
True
,
'run_software'
:
True
,
'max_run_instance'
:
3
,
'max_run_software'
:
2
}
open
(
json_file
,
"w"
).
write
(
json
.
dumps
(
params
))
def
tearDown
(
self
):
def
tearDown
(
self
):
"""Remove all test data"""
"""Remove all test data"""
...
@@ -452,6 +462,8 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -452,6 +462,8 @@ class SlaprunnerTestCase(unittest.TestCase):
We directly calls runSlapgridUntilSuccess, because we want
We directly calls runSlapgridUntilSuccess, because we want
to test the return code of the function"""
to test the return code of the function"""
# Installs a wrong buildout which will fail
# Installs a wrong buildout which will fail
MAX_RUN_SOFTWARE
=
getBuildAndRunParams
(
self
.
app
.
config
)[
'max_run_software'
]
MAX_RUN_INSTANCE
=
getBuildAndRunParams
(
self
.
app
.
config
)[
'max_run_instance'
]
self
.
test_createSR
()
self
.
test_createSR
()
newSoftware
=
self
.
getCurrentSR
()
newSoftware
=
self
.
getCurrentSR
()
softwareRelease
=
"[buildout]
\
n
\
n
parts =
\
n
test-application
\
n
"
softwareRelease
=
"[buildout]
\
n
\
n
parts =
\
n
test-application
\
n
"
...
@@ -495,13 +507,13 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -495,13 +507,13 @@ class SlaprunnerTestCase(unittest.TestCase):
project
.
write
(
self
.
software
+
'slaprunner-test'
)
project
.
write
(
self
.
software
+
'slaprunner-test'
)
project
.
close
()
project
.
close
()
# Build and Run
# Build and Run
parameters
=
getBuildAndRunParams
()
parameters
=
getBuildAndRunParams
(
self
.
app
.
config
)
parameters
[
'run_instance'
]
=
False
parameters
[
'run_instance'
]
=
False
saveBuildAndRunParams
(
parameters
)
saveBuildAndRunParams
(
self
.
app
.
config
,
parameters
)
response
=
runSlapgridUntilSuccess
(
self
.
app
.
config
,
'software'
)
response
=
runSlapgridUntilSuccess
(
self
.
app
.
config
,
'software'
)
self
.
assertEqual
(
response
,
1
)
self
.
assertEqual
(
response
,
1
)
parameters
[
'run_instance'
]
=
True
parameters
[
'run_instance'
]
=
True
saveBuildAndRunParams
(
parameters
)
saveBuildAndRunParams
(
self
.
app
.
config
,
parameters
)
response
=
runSlapgridUntilSuccess
(
self
.
app
.
config
,
'software'
)
response
=
runSlapgridUntilSuccess
(
self
.
app
.
config
,
'software'
)
self
.
assertEqual
(
response
,
(
1
,
MAX_RUN_INSTANCE
))
self
.
assertEqual
(
response
,
(
1
,
MAX_RUN_INSTANCE
))
...
...
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