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
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
Jérome Perrin
slapos.core
Commits
14a330df
Commit
14a330df
authored
Nov 22, 2023
by
Jérome Perrin
Committed by
Xavier Thompson
Nov 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_object: start a supervisor for test instead of mocking updateSupervisor
This method is important we want to test it
parent
0212d575
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
slapos/tests/test_object.py
slapos/tests/test_object.py
+18
-6
No files found.
slapos/tests/test_object.py
View file @
14a330df
...
...
@@ -40,6 +40,8 @@ from slapos.slap import ComputerPartition as SlapComputerPartition
from
slapos.grid.SlapObject
import
Partition
,
Software
from
slapos.grid
import
utils
from
slapos.grid
import
networkcache
from
slapos.grid
import
svcbackend
# XXX: BasicMixin should be in a separated module, not in slapgrid test module.
from
slapos.tests.test_slapgrid
import
BasicMixin
...
...
@@ -98,7 +100,15 @@ class MasterMixin(BasicMixin, unittest.TestCase):
os
.
mkdir
(
self
.
software_root
)
os
.
mkdir
(
self
.
instance_root
)
logger
=
logging
.
getLogger
(
self
.
id
())
svcbackend
.
createSupervisordConfiguration
(
self
.
instance_root
,
logger
)
svcbackend
.
launchSupervisord
(
self
.
instance_root
,
logger
)
self
.
supervisord_socket
=
svcbackend
.
_getSupervisordSocketPath
(
self
.
instance_root
,
logger
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
supervisord_socket
))
def
tearDown
(
self
):
with
self
.
supervisor
as
s
:
s
.
shutdown
()
BasicMixin
.
tearDown
(
self
)
# Un-monkey patch possible modules
...
...
@@ -107,6 +117,10 @@ class MasterMixin(BasicMixin, unittest.TestCase):
utils
.
bootstrapBuildout
=
originalBootstrapBuildout
utils
.
launchBuildout
=
originalLaunchBuildout
@
property
def
supervisor
(
self
):
return
svcbackend
.
getSupervisorRPC
(
self
.
supervisord_socket
)
# Helper functions
def
createSoftware
(
self
,
url
=
None
,
empty
=
False
):
"""
...
...
@@ -162,17 +176,16 @@ class MasterMixin(BasicMixin, unittest.TestCase):
os
.
mkdir
(
instance_path
)
os
.
chmod
(
instance_path
,
0o750
)
supervisor_configuration_path
=
os
.
path
.
join
(
self
.
instance_root
,
'supervisor'
)
os
.
mkdir
(
supervisor_configuration_path
)
supervisor_configuration_path
=
svcbackend
.
_getSupervisordConfigurationDirectory
(
self
.
instance_root
)
partition
=
Partition
(
software_path
=
software_path
,
instance_path
=
instance_path
,
shared_part_list
=
shared_part_list
,
supervisord_partition_configuration_dir
=
supervisor_configuration_path
,
supervisord_socket
=
os
.
path
.
join
(
supervisor_configuration_path
,
'supervisor.sock'
),
supervisord_socket
=
svcbackend
.
_getSupervisordSocketPath
(
self
.
instance_root
,
logging
.
getLogger
(
self
.
id
())
),
computer_partition
=
slap_computer_partition
,
computer_id
=
'bidon'
,
partition_id
=
partition_id
,
...
...
@@ -183,7 +196,6 @@ class MasterMixin(BasicMixin, unittest.TestCase):
partition_timeout
=
partition_timeout
,
)
partition
.
updateSupervisor
=
FakeCallAndNoop
if
retention_delay
:
partition
.
retention_delay
=
retention_delay
...
...
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