-
Notifications
You must be signed in to change notification settings - Fork 79
Conversation
Codecov Report
@@ Coverage Diff @@
## master #215 +/- ##
=======================================
+ Coverage 71.62% 72.63% +1%
=======================================
Files 15 15
Lines 1586 1586
=======================================
+ Hits 1136 1152 +16
+ Misses 370 355 -15
+ Partials 80 79 -1
Continue to review full report at Codecov.
|
}, | ||
{ | ||
MetricDescriptor: inMDSummary, | ||
Timeseries: []*metricspb.TimeSeries{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding tests on one metric with more than one time series. That's how we found #214.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,1138 @@ | |||
// Copyright 2019 , OpenCensus Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space seems off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
return diff, i | ||
} | ||
|
||
func requireMetricDescriptorRequestEqual(t *testing.T, got, want []*monitoringpb.CreateMetricDescriptorRequest) (string, int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same.
return new(empty.Empty), nil | ||
} | ||
|
||
func requireTimeSeriesRequestEqual(t *testing.T, got, want []*monitoringpb.CreateTimeSeriesRequest) (string, int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same.
} | ||
} | ||
|
||
type fakeMetricsServer struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider reusing https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver/blob/master/equivalence_test.go#L371 and split fake server to a separate file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot reuse that because test is part of stackdriver_test package. However, I plan to consolidate test utility in internal package and then reuse it. But that would be another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense to me.
} | ||
|
||
var gotTimeSeries []*monitoringpb.CreateTimeSeriesRequest | ||
server.forEachStackdriverTimeSeries(func(sdt *monitoringpb.CreateTimeSeriesRequest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be simpler to just do gotTimeSeries := server.stackdriverTimeSeries
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
t.Errorf("Name[%s], TimeSeries[%d], Error: -got +want %s\n", tc.name, idx, diff) | ||
} | ||
|
||
var gotCreateMDRequest []*monitoringpb.CreateMetricDescriptorRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
func createConn(t *testing.T, addr string) *grpc.ClientConn { | ||
conn, err := grpc.Dial(addr, grpc.WithInsecure()) | ||
if err != nil { | ||
t.Fatalf("Failed to make a gRPC connection to the agent: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/agent/server/g
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Please add a test where:
|
Is another PR ok? I am working on other tests as listed in this comment |
Also probably in a different PR consider to use input file for the input/output to avoid a lot of the code |
This contains restructured tests using API only. The test is in stackdriver_test package.
This is not complete yet but framework is there add more test cases. I'll add more cases but would like to get a review on what is being done so far.
What is remaining?