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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
267e5195
Commit
267e5195
authored
Nov 27, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: More tests for ComputePartition_checkAllocatedSlaState
parent
f3002bee
Pipeline
#38291
failed with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
4 deletions
+34
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputePartition_checkAllocatedSlaState.py
...crm_monitoring/ComputePartition_checkAllocatedSlaState.py
+6
-2
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputePartition_checkAllocatedSupplyState.py
..._monitoring/ComputePartition_checkAllocatedSupplyState.py
+5
-1
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMMonitoringAlarm.py
...rtal_components/test.erp5.testSlapOSCRMMonitoringAlarm.py
+23
-1
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputePartition_checkAllocatedSlaState.py
View file @
267e5195
compute_partition
=
context
compute_partition
=
context
sla_error_list
=
[]
compute_node
=
compute_partition
.
getParentValue
()
compute_node
=
compute_partition
.
getParentValue
()
assert
compute_node
.
getPortalType
()
==
'Compute Node'
assert
compute_node
.
getPortalType
()
==
'Compute Node'
instance
=
compute_partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
instance
=
compute_partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
assert
instance
is
not
None
,
'Instance is None'
assert
instance
is
not
None
,
'Instance is None'
assert
instance
.
getValidationState
()
!=
'validated'
,
'Instance is invalid'
if
instance
.
getValidationState
()
!=
'validated'
or
\
instance
.
getSlapState
()
==
'destroy_requested'
:
# Outdated catalog or instance under garbage collection,
# we skip for now.
return
sla_error_list
sla_error_list
=
[]
sla_dict
=
instance
.
getSlaXmlAsDict
()
sla_dict
=
instance
.
getSlaXmlAsDict
()
if
not
sla_dict
:
if
not
sla_dict
:
return
sla_error_list
return
sla_error_list
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputePartition_checkAllocatedSupplyState.py
View file @
267e5195
...
@@ -5,7 +5,11 @@ assert compute_node.getPortalType() == 'Compute Node'
...
@@ -5,7 +5,11 @@ assert compute_node.getPortalType() == 'Compute Node'
instance
=
compute_partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
instance
=
compute_partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
assert
instance
is
not
None
,
'Instance is None'
assert
instance
is
not
None
,
'Instance is None'
assert
instance
.
getValidationState
()
!=
'validated'
,
'Instance is invalid'
if
instance
.
getValidationState
()
!=
'validated'
or
\
instance
.
getSlapState
()
==
'destroy_requested'
:
# Outdated catalog or instance under garbage collection,
# we skip for now.
return
project
=
instance
.
getFollowUpValue
()
project
=
instance
.
getFollowUpValue
()
assert
project
is
not
None
,
'Project is None'
assert
project
is
not
None
,
'Project is None'
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMMonitoringAlarm.py
View file @
267e5195
...
@@ -98,7 +98,29 @@ class TestSlapOSCrmCheckProjectAllocationConsistencyState(TestSlapOSCrmMonitorin
...
@@ -98,7 +98,29 @@ class TestSlapOSCrmCheckProjectAllocationConsistencyState(TestSlapOSCrmMonitorin
self
.
_test_alarm_not_visited
(
alarm
,
self
.
compute_node
,
self
.
_test_alarm_not_visited
(
alarm
,
self
.
compute_node
,
"ComputeNode_checkProjectAllocationConsistencyState"
)
"ComputeNode_checkProjectAllocationConsistencyState"
)
################################################################################
def
test_ComputeNode_checkProjectAllocationConsistencyState_alarm_2_node_1_call
(
self
):
project
=
self
.
addProject
()
self
.
_makeComputeNode
(
project
)
compute_node_a
=
self
.
compute_node
compute_node_a
.
edit
(
monitor_scope
=
'enabled'
)
self
.
_makeComputeNode
(
project
)
compute_node_b
=
self
.
compute_node
compute_node_b
.
edit
(
monitor_scope
=
'enabled'
)
self
.
assertNotEqual
(
compute_node_a
.
getUid
(),
compute_node_b
.
getUid
())
self
.
tic
()
alarm
=
self
.
portal
.
portal_alarms
.
slapos_crm_project_allocation_consistency
script_name
=
"ComputeNode_checkProjectAllocationConsistencyState"
with
TemporaryAlarmScript
(
self
.
portal
,
script_name
,
attribute
=
None
):
alarm
.
activeSense
()
self
.
tic
()
content_a
=
compute_node_a
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
content_b
=
compute_node_b
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
# The alarm should group by project, so only one out of many should reached.
self
.
assertNotEqual
(
content_a
,
content_b
)
self
.
assertIn
(
'Visited by %s'
%
script_name
,
[
content_a
,
content_b
])
class
TestSlapOSCrmMonitoringCheckComputeNodeProjectState
(
TestSlapOSCrmMonitoringMixin
):
class
TestSlapOSCrmMonitoringCheckComputeNodeProjectState
(
TestSlapOSCrmMonitoringMixin
):
launch_caucase
=
1
launch_caucase
=
1
...
...
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