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
Paul Graydon
slapos.core
Commits
2a4ba714
Commit
2a4ba714
authored
Jun 06, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Helpers in slapobject test
parent
4c1d31d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
slapos/tests/slapobject.py
slapos/tests/slapobject.py
+71
-0
No files found.
slapos/tests/slapobject.py
View file @
2a4ba714
...
...
@@ -97,6 +97,77 @@ class MasterMixin(BasicMixin, unittest.TestCase):
utils
.
bootstrapBuildout
=
originalBootstrapBuildout
utils
.
launchBuildout
=
originalLaunchBuildout
# Helper functions
def
createSoftware
(
self
,
url
=
None
,
empty
=
False
):
"""
Create an empty software, and return a Software object from
dummy parameters.
"""
if
url
is
None
:
url
=
'mysoftware'
software_path
=
os
.
path
.
join
(
self
.
software_root
,
utils
.
md5digest
(
url
))
os
.
mkdir
(
software_path
)
if
not
empty
:
# Populate the Software Release directory so that it is "complete" and
# "working" from a slapos point of view.
open
(
os
.
path
.
join
(
software_path
,
'instance.cfg'
),
'w'
).
close
()
return
Software
(
url
=
url
,
software_root
=
self
.
software_root
,
buildout
=
self
.
buildout
,
logger
=
logging
.
getLogger
(),
)
def
createPartition
(
self
,
software_release_url
,
partition_id
=
None
,
slap_computer_partition
=
None
):
"""
Create a partition, and return a Partition object created
from dummy parameters.
"""
# XXX dirty, should disappear when Partition is cleaned up
software_path
=
os
.
path
.
join
(
self
.
software_root
,
utils
.
md5digest
(
software_release_url
)
)
if
partition_id
is
None
:
partition_id
=
'mypartition'
if
slap_computer_partition
is
None
:
slap_computer_partition
=
SlapComputerPartition
(
computer_id
=
'bidon'
,
partition_id
=
partition_id
)
instance_path
=
os
.
path
.
join
(
self
.
instance_root
,
partition_id
)
os
.
mkdir
(
instance_path
)
os
.
chmod
(
instance_path
,
0o750
)
supervisor_configuration_path
=
os
.
path
.
join
(
self
.
instance_root
,
'supervisor'
)
os
.
mkdir
(
supervisor_configuration_path
)
return
Partition
(
software_path
=
software_path
,
instance_path
=
instance_path
,
supervisord_partition_configuration_path
=
supervisor_configuration_path
,
supervisord_socket
=
os
.
path
.
join
(
supervisor_configuration_path
,
'supervisor.sock'
),
computer_partition
=
slap_computer_partition
,
computer_id
=
'bidon'
,
partition_id
=
partition_id
,
server_url
=
'bidon'
,
software_release_url
=
software_release_url
,
buildout
=
self
.
buildout
,
logger
=
logging
.
getLogger
(),
)
class
TestSoftwareNetworkCacheSlapObject
(
MasterMixin
,
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