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
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
Show 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,
isSoftwareRunning
,
startProxy
,
isSoftwareReleaseReady
,
runSlapgridUntilSuccess
,
getBuildAndRunParams
,
saveBuildAndRunParams
,
MAX_RUN_INSTANCE
,
MAX_RUN_SOFTWARE
)
getBuildAndRunParams
,
saveBuildAndRunParams
)
from
slapos.runner.process
import
killRunningProcess
,
isRunning
from
slapos.runner
import
views
import
slapos.slap
...
...
@@ -98,12 +97,23 @@ class SlaprunnerTestCase(unittest.TestCase):
SECRET_KEY
=
"123456"
,
PERMANENT_SESSION_LIFETIME
=
datetime
.
timedelta
(
days
=
31
),
auto_deploy
=
True
,
autorun
=
False
,
)
self
.
app
=
views
.
app
.
test_client
()
self
.
app
.
config
=
views
.
app
.
config
#Create password recover code
with
open
(
os
.
path
.
join
(
views
.
app
.
config
[
'etc_dir'
],
'.rcode'
),
'w'
)
as
rpwd
:
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
):
"""Remove all test data"""
...
...
@@ -452,6 +462,8 @@ class SlaprunnerTestCase(unittest.TestCase):
We directly calls runSlapgridUntilSuccess, because we want
to test the return code of the function"""
# 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
()
newSoftware
=
self
.
getCurrentSR
()
softwareRelease
=
"[buildout]
\
n
\
n
parts =
\
n
test-application
\
n
"
...
...
@@ -495,13 +507,13 @@ class SlaprunnerTestCase(unittest.TestCase):
project
.
write
(
self
.
software
+
'slaprunner-test'
)
project
.
close
()
# Build and Run
parameters
=
getBuildAndRunParams
()
parameters
=
getBuildAndRunParams
(
self
.
app
.
config
)
parameters
[
'run_instance'
]
=
False
saveBuildAndRunParams
(
parameters
)
saveBuildAndRunParams
(
self
.
app
.
config
,
parameters
)
response
=
runSlapgridUntilSuccess
(
self
.
app
.
config
,
'software'
)
self
.
assertEqual
(
response
,
1
)
parameters
[
'run_instance'
]
=
True
saveBuildAndRunParams
(
parameters
)
saveBuildAndRunParams
(
self
.
app
.
config
,
parameters
)
response
=
runSlapgridUntilSuccess
(
self
.
app
.
config
,
'software'
)
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