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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
Commits
a9e89465
Commit
a9e89465
authored
Nov 06, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check how alarm finds the instances.
parent
ceab55e5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
1 deletion
+87
-1
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreSlapOSFreeComputerPartition.py
...TemplateItem/testSlapOSCoreSlapOSFreeComputerPartition.py
+86
-0
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
No files found.
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreSlapOSFreeComputerPartition.py
View file @
a9e89465
...
...
@@ -116,3 +116,89 @@ class TestSlapOSFreeComputerPartitionAlarm(testSlapOSMixin):
self
.
assertEqual
(
None
,
self
.
software_instance
.
getAggregate
())
self
.
assertEqual
(
'busy'
,
self
.
partition
.
getSlapState
())
self
.
assertEqual
(
self
.
partition
.
getRelativeUrl
(),
software_instance
.
getAggregate
())
def
_simulateInstance_tryToUnallocatePartition
(
self
):
script_name
=
'Instance_tryToUnallocatePartition'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kwargs'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Instance_tryToUnallocatePartition') """
)
transaction
.
commit
()
def
_dropInstance_tryToUnallocatePartition
(
self
):
script_name
=
'Instance_tryToUnallocatePartition'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_alarm_allocated
(
self
):
self
.
_makeComputer
()
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
software_instance
.
invalidate
()
self
.
tic
()
self
.
_simulateInstance_tryToUnallocatePartition
()
try
:
self
.
portal
.
portal_alarms
.
slapos_free_computer_partition
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropInstance_tryToUnallocatePartition
()
self
.
assertEqual
(
'Visited by Instance_tryToUnallocatePartition'
,
self
.
software_instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_unallocated
(
self
):
self
.
_makeComputer
()
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
software_instance
.
invalidate
()
self
.
tic
()
self
.
_simulateInstance_tryToUnallocatePartition
()
try
:
self
.
portal
.
portal_alarms
.
slapos_free_computer_partition
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropInstance_tryToUnallocatePartition
()
self
.
assertNotEqual
(
'Visited by Instance_tryToUnallocatePartition'
,
self
.
software_instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_validated
(
self
):
self
.
_makeComputer
()
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
tic
()
self
.
_simulateInstance_tryToUnallocatePartition
()
try
:
self
.
portal
.
portal_alarms
.
slapos_free_computer_partition
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropInstance_tryToUnallocatePartition
()
self
.
assertNotEqual
(
'Visited by Instance_tryToUnallocatePartition'
,
self
.
software_instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_start_requested
(
self
):
self
.
_makeComputer
()
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
tic
()
self
.
_simulateInstance_tryToUnallocatePartition
()
try
:
self
.
portal
.
portal_alarms
.
slapos_free_computer_partition
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropInstance_tryToUnallocatePartition
()
self
.
assertNotEqual
(
'Visited by Instance_tryToUnallocatePartition'
,
self
.
software_instance
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
master/bt5/slapos_cloud/bt/revision
View file @
a9e89465
204
\ No newline at end of file
205
\ No newline at end of file
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