@@ -27,6 +27,7 @@ import (
27
27
"github.com/golang/protobuf/ptypes/empty"
28
28
"google.golang.org/api/option"
29
29
"google.golang.org/protobuf/encoding/prototext"
30
+ "google.golang.org/protobuf/proto"
30
31
"google.golang.org/protobuf/testing/protocmp"
31
32
32
33
googlemetricpb "google.golang.org/genproto/googleapis/api/metric"
@@ -286,12 +287,12 @@ func TestExportMaxTSPerRequest(t *testing.T) {
286
287
v := fmt .Sprintf ("value_%d" , i )
287
288
lv := & metricspb.LabelValue {Value : v , HasValue : true }
288
289
289
- ts := * tcFromFile .inMetric [0 ].Timeseries [0 ]
290
+ ts := proto . Clone ( tcFromFile .inMetric [0 ].Timeseries [0 ]).( * metricspb. TimeSeries )
290
291
ts .LabelValues = []* metricspb.LabelValue {inEmptyValue , lv }
291
- tcFromFile .inMetric [0 ].Timeseries = append (tcFromFile .inMetric [0 ].Timeseries , & ts )
292
+ tcFromFile .inMetric [0 ].Timeseries = append (tcFromFile .inMetric [0 ].Timeseries , ts )
292
293
293
294
j := i / 200
294
- outTS := * (tcFromFile .outTSR [0 ].TimeSeries [0 ])
295
+ outTS := proto . Clone (tcFromFile .outTSR [0 ].TimeSeries [0 ]).( * monitoringpb. TimeSeries )
295
296
outTS .Metric = & googlemetricpb.Metric {
296
297
Type : tcFromFile .outMDR [0 ].MetricDescriptor .Type ,
297
298
Labels : map [string ]string {
@@ -305,7 +306,7 @@ func TestExportMaxTSPerRequest(t *testing.T) {
305
306
}
306
307
tcFromFile .outTSR = append (tcFromFile .outTSR , newOutTSR )
307
308
}
308
- tcFromFile .outTSR [j ].TimeSeries = append (tcFromFile .outTSR [j ].TimeSeries , & outTS )
309
+ tcFromFile .outTSR [j ].TimeSeries = append (tcFromFile .outTSR [j ].TimeSeries , outTS )
309
310
}
310
311
executeTestCase (t , tcFromFile , se , server , nil )
311
312
}
@@ -326,10 +327,10 @@ func TestExportMaxTSPerRequestAcrossTwoMetrics(t *testing.T) {
326
327
for k := 0 ; k < 2 ; k ++ {
327
328
for i := 1 ; i < 250 ; i ++ {
328
329
v := fmt .Sprintf ("value_%d" , i + k * 250 )
329
- ts := * tcFromFile .inMetric [k ].Timeseries [0 ]
330
+ ts := proto . Clone ( tcFromFile .inMetric [k ].Timeseries [0 ]).( * metricspb. TimeSeries )
330
331
lv := & metricspb.LabelValue {Value : v , HasValue : true }
331
332
ts .LabelValues = []* metricspb.LabelValue {inEmptyValue , lv }
332
- tcFromFile .inMetric [k ].Timeseries = append (tcFromFile .inMetric [k ].Timeseries , & ts )
333
+ tcFromFile .inMetric [k ].Timeseries = append (tcFromFile .inMetric [k ].Timeseries , ts )
333
334
}
334
335
}
335
336
@@ -350,7 +351,7 @@ func TestExportMaxTSPerRequestAcrossTwoMetrics(t *testing.T) {
350
351
351
352
// pick metric-1 for first 250 time-series and metric-2 for next 250 time-series.
352
353
mt := tcFromFile .outMDR [k ].MetricDescriptor .Type
353
- outTS := * (tcFromFile .outTSR [0 ].TimeSeries [0 ])
354
+ outTS := proto . Clone (tcFromFile .outTSR [0 ].TimeSeries [0 ]).( * monitoringpb. TimeSeries )
354
355
outTS .Metric = & googlemetricpb.Metric {
355
356
Type : mt ,
356
357
Labels : map [string ]string {
@@ -364,7 +365,7 @@ func TestExportMaxTSPerRequestAcrossTwoMetrics(t *testing.T) {
364
365
}
365
366
tcFromFile .outTSR = append (tcFromFile .outTSR , newOutTSR )
366
367
}
367
- tcFromFile .outTSR [j ].TimeSeries = append (tcFromFile .outTSR [j ].TimeSeries , & outTS )
368
+ tcFromFile .outTSR [j ].TimeSeries = append (tcFromFile .outTSR [j ].TimeSeries , outTS )
368
369
}
369
370
}
370
371
executeTestCase (t , tcFromFile , se , server , nil )
0 commit comments