Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1278)

Unified Diff: common/tsmon/monitor/acq_test.go

Issue 1857643003: Revert of Migrate tsmon protos to proto3 (Closed) Base URL: git@github.com:luci/luci-go.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/tsmon/monitor/acq.go ('k') | common/tsmon/store/inmemory_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/tsmon/monitor/acq_test.go
diff --git a/common/tsmon/monitor/acq_test.go b/common/tsmon/monitor/acq_test.go
index bcbc4cd55c373e2ad7960e7243388d856dc0f03b..9267d15bc1b8290b44b020f54ad2a393b5eb46a8 100644
--- a/common/tsmon/monitor/acq_test.go
+++ b/common/tsmon/monitor/acq_test.go
@@ -10,6 +10,7 @@
"testing"
"time"
+ "github.com/golang/protobuf/proto"
"github.com/luci/luci-go/common/tsmon/distribution"
"github.com/luci/luci-go/common/tsmon/field"
"github.com/luci/luci-go/common/tsmon/target"
@@ -59,10 +60,10 @@
dpb := serializeDistribution(d)
So(*dpb, ShouldResemble, pb.PrecomputedDistribution{
- SpecType: pb.PrecomputedDistribution_CUSTOM_PARAMETERIZED,
- Width: 10,
- GrowthFactor: 0,
- NumBuckets: 20,
+ SpecType: pb.PrecomputedDistribution_CUSTOM_PARAMETERIZED.Enum(),
+ Width: proto.Float64(10),
+ GrowthFactor: proto.Float64(0),
+ NumBuckets: proto.Int32(20),
})
})
@@ -71,7 +72,7 @@
dpb := serializeDistribution(d)
So(*dpb, ShouldResemble, pb.PrecomputedDistribution{
- SpecType: pb.PrecomputedDistribution_CANONICAL_POWERS_OF_2,
+ SpecType: pb.PrecomputedDistribution_CANONICAL_POWERS_OF_2.Enum(),
})
})
@@ -80,7 +81,7 @@
dpb := serializeDistribution(d)
So(*dpb, ShouldResemble, pb.PrecomputedDistribution{
- SpecType: pb.PrecomputedDistribution_CANONICAL_POWERS_OF_10_P_0_2,
+ SpecType: pb.PrecomputedDistribution_CANONICAL_POWERS_OF_10_P_0_2.Enum(),
})
})
@@ -89,7 +90,7 @@
dpb := serializeDistribution(d)
So(*dpb, ShouldResemble, pb.PrecomputedDistribution{
- SpecType: pb.PrecomputedDistribution_CANONICAL_POWERS_OF_10,
+ SpecType: pb.PrecomputedDistribution_CANONICAL_POWERS_OF_10.Enum(),
})
})
@@ -98,10 +99,10 @@
dpb := serializeDistribution(d)
So(*dpb, ShouldResemble, pb.PrecomputedDistribution{
- SpecType: pb.PrecomputedDistribution_CUSTOM_PARAMETERIZED,
- Width: 0,
- GrowthFactor: 4,
- NumBuckets: 20,
+ SpecType: pb.PrecomputedDistribution_CUSTOM_PARAMETERIZED.Enum(),
+ Width: proto.Float64(0),
+ GrowthFactor: proto.Float64(4),
+ NumBuckets: proto.Int32(20),
})
})
@@ -114,15 +115,15 @@
dpb := serializeDistribution(d)
So(*dpb, ShouldResemble, pb.PrecomputedDistribution{
- SpecType: pb.PrecomputedDistribution_CUSTOM_PARAMETERIZED,
- Width: 10,
- GrowthFactor: 0,
- NumBuckets: 2,
+ SpecType: pb.PrecomputedDistribution_CUSTOM_PARAMETERIZED.Enum(),
+ Width: proto.Float64(10),
+ GrowthFactor: proto.Float64(0),
+ NumBuckets: proto.Int32(2),
Bucket: []int64{3},
- Underflow: 0,
- Overflow: 1,
- Mean: 5.75,
+ Underflow: proto.Int64(0),
+ Overflow: proto.Int64(1),
+ Mean: proto.Float64(5.75),
})
})
}
@@ -144,13 +145,13 @@
},
})
So(ret, ShouldResemble, &pb.MetricsData{
- Name: "foo",
- Description: "bar",
- MetricNamePrefix: "/chrome/infra/",
- Fields: []*pb.MetricsField{},
- StartTimestampUs: 946782245000000,
- Task: &pb.Task{},
- Gauge: 42,
+ Name: proto.String("foo"),
+ Description: proto.String("bar"),
+ MetricNamePrefix: proto.String("/chrome/infra/"),
+ Fields: []*pb.MetricsField{},
+ StartTimestampUs: proto.Uint64(946782245000000),
+ Task: &pb.Task{},
+ Gauge: proto.Int64(42),
})
})
@@ -170,13 +171,13 @@
},
})
So(ret, ShouldResemble, &pb.MetricsData{
- Name: "foo",
- Description: "bar",
- MetricNamePrefix: "/chrome/infra/",
- Fields: []*pb.MetricsField{},
- StartTimestampUs: 946782245000000,
- Task: &pb.Task{},
- Counter: 42,
+ Name: proto.String("foo"),
+ Description: proto.String("bar"),
+ MetricNamePrefix: proto.String("/chrome/infra/"),
+ Fields: []*pb.MetricsField{},
+ StartTimestampUs: proto.Uint64(946782245000000),
+ Task: &pb.Task{},
+ Counter: proto.Int64(42),
})
})
@@ -196,13 +197,13 @@
},
})
So(ret, ShouldResemble, &pb.MetricsData{
- Name: "foo",
- Description: "bar",
- MetricNamePrefix: "/chrome/infra/",
- Fields: []*pb.MetricsField{},
- StartTimestampUs: 946782245000000,
- Task: &pb.Task{},
- NoncumulativeDoubleValue: 42,
+ Name: proto.String("foo"),
+ Description: proto.String("bar"),
+ MetricNamePrefix: proto.String("/chrome/infra/"),
+ Fields: []*pb.MetricsField{},
+ StartTimestampUs: proto.Uint64(946782245000000),
+ Task: &pb.Task{},
+ NoncumulativeDoubleValue: proto.Float64(42),
})
})
@@ -222,13 +223,13 @@
},
})
So(ret, ShouldResemble, &pb.MetricsData{
- Name: "foo",
- Description: "bar",
- MetricNamePrefix: "/chrome/infra/",
- Fields: []*pb.MetricsField{},
- StartTimestampUs: 946782245000000,
- Task: &pb.Task{},
- CumulativeDoubleValue: 42,
+ Name: proto.String("foo"),
+ Description: proto.String("bar"),
+ MetricNamePrefix: proto.String("/chrome/infra/"),
+ Fields: []*pb.MetricsField{},
+ StartTimestampUs: proto.Uint64(946782245000000),
+ Task: &pb.Task{},
+ CumulativeDoubleValue: proto.Float64(42),
})
})
@@ -248,13 +249,13 @@
},
})
So(ret, ShouldResemble, &pb.MetricsData{
- Name: "foo",
- Description: "bar",
- MetricNamePrefix: "/chrome/infra/",
- Fields: []*pb.MetricsField{},
- StartTimestampUs: 946782245000000,
- Task: &pb.Task{},
- StringValue: "hello",
+ Name: proto.String("foo"),
+ Description: proto.String("bar"),
+ MetricNamePrefix: proto.String("/chrome/infra/"),
+ Fields: []*pb.MetricsField{},
+ StartTimestampUs: proto.Uint64(946782245000000),
+ Task: &pb.Task{},
+ StringValue: proto.String("hello"),
})
})
@@ -274,20 +275,20 @@
},
})
So(ret, ShouldResemble, &pb.MetricsData{
- Name: "foo",
- Description: "bar",
- MetricNamePrefix: "/chrome/infra/",
- Fields: []*pb.MetricsField{},
- StartTimestampUs: 946782245000000,
- Task: &pb.Task{},
- BooleanValue: true,
+ Name: proto.String("foo"),
+ Description: proto.String("bar"),
+ MetricNamePrefix: proto.String("/chrome/infra/"),
+ Fields: []*pb.MetricsField{},
+ StartTimestampUs: proto.Uint64(946782245000000),
+ Task: &pb.Task{},
+ BooleanValue: proto.Bool(true),
})
})
Convey("NonDefaultTarget", t, func() {
target := target.Task{
- ServiceName: "hello",
- JobName: "world",
+ ServiceName: proto.String("hello"),
+ JobName: proto.String("world"),
}
ret := SerializeCell(types.Cell{
@@ -305,16 +306,16 @@
},
})
So(ret, ShouldResemble, &pb.MetricsData{
- Name: "foo",
- Description: "bar",
- MetricNamePrefix: "/chrome/infra/",
- Fields: []*pb.MetricsField{},
- StartTimestampUs: 946782245000000,
+ Name: proto.String("foo"),
+ Description: proto.String("bar"),
+ MetricNamePrefix: proto.String("/chrome/infra/"),
+ Fields: []*pb.MetricsField{},
+ StartTimestampUs: proto.Uint64(946782245000000),
Task: &pb.Task{
- ServiceName: "hello",
- JobName: "world",
- },
- Gauge: 42,
+ ServiceName: proto.String("hello"),
+ JobName: proto.String("world"),
+ },
+ Gauge: proto.Int64(42),
})
})
}
« no previous file with comments | « common/tsmon/monitor/acq.go ('k') | common/tsmon/store/inmemory_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698