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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos.toolbox
Commits
f6b529a1
Commit
f6b529a1
authored
Aug 11, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: tests the removal of Software Releases
parent
0fbb9119
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
slapos/test/test_runner.py
slapos/test/test_runner.py
+41
-0
No files found.
slapos/test/test_runner.py
View file @
f6b529a1
...
...
@@ -183,6 +183,47 @@ class TestRunnerBackEnd(unittest.TestCase):
self
.
assertTrue
(
mock_svcStopAll
.
called
)
self
.
sup_process
.
stopProcess
.
assert_called_with
(
config
,
'slapproxy'
)
@
mock
.
patch
(
'os.listdir'
)
@
mock
.
patch
(
'os.path.exists'
)
@
mock
.
patch
(
'slapos.runner.utils.removeCurrentInstance'
)
@
mock
.
patch
(
'slapos.runner.utils.removeSoftwareRootDirectory'
)
def
test_removingUsedSoftwareReleaseCleansInstancesToo
(
self
,
mock_removeSoftwareRootDirectory
,
mock_removeCurrentInstance
,
mock_path_exists
,
mock_listdir
):
"""
When removing the Software Release on which depends the current running
instances, the current instances should be stopped and removed properly.
"""
# mock_listir is needed for not raising in loadSoftwareRList or future equivalent
mock_listdir
.
return_value
=
[]
cwd
=
os
.
getcwd
()
config
=
{
'etc_dir'
:
os
.
path
.
join
(
cwd
,
'etc'
),
'software_root'
:
os
.
path
.
join
(
cwd
,
'software'
),
'software_link'
:
os
.
path
.
join
(
cwd
,
'softwareLink'
),}
self
.
sup_process
.
isRunning
.
return_value
=
False
# First tests that if the current instance doesn't extend the Software
# Release to delete, the instance isn't deleted
runner_utils
.
open
=
mock
.
mock_open
(
read_data
=
"/workspace/software/another/"
)
runner_utils
.
removeSoftwareByName
(
config
,
'1234567890'
,
'my_software_name'
)
self
.
assertFalse
(
mock_removeCurrentInstance
.
called
)
self
.
assertTrue
(
mock_removeSoftwareRootDirectory
.
called
)
# If the current Instance extends the Software Release, then both must
# be removed
mock_removeSoftwareRootDirectory
.
reset_mock
()
runner_utils
.
open
=
mock
.
mock_open
(
read_data
=
"/workspace/software/my_software_name/"
)
runner_utils
.
removeSoftwareByName
(
config
,
'1234567890'
,
'my_software_name'
)
self
.
assertTrue
(
mock_removeCurrentInstance
.
called
)
self
.
assertTrue
(
mock_removeSoftwareRootDirectory
.
called
)
if
__name__
==
'__main__'
:
random
.
seed
()
...
...
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