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
51e8990f
Commit
51e8990f
authored
Jul 06, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: fixup tests for slapos_garbage_collect_destroyed_root_tree
parent
826a52f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
107 deletions
+83
-107
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
...eItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
+83
-107
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudAlarm.py
View file @
51e8990f
...
@@ -310,140 +310,116 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
...
@@ -310,140 +310,116 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
class
TestSlapOSGarbageCollectDestroyedRootTreeAlarm
(
SlapOSTestCaseMixin
):
class
TestSlapOSGarbageCollectDestroyedRootTreeAlarm
(
SlapOSTestCaseMixin
):
#################################################################
# slapos_garbage_collect_destroyed_root_tree
#################################################################
def
test_SoftwareInstance_tryToGarbageCollect_alarm_archived
(
self
):
instance_tree
=
self
.
addInstanceTree
()
software_instance
=
instance_tree
.
getSuccessorValue
()
def
afterSetUp
(
self
):
instance_tree
.
archive
()
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
self
.
_test_alarm
(
self
.
project
=
self
.
addProject
()
self
.
portal
.
portal_alarms
.
slapos_garbage_collect_destroyed_root_tree
,
self
.
_makeTree
(
self
.
project
)
software_instance
,
'SoftwareInstance_tryToGarbageCollect'
def
test_SoftwareInstance_tryToGarbageCollect
(
self
):
)
self
.
instance_tree
.
archive
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
tic
()
self
.
requested_software_instance
.
SoftwareInstance_tryToGarbageCollect
()
def
test_SoftwareInstance_tryToGarbageCollect_alarm_sharedAndArchived
(
self
):
self
.
tic
()
instance_tree
=
self
.
addInstanceTree
(
shared
=
True
)
self
.
assertEqual
(
'destroy_requested'
,
software_instance
=
instance_tree
.
getSuccessorValue
()
self
.
requested_software_instance
.
getSlapState
())
self
.
assertEqual
(
'validated'
,
self
.
requested_software_instance
.
getValidationState
())
def
test_SoftwareInstance_tryToGarbageCollect_not_destroy_requested
(
self
):
instance_tree
.
archive
()
self
.
requested_software_instance
.
SoftwareInstance_tryToGarbageCollect
()
self
.
_test_alarm
(
self
.
tic
()
self
.
portal
.
portal_alarms
.
slapos_garbage_collect_destroyed_root_tree
,
self
.
assertEqual
(
'start_requested'
,
software_instance
,
self
.
requested_software_instance
.
getSlapState
())
'SoftwareInstance_tryToGarbageCollect'
self
.
assertEqual
(
'validated'
,
)
self
.
requested_software_instance
.
getValidationState
())
def
test_SoftwareInstance_tryToGarbageCollect_not_archived
(
self
):
def
test_SoftwareInstance_tryToGarbageCollect_alarm_invalidated
(
self
):
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
instance_tree
=
self
.
addInstanceTree
()
'destroy_requested'
)
software_instance
=
instance_tree
.
getSuccessorValue
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
tic
()
self
.
requested_software_instance
.
SoftwareInstance_tryToGarbageCollect
()
instance_tree
.
archive
()
self
.
tic
()
software_instance
.
invalidate
()
self
.
assertEqual
(
'start_requested'
,
self
.
_test_alarm_not_visited
(
self
.
requested_software_instance
.
getSlapState
())
self
.
portal
.
portal_alarms
.
slapos_garbage_collect_destroyed_root_tree
,
self
.
assertEqual
(
'validated'
,
software_instance
,
self
.
requested_software_instance
.
getValidationState
())
'SoftwareInstance_tryToGarbageCollect'
)
def
test_SoftwareInstance_tryToGarbageCollect_only_instance_destroy_requested
(
self
):
def
test_SoftwareInstance_tryToGarbageCollect_alarm_notArchived
(
self
):
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
instance_tree
=
self
.
addInstanceTree
()
'destroy_requested'
)
software_instance
=
instance_tree
.
getSuccessorValue
()
self
.
tic
()
self
.
_test_alarm_not_visited
(
self
.
portal
.
portal_alarms
.
slapos_garbage_collect_destroyed_root_tree
,
software_instance
,
'SoftwareInstance_tryToGarbageCollect'
)
self
.
requested_software_instance
.
SoftwareInstance_tryToGarbageCollect
()
#################################################################
self
.
tic
()
# SoftwareInstance_tryToGarbageCollect
self
.
assertEqual
(
'start_requested'
,
#################################################################
self
.
requested_software_instance
.
getSlapState
())
def
test_SoftwareInstance_tryToGarbageCollect_script_destroyed
(
self
):
self
.
assertEqual
(
'validated'
,
instance_tree
=
self
.
addInstanceTree
()
self
.
requested_software_instance
.
getValidationState
()
)
software_instance
=
instance_tree
.
getSuccessorValue
(
)
def
test_SoftwareInstance_tryToGarbageCollect_unlinked_successor
(
self
):
instance_tree
.
archive
()
self
.
requested_software_instance
.
edit
(
successor_list
=
[])
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
instance_tree
,
self
.
instance_tree
.
archive
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
instance_tree
,
'destroy_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
'destroy_requested'
)
self
.
tic
()
self
.
assertEqual
(
'validated'
,
software_instance
.
getValidationState
())
self
.
requested_software_instance
.
SoftwareInstance_tryToGarbageCollect
()
self
.
tic
()
self
.
tic
()
software_instance
.
SoftwareInstance_tryToGarbageCollect
()
self
.
assertEqual
(
'destroy_requested'
,
self
.
assertEqual
(
'destroy_requested'
,
s
elf
.
requested_s
oftware_instance
.
getSlapState
())
software_instance
.
getSlapState
())
self
.
assertEqual
(
'validated'
,
self
.
assertEqual
(
'validated'
,
s
elf
.
requested_s
oftware_instance
.
getValidationState
())
software_instance
.
getValidationState
())
def
test_SoftwareInstance_tryToGarbageCollect_destroy_unlinked_with_child
(
self
):
def
test_SoftwareInstance_tryToGarbageCollect_script_archived
(
self
):
instance_kw
=
dict
(
software_release
=
self
.
generateNewSoftwareReleaseUrl
(),
instance_tree
=
self
.
addInstanceTree
()
software_type
=
self
.
generateNewSoftwareType
(),
software_instance
=
instance_tree
.
getSuccessorValue
()
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
'Sub Instance'
,
state
=
'started'
)
self
.
requested_software_instance
.
requestInstance
(
**
instance_kw
)
sub_instance
=
self
.
requested_software_instance
.
getSuccessorValue
()
self
.
assertNotEqual
(
sub_instance
,
None
)
self
.
requested_software_instance
.
edit
(
successor_list
=
[])
instance_tree
.
archive
()
self
.
instance_tree
.
archive
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
instance_tree
,
'destroy_requested'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
software_instance
,
'destroy_requested'
)
self
.
tic
()
self
.
requested_software_instance
.
SoftwareInstance_tryToGarbageCollect
()
self
.
tic
()
self
.
tic
()
software_instance
.
SoftwareInstance_tryToGarbageCollect
()
self
.
assertEqual
(
'
destroy
_requested'
,
self
.
assertEqual
(
'
start
_requested'
,
s
elf
.
requested_s
oftware_instance
.
getSlapState
())
software_instance
.
getSlapState
())
self
.
assertEqual
(
'validated'
,
self
.
assertEqual
(
'validated'
,
s
elf
.
requested_s
oftware_instance
.
getValidationState
())
software_instance
.
getValidationState
())
self
.
assertEqual
(
self
.
requested_software_instance
.
getSuccessorValue
(),
def
test_SoftwareInstance_tryToGarbageCollect_script_notArchived
(
self
):
None
)
instance_tree
=
self
.
addInstanceTree
()
self
.
assertEqual
(
sub_instance
.
getSlapState
(),
'start_requested'
)
software_instance
=
instance_tree
.
getSuccessorValue
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
instance_tree
,
'destroy_requested'
)
sub_instance
.
SoftwareInstance_tryToGarbageCollect
()
self
.
tic
()
self
.
tic
()
software_instance
.
SoftwareInstance_tryToGarbageCollect
()
self
.
assertEqual
(
'start_requested'
,
software_instance
.
getSlapState
())
self
.
assertEqual
(
'validated'
,
software_instance
.
getValidationState
())
self
.
assertEqual
(
sub_instance
.
getSlapState
(),
'destroy_requested'
)
def
test_SoftwareInstance_tryToGarbageCollect_script_unlinkedSuccessor
(
self
):
self
.
assertEqual
(
sub_instance
.
getValidationState
(),
'validated'
)
instance_tree
=
self
.
addInstanceTree
()
software_instance
=
instance_tree
.
getSuccessorValue
()
def
test_alarm
(
self
):
instance_tree
.
edit
(
successor_list
=
[])
self
.
instance_tree
.
archive
()
instance_tree
.
archive
()
self
.
_test_alarm
(
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
instance_tree
,
self
.
portal
.
portal_alarms
.
slapos_garbage_collect_destroyed_root_tree
,
'destroy_requested'
)
self
.
software_instance
,
'SoftwareInstance_tryToGarbageCollect'
)
def
test_alarm_invalidated
(
self
):
self
.
tic
()
self
.
instance_tree
.
archive
()
software_instance
.
SoftwareInstance_tryToGarbageCollect
()
self
.
software_instance
.
invalidate
()
self
.
_test_alarm_not_visited
(
self
.
portal
.
portal_alarms
.
slapos_garbage_collect_destroyed_root_tree
,
self
.
software_instance
,
'SoftwareInstance_tryToGarbageCollect'
)
def
test_alarm_not_archived
(
self
):
self
.
assertEqual
(
'destroy_requested'
,
self
.
_test_alarm_not_visited
(
software_instance
.
getSlapState
())
self
.
portal
.
portal_alarms
.
slapos_garbage_collect_destroyed_root_tree
,
self
.
assertEqual
(
'validated'
,
self
.
software_instance
,
software_instance
.
getValidationState
())
'SoftwareInstance_tryToGarbageCollect'
)
class
TestSlapOSUpdateComputeNodeCapacityScopeAlarm
(
SlapOSTestCaseMixin
):
class
TestSlapOSUpdateComputeNodeCapacityScopeAlarm
(
SlapOSTestCaseMixin
):
...
...
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