@@ -27,6 +27,7 @@ import (
2727 "github.com/golang/protobuf/ptypes/empty"
2828 "google.golang.org/api/option"
2929 "google.golang.org/protobuf/encoding/prototext"
30+ "google.golang.org/protobuf/proto"
3031 "google.golang.org/protobuf/testing/protocmp"
3132
3233 googlemetricpb "google.golang.org/genproto/googleapis/api/metric"
@@ -286,12 +287,12 @@ func TestExportMaxTSPerRequest(t *testing.T) {
286287 v := fmt .Sprintf ("value_%d" , i )
287288 lv := & metricspb.LabelValue {Value : v , HasValue : true }
288289
289- ts := * tcFromFile .inMetric [0 ].Timeseries [0 ]
290+ ts := proto . Clone ( tcFromFile .inMetric [0 ].Timeseries [0 ]).( * metricspb. TimeSeries )
290291 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 )
292293
293294 j := i / 200
294- outTS := * (tcFromFile .outTSR [0 ].TimeSeries [0 ])
295+ outTS := proto . Clone (tcFromFile .outTSR [0 ].TimeSeries [0 ]).( * monitoringpb. TimeSeries )
295296 outTS .Metric = & googlemetricpb.Metric {
296297 Type : tcFromFile .outMDR [0 ].MetricDescriptor .Type ,
297298 Labels : map [string ]string {
@@ -305,7 +306,7 @@ func TestExportMaxTSPerRequest(t *testing.T) {
305306 }
306307 tcFromFile .outTSR = append (tcFromFile .outTSR , newOutTSR )
307308 }
308- tcFromFile .outTSR [j ].TimeSeries = append (tcFromFile .outTSR [j ].TimeSeries , & outTS )
309+ tcFromFile .outTSR [j ].TimeSeries = append (tcFromFile .outTSR [j ].TimeSeries , outTS )
309310 }
310311 executeTestCase (t , tcFromFile , se , server , nil )
311312}
@@ -326,10 +327,10 @@ func TestExportMaxTSPerRequestAcrossTwoMetrics(t *testing.T) {
326327 for k := 0 ; k < 2 ; k ++ {
327328 for i := 1 ; i < 250 ; i ++ {
328329 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 )
330331 lv := & metricspb.LabelValue {Value : v , HasValue : true }
331332 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 )
333334 }
334335 }
335336
@@ -350,7 +351,7 @@ func TestExportMaxTSPerRequestAcrossTwoMetrics(t *testing.T) {
350351
351352 // pick metric-1 for first 250 time-series and metric-2 for next 250 time-series.
352353 mt := tcFromFile .outMDR [k ].MetricDescriptor .Type
353- outTS := * (tcFromFile .outTSR [0 ].TimeSeries [0 ])
354+ outTS := proto . Clone (tcFromFile .outTSR [0 ].TimeSeries [0 ]).( * monitoringpb. TimeSeries )
354355 outTS .Metric = & googlemetricpb.Metric {
355356 Type : mt ,
356357 Labels : map [string ]string {
@@ -364,7 +365,7 @@ func TestExportMaxTSPerRequestAcrossTwoMetrics(t *testing.T) {
364365 }
365366 tcFromFile .outTSR = append (tcFromFile .outTSR , newOutTSR )
366367 }
367- tcFromFile .outTSR [j ].TimeSeries = append (tcFromFile .outTSR [j ].TimeSeries , & outTS )
368+ tcFromFile .outTSR [j ].TimeSeries = append (tcFromFile .outTSR [j ].TimeSeries , outTS )
368369 }
369370 }
370371 executeTestCase (t , tcFromFile , se , server , nil )
0 commit comments