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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
338d5585
Commit
338d5585
authored
Jan 09, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: project needed in compute node / instance
parent
7be88836
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
66 deletions
+88
-66
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+6
-5
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
...eItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
+82
-61
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
338d5585
...
...
@@ -269,11 +269,10 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateEmptyXml
(),
shared
=
False
,
state
=
"started"
state
=
"started"
,
project_reference
=
project
.
getReference
()
)
self
.
person_user
=
self
.
makePerson
(
project
,
new_id
=
new_id
,
index
=
False
)
self
.
commit
()
# prepare part of tree
self
.
instance_tree
=
self
.
portal
.
instance_tree_module
\
.
template_instance_tree
.
Base_createCloneDocument
(
batch_mode
=
1
)
...
...
@@ -289,7 +288,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
sla_xml
=
self
.
request_kw
[
'sla_xml'
],
root_slave
=
self
.
request_kw
[
'shared'
],
successor
=
self
.
software_instance
.
getRelativeUrl
(),
destination_section
=
self
.
person_user
.
getRelativeUrl
()
follow_up_value
=
project
)
self
.
instance_tree
.
validate
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
instance_tree
,
'start_requested'
)
...
...
@@ -304,7 +303,8 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
text_content
=
self
.
request_kw
[
'instance_xml'
],
sla_xml
=
self
.
request_kw
[
'sla_xml'
],
specialise
=
self
.
instance_tree
.
getRelativeUrl
(),
successor
=
self
.
requested_software_instance
.
getRelativeUrl
()
successor
=
self
.
requested_software_instance
.
getRelativeUrl
(),
follow_up_value
=
project
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'start_requested'
)
self
.
software_instance
.
validate
()
...
...
@@ -318,6 +318,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
text_content
=
self
.
request_kw
[
'instance_xml'
],
sla_xml
=
self
.
request_kw
[
'sla_xml'
],
specialise
=
self
.
instance_tree
.
getRelativeUrl
(),
follow_up_value
=
project
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
requested_software_instance
,
'start_requested'
)
self
.
requested_software_instance
.
validate
()
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
View file @
338d5585
...
...
@@ -11,7 +11,8 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
_makeTree
()
self
.
project
=
self
.
addProject
()
self
.
_makeTree
(
self
.
project
)
def
test_InstanceTree_assertSuccessor
(
self
):
self
.
software_instance
.
rename
(
new_name
=
self
.
generateNewSoftwareTitle
())
...
...
@@ -86,10 +87,11 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
_makeTree
()
self
.
project
=
self
.
addProject
()
self
.
_makeTree
(
self
.
project
)
def
test_SoftwareInstance_tryToUnallocatePartition
(
self
):
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
...
...
@@ -102,7 +104,7 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'free'
,
self
.
partition
.
getSlapState
())
def
test_SoftwareInstance_tryToUnallocatePartition_concurrency
(
self
):
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
...
...
@@ -122,7 +124,7 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
software_instance
=
self
.
portal
.
software_instance_module
\
.
template_software_instance
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
...
...
@@ -137,7 +139,7 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
self
.
partition
.
getRelativeUrl
(),
software_instance
.
getAggregate
())
def
test_alarm_allocated
(
self
):
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
...
...
@@ -151,7 +153,7 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
)
def
test_alarm_unallocated
(
self
):
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
...
...
@@ -164,7 +166,7 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
)
def
test_alarm_validated
(
self
):
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
...
...
@@ -177,7 +179,7 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
)
def
test_alarm_start_requested
(
self
):
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
...
...
@@ -190,10 +192,12 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
class
TestSlapOSFreeComputePartitionAlarmWithSlave
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
_makeTree
(
requested_template_id
=
'template_slave_instance'
)
self
.
project
=
self
.
addProject
()
self
.
_makeTree
(
self
.
project
,
requested_template_id
=
'template_slave_instance'
)
def
test_SoftwareInstance_tryToUnallocatePartition
(
self
):
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
...
...
@@ -206,7 +210,7 @@ class TestSlapOSFreeComputePartitionAlarmWithSlave(SlapOSTestCaseMixin):
self
.
assertEqual
(
'free'
,
self
.
partition
.
getSlapState
())
def
test_SoftwareInstance_tryToUnallocatePartition_nonDestroyed
(
self
):
self
.
_makeComputeNode
()
self
.
_makeComputeNode
(
self
.
project
)
self
.
software_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
tic
()
...
...
@@ -222,7 +226,8 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
_makeTree
()
self
.
project
=
self
.
addProject
()
self
.
_makeTree
(
self
.
project
)
def
test_SoftwareInstance_tryToGarbageCollect
(
self
):
self
.
instance_tree
.
archive
()
...
...
@@ -355,15 +360,17 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
class
TestSlapOSComputeNode_checkAndUpdateCapacityScope
(
SlapOSTestCaseMixin
):
allocation_scope_to_test
=
'open
/public
'
allocation_scope_to_test
=
'open'
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
project
=
self
.
addProject
()
self
.
compute_node
=
self
.
portal
.
compute_node_module
.
template_compute_node
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
compute_node
.
edit
(
allocation_scope
=
self
.
allocation_scope_to_test
,
reference
=
'TESTC-%s'
%
self
.
generateNewId
(),
follow_up_value
=
self
.
project
)
self
.
compute_node
.
edit
(
capacity_scope
=
'open'
)
self
.
compute_node
.
validate
()
...
...
@@ -404,7 +411,7 @@ class TestSlapOSComputeNode_checkAndUpdateCapacityScope(SlapOSTestCaseMixin):
self
.
compute_node
.
getCapacityQuantity
())
def
test_ComputeNode_checkAndUpdateCapacityScope_model_no_capacity
(
self
):
self
.
_makeTree
()
self
.
_makeTree
(
self
.
project
)
computer_model
=
self
.
_newComputerModel
(
1
)
self
.
compute_node
.
edit
(
specialise_value
=
computer_model
,
...
...
@@ -421,7 +428,7 @@ class TestSlapOSComputeNode_checkAndUpdateCapacityScope(SlapOSTestCaseMixin):
def
test_ComputeNode_checkAndUpdateCapacityScope_model_has_capacity
(
self
):
# If capacity is set on compute_node, model value is ignored.
self
.
_makeTree
()
self
.
_makeTree
(
self
.
project
)
computer_model
=
self
.
_newComputerModel
(
1
)
self
.
compute_node
.
edit
(
specialise_value
=
computer_model
,
...
...
@@ -447,7 +454,7 @@ class TestSlapOSComputeNode_checkAndUpdateCapacityScope(SlapOSTestCaseMixin):
self
.
compute_node
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_ComputeNode_checkAndUpdateCapacityScope_no_capacity_quantity
(
self
):
self
.
_makeTree
()
self
.
_makeTree
(
self
.
project
)
self
.
compute_node
.
edit
(
capacity_quantity
=
1
)
self
.
_addPartitionToComputeNode
()
self
.
compute_node
.
ComputeNode_checkAndUpdateCapacityScope
()
...
...
@@ -474,14 +481,6 @@ class TestSlapOSComputeNode_checkAndUpdateCapacityScope(SlapOSTestCaseMixin):
self
.
assertEqual
(
"Compute Node reported an error"
,
self
.
compute_node
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
class
TestSlapOSComputeNode_checkAndUpdateCapacityScopeSubscription
(
TestSlapOSComputeNode_checkAndUpdateCapacityScope
):
allocation_scope_to_test
=
'open/subscription'
class
TestSlapOSComputeNode_checkAndUpdateCapacityScopePersonal
(
TestSlapOSComputeNode_checkAndUpdateCapacityScope
):
allocation_scope_to_test
=
'open/personal'
class
TestSlapOSUpdateComputeNodeCapacityScopeAlarm
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
compute_node
=
self
.
portal
.
compute_node_module
.
template_compute_node
\
...
...
@@ -502,12 +501,8 @@ class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin):
'ComputeNode_checkAndUpdateCapacityScope'
)
def
test_alarm_subscription
(
self
):
self
.
compute_node
.
edit
(
allocation_scope
=
'open/subscription'
)
self
.
test_alarm
()
def
test_alarm_personal
(
self
):
self
.
compute_node
.
edit
(
allocation_scope
=
'open/personal'
)
def
test_alarm_open
(
self
):
self
.
compute_node
.
edit
(
allocation_scope
=
'open'
)
self
.
test_alarm
()
def
test_alarm_non_public
(
self
):
...
...
@@ -528,10 +523,15 @@ class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin):
class
TestSlapOSGarbageCollectStoppedRootTreeAlarm
(
SlapOSTestCaseMixin
):
def
createInstance
(
self
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
project
=
self
.
addProject
()
def
createInstance
(
self
,
project
):
instance_tree
=
self
.
portal
.
instance_tree_module
\
.
template_instance_tree
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance_tree
.
edit
(
follow_up_value
=
project
)
instance_tree
.
validate
()
instance_tree
.
edit
(
...
...
@@ -546,7 +546,8 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
instance_tree
.
getTitle
(),
state
=
'started'
state
=
'started'
,
project_reference
=
project
.
getReference
()
)
instance_tree
.
requestStart
(
**
request_kw
)
instance_tree
.
requestInstance
(
**
request_kw
)
...
...
@@ -562,7 +563,7 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
REQUEST
=
{})
def
test_SoftwareInstance_tryToStopCollect_started_instance
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance_tree
=
instance
.
getSpecialiseValue
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
instance_tree
,
...
...
@@ -573,7 +574,7 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'stop_requested'
,
instance
.
getSlapState
())
def
test_SoftwareInstance_tryToStopCollect_destroyed_instance
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance_tree
=
instance
.
getSpecialiseValue
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
instance_tree
,
...
...
@@ -585,7 +586,7 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'destroy_requested'
,
instance
.
getSlapState
())
def
test_SoftwareInstance_tryToStopCollect_started_subscription
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance_tree
=
instance
.
getSpecialiseValue
()
self
.
assertEqual
(
'start_requested'
,
instance_tree
.
getSlapState
())
...
...
@@ -603,7 +604,7 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
)
def
test_alarm_invalidated
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance
.
invalidate
()
self
.
_test_alarm_not_visited
(
self
.
portal
.
portal_alarms
.
slapos_stop_collect_instance
,
...
...
@@ -613,9 +614,16 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
class
TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm
(
SlapOSTestCaseMixin
):
def
createInstance
(
self
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
project
=
self
.
addProject
()
def
createInstance
(
self
,
project
):
instance_tree
=
self
.
portal
.
instance_tree_module
\
.
template_instance_tree
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance_tree
.
edit
(
follow_up_value
=
project
)
instance_tree
.
validate
()
instance_tree
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
...
...
@@ -629,7 +637,8 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
instance_tree
.
getTitle
(),
state
=
'started'
state
=
'started'
,
project_reference
=
project
)
instance_tree
.
requestStart
(
**
request_kw
)
instance_tree
.
requestInstance
(
**
request_kw
)
...
...
@@ -655,7 +664,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
REQUEST
=
{})
def
test_tryToGarbageCollect_invalidated_instance
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance
.
invalidate
()
self
.
tic
()
...
...
@@ -665,7 +674,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'start_requested'
,
instance_tree
.
getSlapState
())
def
test_tryToGarbageCollect_destroyed_instance
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
instance
,
'destroy_requested'
)
self
.
tic
()
...
...
@@ -675,7 +684,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'start_requested'
,
instance_tree
.
getSlapState
())
def
test_tryToGarbageCollect_allocated_instance
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -686,7 +695,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'start_requested'
,
instance_tree
.
getSlapState
())
def
test_tryToGarbageCollect_no_allocation_try_found
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
self
.
tic
()
instance
.
SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree
()
...
...
@@ -695,7 +704,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'start_requested'
,
instance_tree
.
getSlapState
())
def
test_tryToGarbageCollect_recent_allocation_try_found
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
self
.
tic
()
instance
.
workflow_history
[
'edit_workflow'
].
append
({
'comment'
:
'Allocation failed: no free Compute Partition'
,
...
...
@@ -713,7 +722,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
def
test_tryToGarbageCollect_recent_allocation_try_found_allocation_disallowed
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
self
.
tic
()
instance
.
workflow_history
[
'edit_workflow'
].
append
({
'comment'
:
'Allocation failed: Allocation disallowed'
,
...
...
@@ -730,7 +739,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'start_requested'
,
instance_tree
.
getSlapState
())
def
test_tryToGarbageCollect_complex_tree
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance_tree
=
instance
.
getSpecialiseValue
()
request_kw
=
dict
(
software_release
=
\
...
...
@@ -758,7 +767,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'start_requested'
,
instance_tree
.
getSlapState
())
def
test_tryToGarbageCollect_complex_tree_allocation_disallowed
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance_tree
=
instance
.
getSpecialiseValue
()
request_kw
=
dict
(
software_release
=
\
...
...
@@ -786,7 +795,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
'start_requested'
,
instance_tree
.
getSlapState
())
def
test_tryToGarbageCollect_old_allocation_try_found
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance_tree
=
instance
.
getSpecialiseValue
()
self
.
tic
()
instance
.
workflow_history
[
'edit_workflow'
].
append
({
...
...
@@ -804,7 +813,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
def
test_tryToGarbageCollect_old_allocation_try_found_allocation_disallowed
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance_tree
=
instance
.
getSpecialiseValue
()
self
.
tic
()
instance
.
workflow_history
[
'edit_workflow'
].
append
({
...
...
@@ -829,7 +838,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
)
def
test_alarm_invalidated
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
instance
.
invalidate
()
self
.
_test_alarm_not_visited
(
self
.
portal
.
portal_alarms
.
slapos_garbage_collect_non_allocated_root_tree
,
...
...
@@ -838,7 +847,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
)
def
test_alarm_allocated
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
_test_alarm_not_visited
(
...
...
@@ -850,9 +859,16 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
class
TestSlapOSGarbageCollectUnlinkedInstanceAlarm
(
SlapOSTestCaseMixin
):
def
createInstance
(
self
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
project
=
self
.
addProject
()
def
createInstance
(
self
,
project
):
instance_tree
=
self
.
portal
.
instance_tree_module
\
.
template_instance_tree
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance_tree
.
edit
(
follow_up_value
=
project
)
instance_tree
.
validate
()
instance_tree
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
...
...
@@ -866,7 +882,8 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
instance_tree
.
getTitle
(),
state
=
'started'
state
=
'started'
,
project_reference
=
project
.
getReference
()
)
instance_tree
.
requestStart
(
**
request_kw
)
instance_tree
.
requestInstance
(
**
request_kw
)
...
...
@@ -906,7 +923,7 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
return
sub_instance
def
test_SoftwareInstance_tryToGarbageUnlinkedInstance
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -922,7 +939,7 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
instance0
.
getSlapState
(),
'destroy_requested'
)
def
test_SoftwareInstance_tryToGarbageUnlinkedInstance_hosting_destroyed
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -942,7 +959,7 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
instance0
.
getSlapState
(),
'start_requested'
)
def
test_SoftwareInstance_tryToGarbageUnlinkedInstance_will_unlink_children
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -962,7 +979,7 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
instance_instance0
.
getSuccessorRelatedTitle
(),
None
)
def
test_SoftwareInstance_tryToGarbageUnlinkedInstance_will_delay
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -991,7 +1008,7 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
instance_instance0
.
getSuccessorRelatedTitle
(),
None
)
def
test_SoftwareInstance_tryToGarbageUnlinkedInstance_unlinked_root
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -1011,7 +1028,7 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
instance
.
getSlapState
(),
'start_requested'
)
def
test_SoftwareInstance_tryToGarbageUnlinkedInstance_not_unlinked
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -1027,7 +1044,7 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
self
.
assertEqual
(
instance_instance0
.
getSlapState
(),
'start_requested'
)
def
test_alarm_search_inlinked_instance
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -1049,7 +1066,7 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
)
def
test_alarm_search_inlinked_instance_slave
(
self
):
instance
=
self
.
createInstance
()
instance
=
self
.
createInstance
(
self
.
project
)
partition
=
self
.
createComputePartition
()
instance
.
edit
(
aggregate_value
=
partition
)
self
.
tic
()
...
...
@@ -1071,6 +1088,10 @@ class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
class
TestSlapOSInvalidateDestroyedInstance
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
project
=
self
.
addProject
()
def
createSoftwareInstance
(
self
):
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
software_instance_module
.
newContent
(
...
...
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