Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
b0447adf
Commit
b0447adf
authored
Jun 08, 2020
by
Jérome Perrin
Committed by
Alain Takoudjou
Jun 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_slapgrid: tests for software deletion
including the edge case where software permissions have been changed
parent
d97d01f8
Pipeline
#9843
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
slapos/tests/test_slapgrid.py
slapos/tests/test_slapgrid.py
+37
-0
No files found.
slapos/tests/test_slapgrid.py
View file @
b0447adf
...
@@ -397,6 +397,8 @@ class ComputerForTest(object):
...
@@ -397,6 +397,8 @@ class ComputerForTest(object):
return
{
'status_code'
:
200
}
return
{
'status_code'
:
200
}
if
url
.
path
==
'/buildingSoftwareRelease'
:
if
url
.
path
==
'/buildingSoftwareRelease'
:
return
{
'status_code'
:
200
}
return
{
'status_code'
:
200
}
if
url
.
path
==
'/destroyedSoftwareRelease'
:
return
{
'status_code'
:
200
}
if
url
.
path
==
'/softwareReleaseError'
:
if
url
.
path
==
'/softwareReleaseError'
:
software
.
error_log
=
'
\
n
'
.
join
(
software
.
error_log
=
'
\
n
'
.
join
(
[
[
...
@@ -1921,6 +1923,41 @@ echo %s; echo %s; exit 42""" % (line1, line2))
...
@@ -1921,6 +1923,41 @@ echo %s; echo %s; exit 42""" % (line1, line2))
self
.
launchSlapgridSoftware
()
self
.
launchSlapgridSoftware
()
self
.
assertIn
(
'shared-part-list = %s'
%
self
.
shared_parts_root
,
software
.
error_log
)
self
.
assertIn
(
'shared-part-list = %s'
%
self
.
shared_parts_root
,
software
.
error_log
)
def
test_remove_software
(
self
):
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
,
1
,
1
)
with
httmock
.
HTTMock
(
computer
.
request_handler
):
software
=
computer
.
software_list
[
0
]
software
.
setBuildout
(
"""#!/bin/sh
mkdir directory
touch directory/file
"""
)
self
.
launchSlapgridSoftware
()
self
.
assertIn
(
'directory'
,
os
.
listdir
(
os
.
path
.
join
(
self
.
software_root
,
software
.
software_hash
)))
software
.
requested_state
=
'destroyed'
self
.
launchSlapgridSoftware
()
self
.
assertEqual
(
os
.
listdir
(
self
.
software_root
),
[])
def
test_remove_software_chmod
(
self
):
# This software is "hard" to remove, as permissions have been changed
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
,
1
,
1
)
with
httmock
.
HTTMock
(
computer
.
request_handler
):
software
=
computer
.
software_list
[
0
]
software
.
setBuildout
(
"""#!/bin/sh
mkdir directory
touch directory/file
chmod a-rxw directory/file
chmod a-rxw directory
"""
)
self
.
launchSlapgridSoftware
()
self
.
assertIn
(
'directory'
,
os
.
listdir
(
os
.
path
.
join
(
self
.
software_root
,
software
.
software_hash
)))
software
.
requested_state
=
'destroyed'
self
.
launchSlapgridSoftware
()
self
.
assertEqual
(
os
.
listdir
(
self
.
software_root
),
[])
class
SlapgridInitialization
(
unittest
.
TestCase
):
class
SlapgridInitialization
(
unittest
.
TestCase
):
"""
"""
...
...
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