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
Kazuhiko Shiozaki
slapos.toolbox
Commits
086a9951
Commit
086a9951
authored
Aug 11, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test / runner: new test for instances removal
parent
26731381
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
slapos/test/test_runner.py
slapos/test/test_runner.py
+24
-0
No files found.
slapos/test/test_runner.py
View file @
086a9951
...
@@ -158,6 +158,30 @@ class TestRunnerBackEnd(unittest.TestCase):
...
@@ -158,6 +158,30 @@ class TestRunnerBackEnd(unittest.TestCase):
self
.
assertTrue
(
result
)
self
.
assertTrue
(
result
)
runner_utils
.
open
.
assert_has_calls
([
mock
.
call
().
write
(
projectpath
)])
runner_utils
.
open
.
assert_has_calls
([
mock
.
call
().
write
(
projectpath
)])
@
mock
.
patch
(
'slapos.runner.utils.isInstanceRunning'
)
@
mock
.
patch
(
'slapos.runner.utils.svcStopAll'
)
def
test_removingInstanceStopsProcessesAndCleansInstanceDirectory
(
self
,
mock_svcStopAll
,
mock_isInstanceRunning
):
"""
When removing the current running instances, processes should be stopped
and directories deleted properly
"""
cwd
=
os
.
getcwd
()
config
=
{
'database_uri'
:
os
.
path
.
join
(
cwd
,
'proxy.db'
),
'etc_dir'
:
os
.
path
.
join
(
cwd
,
'etc'
),
'instance_root'
:
os
.
path
.
join
(
cwd
,
'instance'
),}
# If slapos node is running, removeCurrentInstance returns a string
mock_isInstanceRunning
.
return_value
=
True
self
.
assertTrue
(
isinstance
(
runner_utils
.
removeCurrentInstance
(
config
),
str
))
self
.
assertTrue
(
mock_isInstanceRunning
.
called
)
# If slapos is not running, process should be stopped and directories emptied
mock_isInstanceRunning
.
return_value
=
False
result
=
runner_utils
.
removeCurrentInstance
(
config
)
self
.
assertTrue
(
mock_svcStopAll
.
called
)
self
.
sup_process
.
stopProcess
.
assert_called_with
(
config
,
'slapproxy'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
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