@@ -171,3 +171,36 @@ def test_view_data_to_metric(self):
171171 ]
172172 for args in args_list :
173173 self .do_test_view_data_to_metric (* args )
174+
175+ def test_convert_view_without_labels (self ):
176+ mock_measure = mock .Mock (spec = measure .MeasureFloat )
177+ mock_aggregation = mock .Mock (spec = aggregation .DistributionAggregation )
178+ mock_aggregation .aggregation_type = aggregation .Type .DISTRIBUTION
179+
180+ vd = mock .Mock (spec = view_data .ViewData )
181+ vd .view = view .View (
182+ name = mock .Mock (),
183+ description = mock .Mock (),
184+ columns = [],
185+ measure = mock_measure ,
186+ aggregation = mock_aggregation )
187+ vd .start_time = '2019-04-11T22:33:44.555555Z'
188+
189+ mock_point = mock .Mock (spec = point .Point )
190+ mock_point .value = mock .Mock (spec = value .ValueDistribution )
191+
192+ mock_agg = mock .Mock (spec = aggregation_data .SumAggregationDataFloat )
193+ mock_agg .to_point .return_value = mock_point
194+
195+ vd .tag_value_aggregation_data_map = {tuple (): mock_agg }
196+
197+ current_time = '2019-04-11T22:33:55.666666Z'
198+ metric = metric_utils .view_data_to_metric (vd , current_time )
199+
200+ self .assertEqual (metric .descriptor .label_keys , [])
201+ self .assertEqual (len (metric .time_series ), 1 )
202+ [ts ] = metric .time_series
203+ self .assertEqual (ts .label_values , [])
204+ self .assertEqual (len (ts .points ), 1 )
205+ [pt ] = ts .points
206+ self .assertEqual (pt , mock_point )
0 commit comments