@@ -41,6 +41,8 @@ def test_dashboard_by_ID(self):
4141 self .assertEqual (dashboard .widgets [0 ].size , 12 )
4242 self .assertEqual (dashboard .widgets [0 ].unit , "%" )
4343 self .assertEqual (dashboard .widgets [0 ].y_label , "cpu_usage" )
44+ self .assertEqual (dashboard .widgets [0 ].group_by , ["entity_id" ])
45+ self .assertIsNone (dashboard .widgets [0 ].filters )
4446
4547 def test_dashboard_by_service_type (self ):
4648 dashboards = self .client .monitor .dashboards (service_type = "dbaas" )
@@ -62,6 +64,21 @@ def test_dashboard_by_service_type(self):
6264 self .assertEqual (dashboards [0 ].widgets [0 ].size , 12 )
6365 self .assertEqual (dashboards [0 ].widgets [0 ].unit , "%" )
6466 self .assertEqual (dashboards [0 ].widgets [0 ].y_label , "cpu_usage" )
67+ self .assertEqual (dashboards [0 ].widgets [0 ].group_by , ["entity_id" ])
68+ self .assertIsNone (dashboards [0 ].widgets [0 ].filters )
69+
70+ # Test the second widget which has filters
71+ self .assertEqual (dashboards [0 ].widgets [1 ].label , "Memory Usage" )
72+ self .assertEqual (dashboards [0 ].widgets [1 ].group_by , ["entity_id" ])
73+ self .assertIsNotNone (dashboards [0 ].widgets [1 ].filters )
74+ self .assertEqual (len (dashboards [0 ].widgets [1 ].filters ), 1 )
75+ self .assertEqual (
76+ dashboards [0 ].widgets [1 ].filters [0 ].dimension_label , "pattern"
77+ )
78+ self .assertEqual (dashboards [0 ].widgets [1 ].filters [0 ].operator , "in" )
79+ self .assertEqual (
80+ dashboards [0 ].widgets [1 ].filters [0 ].value , "publicout,privateout"
81+ )
6582
6683 def test_get_all_dashboards (self ):
6784 dashboards = self .client .monitor .dashboards ()
@@ -83,20 +100,28 @@ def test_get_all_dashboards(self):
83100 self .assertEqual (dashboards [0 ].widgets [0 ].size , 12 )
84101 self .assertEqual (dashboards [0 ].widgets [0 ].unit , "%" )
85102 self .assertEqual (dashboards [0 ].widgets [0 ].y_label , "cpu_usage" )
103+ self .assertEqual (dashboards [0 ].widgets [0 ].group_by , ["entity_id" ])
104+ self .assertIsNone (dashboards [0 ].widgets [0 ].filters )
86105
87106 def test_specific_service_details (self ):
88107 data = self .client .load (MonitorService , "dbaas" )
89108 self .assertEqual (data .label , "Databases" )
90109 self .assertEqual (data .service_type , "dbaas" )
91110
111+ # Test alert configuration
112+ self .assertIsNotNone (data .alert )
113+ self .assertEqual (data .alert .polling_interval_seconds , [300 ])
114+ self .assertEqual (data .alert .evaluation_period_seconds , [300 ])
115+ self .assertEqual (data .alert .scope , ["entity" ])
116+
92117 def test_metric_definitions (self ):
93118
94119 metrics = self .client .monitor .metric_definitions (service_type = "dbaas" )
95120 self .assertEqual (
96121 metrics [0 ].available_aggregate_functions ,
97122 ["max" , "avg" , "min" , "sum" ],
98123 )
99- self .assertEqual (metrics [0 ].is_alertable , True )
124+ self .assertTrue (metrics [0 ].is_alertable )
100125 self .assertEqual (metrics [0 ].label , "CPU Usage" )
101126 self .assertEqual (metrics [0 ].metric , "cpu_usage" )
102127 self .assertEqual (metrics [0 ].metric_type , "gauge" )
0 commit comments