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
Nicolas Wavrant
slapos.core
Commits
4896e97b
Commit
4896e97b
authored
Jun 06, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add testsuite for SlapObject.Partition
parent
2a4ba714
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
slapos/tests/slapobject.py
slapos/tests/slapobject.py
+68
-0
No files found.
slapos/tests/slapobject.py
View file @
4896e97b
...
...
@@ -314,3 +314,71 @@ class TestSoftwareNetworkCacheSlapObject(MasterMixin, unittest.TestCase):
)
software
.
install
()
self
.
assertTrue
(
getattr
(
self
,
'uploaded'
,
False
))
class
TestPartitionSlapObject
(
MasterMixin
,
unittest
.
TestCase
):
def
setUp
(
self
):
MasterMixin
.
setUp
(
self
)
Partition
.
generateSupervisorConfigurationFile
=
FakeCallAndNoop
()
utils
.
bootstrapBuildout
=
FakeCallAndNoop
()
utils
.
launchBuildout
=
FakeCallAndStore
()
def
tearDown
(
self
):
MasterMixin
.
tearDown
(
self
)
Partition
.
generateSupervisorConfigurationFile
=
originalPartitionGenerateSupervisorConfigurationFile
def
test_instance_is_deploying_if_software_release_exists
(
self
):
"""
Test that slapgrid deploys an instance if its Software Release exists and
instance.cfg in the Software Release exists.
"""
software
=
self
.
createSoftware
()
partition
=
self
.
createPartition
(
software
.
url
)
partition
.
install
()
self
.
assertTrue
(
utils
.
launchBuildout
.
called
)
def
test_backward_compatibility_instance_is_deploying_if_template_cfg_is_used
(
self
):
"""
Backward compatibility test, for old software releases.
Test that slapgrid deploys an instance if its Software Release exists and
template.cfg in the Software Release exists.
"""
software
=
self
.
createSoftware
(
empty
=
True
)
open
(
os
.
path
.
join
(
software
.
software_path
,
'template.cfg'
),
'w'
).
close
()
partition
=
self
.
createPartition
(
software
.
url
)
partition
.
install
()
self
.
assertTrue
(
utils
.
launchBuildout
.
called
)
def
test_instance_slapgrid_raise_if_software_release_instance_profile_does_not_exist
(
self
):
"""
Test that slapgrid raises XXX when deploying an instance if the Software Release
related to the instance is not correctly installed (i.e there is no
instance.cfg in it).
"""
software
=
self
.
createSoftware
(
empty
=
True
)
partition
=
self
.
createPartition
(
software
.
url
)
# XXX: What should it raise?
self
.
assertRaises
(
IOError
,
partition
.
install
)
def
test_instance_slapgrid_raise_if_software_release_does_not_exist
(
self
):
"""
Test that slapgrid raises XXX when deploying an instance if the Software Release
related to the instance is not present at all (i.e its directory does not
exist at all).
"""
software
=
self
.
createSoftware
(
empty
=
True
)
os
.
rmdir
(
software
.
software_path
)
partition
=
self
.
createPartition
(
software
.
url
)
# XXX: What should it raise?
self
.
assertRaises
(
IOError
,
partition
.
install
)
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