From 8ffaa2af7ece4a9c822211203bd28678f173dc8d Mon Sep 17 00:00:00 2001 From: Hitanshu Mehta Date: Thu, 1 Jul 2021 23:05:57 +0530 Subject: [PATCH] Minor fixes and change package name for proto file for info service --- pkg/info/info.go | 4 +- pkg/info/infopb/rpc.pb.go | 175 +++++++++++++++++++------------------ pkg/info/infopb/rpc.proto | 8 +- pkg/query/storeset.go | 2 +- pkg/query/storeset_test.go | 7 +- test/e2e/info_api_test.go | 12 +-- 6 files changed, 106 insertions(+), 102 deletions(-) diff --git a/pkg/info/info.go b/pkg/info/info.go index 2634e74940f..00437222097 100644 --- a/pkg/info/info.go +++ b/pkg/info/info.go @@ -51,7 +51,7 @@ func RegisterInfoServer(infoSrv infopb.InfoServer) func(*grpc.Server) { } } -func (srv *InfoServer) Info(ctx context.Context, req *infopb.InfoReq) (*infopb.InfoResp, error) { +func (srv *InfoServer) Info(ctx context.Context, req *infopb.InfoRequest) (*infopb.InfoResponse, error) { if srv.getStoreInfo == nil { srv.getStoreInfo = func() *infopb.StoreInfo { return nil } @@ -73,7 +73,7 @@ func (srv *InfoServer) Info(ctx context.Context, req *infopb.InfoReq) (*infopb.I srv.getMetricMetadataInfo = func() *infopb.MetricMetadataInfo { return nil } } - resp := &infopb.InfoResp{ + resp := &infopb.InfoResponse{ LabelSets: srv.getLabelSet(), ComponentType: srv.component, Store: srv.getStoreInfo(), diff --git a/pkg/info/infopb/rpc.pb.go b/pkg/info/infopb/rpc.pb.go index ff11d85973e..452ef93b22c 100644 --- a/pkg/info/infopb/rpc.pb.go +++ b/pkg/info/infopb/rpc.pb.go @@ -29,21 +29,21 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type InfoReq struct { +type InfoRequest struct { } -func (m *InfoReq) Reset() { *m = InfoReq{} } -func (m *InfoReq) String() string { return proto.CompactTextString(m) } -func (*InfoReq) ProtoMessage() {} -func (*InfoReq) Descriptor() ([]byte, []int) { +func (m *InfoRequest) Reset() { *m = InfoRequest{} } +func (m *InfoRequest) String() string { return proto.CompactTextString(m) } +func (*InfoRequest) ProtoMessage() {} +func (*InfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor_a1214ec45d2bf952, []int{0} } -func (m *InfoReq) XXX_Unmarshal(b []byte) error { +func (m *InfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *InfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *InfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_InfoReq.Marshal(b, m, deterministic) + return xxx_messageInfo_InfoRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -53,19 +53,19 @@ func (m *InfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *InfoReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_InfoReq.Merge(m, src) +func (m *InfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_InfoRequest.Merge(m, src) } -func (m *InfoReq) XXX_Size() int { +func (m *InfoRequest) XXX_Size() int { return m.Size() } -func (m *InfoReq) XXX_DiscardUnknown() { - xxx_messageInfo_InfoReq.DiscardUnknown(m) +func (m *InfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_InfoRequest.DiscardUnknown(m) } -var xxx_messageInfo_InfoReq proto.InternalMessageInfo +var xxx_messageInfo_InfoRequest proto.InternalMessageInfo -type InfoResp struct { +type InfoResponse struct { LabelSets []labelpb.ZLabelSet `protobuf:"bytes,1,rep,name=label_sets,json=labelSets,proto3" json:"label_sets"` ComponentType string `protobuf:"bytes,2,opt,name=ComponentType,proto3" json:"ComponentType,omitempty"` /// StoreInfo holds the metadata related to Store API if exposed by the component otherwise it will be null. @@ -80,18 +80,18 @@ type InfoResp struct { Exemplars *ExemplarsInfo `protobuf:"bytes,7,opt,name=exemplars,proto3" json:"exemplars,omitempty"` } -func (m *InfoResp) Reset() { *m = InfoResp{} } -func (m *InfoResp) String() string { return proto.CompactTextString(m) } -func (*InfoResp) ProtoMessage() {} -func (*InfoResp) Descriptor() ([]byte, []int) { +func (m *InfoResponse) Reset() { *m = InfoResponse{} } +func (m *InfoResponse) String() string { return proto.CompactTextString(m) } +func (*InfoResponse) ProtoMessage() {} +func (*InfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_a1214ec45d2bf952, []int{1} } -func (m *InfoResp) XXX_Unmarshal(b []byte) error { +func (m *InfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *InfoResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *InfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_InfoResp.Marshal(b, m, deterministic) + return xxx_messageInfo_InfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -101,17 +101,17 @@ func (m *InfoResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *InfoResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_InfoResp.Merge(m, src) +func (m *InfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_InfoResponse.Merge(m, src) } -func (m *InfoResp) XXX_Size() int { +func (m *InfoResponse) XXX_Size() int { return m.Size() } -func (m *InfoResp) XXX_DiscardUnknown() { - xxx_messageInfo_InfoResp.DiscardUnknown(m) +func (m *InfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_InfoResponse.DiscardUnknown(m) } -var xxx_messageInfo_InfoResp proto.InternalMessageInfo +var xxx_messageInfo_InfoResponse proto.InternalMessageInfo /// StoreInfo holds the metadata related to Store API exposed by the component. type StoreInfo struct { @@ -303,46 +303,47 @@ func (m *ExemplarsInfo) XXX_DiscardUnknown() { var xxx_messageInfo_ExemplarsInfo proto.InternalMessageInfo func init() { - proto.RegisterType((*InfoReq)(nil), "thanos.InfoReq") - proto.RegisterType((*InfoResp)(nil), "thanos.InfoResp") - proto.RegisterType((*StoreInfo)(nil), "thanos.StoreInfo") - proto.RegisterType((*RulesInfo)(nil), "thanos.RulesInfo") - proto.RegisterType((*MetricMetadataInfo)(nil), "thanos.MetricMetadataInfo") - proto.RegisterType((*TargetsInfo)(nil), "thanos.TargetsInfo") - proto.RegisterType((*ExemplarsInfo)(nil), "thanos.ExemplarsInfo") + proto.RegisterType((*InfoRequest)(nil), "thanos.info.InfoRequest") + proto.RegisterType((*InfoResponse)(nil), "thanos.info.InfoResponse") + proto.RegisterType((*StoreInfo)(nil), "thanos.info.StoreInfo") + proto.RegisterType((*RulesInfo)(nil), "thanos.info.RulesInfo") + proto.RegisterType((*MetricMetadataInfo)(nil), "thanos.info.MetricMetadataInfo") + proto.RegisterType((*TargetsInfo)(nil), "thanos.info.TargetsInfo") + proto.RegisterType((*ExemplarsInfo)(nil), "thanos.info.ExemplarsInfo") } func init() { proto.RegisterFile("info/infopb/rpc.proto", fileDescriptor_a1214ec45d2bf952) } var fileDescriptor_a1214ec45d2bf952 = []byte{ - // 418 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0xe3, 0xb6, 0x4b, 0x96, 0x57, 0x95, 0x81, 0xd9, 0xa4, 0x2c, 0x87, 0x10, 0x45, 0x93, - 0x28, 0x07, 0x1a, 0xb1, 0x49, 0xdc, 0xd9, 0xb4, 0x03, 0x12, 0xbb, 0x64, 0x3d, 0xed, 0x52, 0x39, - 0xc3, 0x2b, 0x91, 0xe2, 0xd8, 0xc4, 0x46, 0x6a, 0xbf, 0x05, 0x1f, 0xab, 0xc7, 0x1e, 0x39, 0x21, - 0x68, 0xbe, 0x08, 0xb2, 0x9d, 0x94, 0x46, 0xdc, 0xb8, 0x24, 0xcf, 0xff, 0xff, 0xff, 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x4f, 0x91, 0x7a, 0xa9, 0x27, 0x76, 0x0d, 0xfc, 0xb2, 0x83, 0xe7, 0x56, 0x36, - 0x54, 0x97, 0xc1, 0x57, 0xe0, 0xd3, 0x15, 0x65, 0xa2, 0x24, 0xb5, 0x0c, 0x3c, 0x03, 0x9c, 0x75, - 0xc0, 0x6d, 0x67, 0x18, 0xe4, 0x6f, 0x2e, 0xf9, 0x00, 0xfe, 0x7e, 0x4a, 0x7c, 0x0e, 0xc7, 0xac, - 0xa8, 0x16, 0xaa, 0x60, 0x34, 0x40, 0x31, 0x9a, 0x0e, 0x33, 0x8f, 0x15, 0xd5, 0xbc, 0x60, 0xd4, - 0x58, 0x64, 0x65, 0xad, 0x41, 0x6b, 0x91, 0x95, 0xb6, 0x92, 0x31, 0xf8, 0xfb, 0xf9, 0x93, 0x53, - 0xc0, 0xff, 0x4e, 0x96, 0x4c, 0x60, 0x7c, 0xd0, 0x72, 0x72, 0x0b, 0x93, 0x5e, 0x43, 0xff, 0xf7, - 0xf0, 0xe5, 0x3b, 0x18, 0x19, 0xfa, 0x4d, 0xfb, 0x3f, 0xe9, 0xa6, 0x6d, 0x57, 0x28, 0x7c, 0xde, - 0x17, 0xa4, 0xb8, 0xbe, 0xd8, 0xfc, 0x8e, 0x9c, 0xcd, 0x2e, 0x42, 0xdb, 0x5d, 0x84, 0x7e, 0xed, - 0x22, 0xf4, 0xbd, 0x89, 0x9c, 0x6d, 0x13, 0x39, 0x3f, 0x9a, 0xc8, 0x79, 0x70, 0xed, 0x22, 0xe7, - 0xae, 0x59, 0xc6, 0xab, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xb2, 0xd3, 0x29, 0xde, 0x02, - 0x00, 0x00, + // 437 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xed, 0x26, 0x4d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c4, 0x8f, 0xdc, 0xf1, 0xd1, 0xfa, 0x4f, 0x12, 0xac, 0x37, 0x49, 0x78, 0xbb, 0x49, 0xc2, + 0xdf, 0x9b, 0x24, 0xfc, 0xb1, 0x4d, 0x82, 0xdb, 0x6d, 0x12, 0xfc, 0xdc, 0x26, 0xc1, 0x45, 0xcf, + 0xff, 0x00, 0x8b, 0x9e, 0x9b, 0xdf, 0x37, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x9c, 0xd8, + 0x20, 0x16, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -358,7 +359,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type InfoClient interface { /// Info returns the metadata (Eg. LabelSets, Min/Max time) about all the APIs the component supports. - Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOption) (*InfoResp, error) + Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) } type infoClient struct { @@ -369,9 +370,9 @@ func NewInfoClient(cc *grpc.ClientConn) InfoClient { return &infoClient{cc} } -func (c *infoClient) Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOption) (*InfoResp, error) { - out := new(InfoResp) - err := c.cc.Invoke(ctx, "/thanos.Info/Info", in, out, opts...) +func (c *infoClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) { + out := new(InfoResponse) + err := c.cc.Invoke(ctx, "/thanos.info.Info/Info", in, out, opts...) if err != nil { return nil, err } @@ -381,14 +382,14 @@ func (c *infoClient) Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOpt // InfoServer is the server API for Info service. type InfoServer interface { /// Info returns the metadata (Eg. LabelSets, Min/Max time) about all the APIs the component supports. - Info(context.Context, *InfoReq) (*InfoResp, error) + Info(context.Context, *InfoRequest) (*InfoResponse, error) } // UnimplementedInfoServer can be embedded to have forward compatible implementations. type UnimplementedInfoServer struct { } -func (*UnimplementedInfoServer) Info(ctx context.Context, req *InfoReq) (*InfoResp, error) { +func (*UnimplementedInfoServer) Info(ctx context.Context, req *InfoRequest) (*InfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Info not implemented") } @@ -397,7 +398,7 @@ func RegisterInfoServer(s *grpc.Server, srv InfoServer) { } func _Info_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InfoReq) + in := new(InfoRequest) if err := dec(in); err != nil { return nil, err } @@ -406,16 +407,16 @@ func _Info_Info_Handler(srv interface{}, ctx context.Context, dec func(interface } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/thanos.Info/Info", + FullMethod: "/thanos.info.Info/Info", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(InfoServer).Info(ctx, req.(*InfoReq)) + return srv.(InfoServer).Info(ctx, req.(*InfoRequest)) } return interceptor(ctx, in, info, handler) } var _Info_serviceDesc = grpc.ServiceDesc{ - ServiceName: "thanos.Info", + ServiceName: "thanos.info.Info", HandlerType: (*InfoServer)(nil), Methods: []grpc.MethodDesc{ { @@ -427,7 +428,7 @@ var _Info_serviceDesc = grpc.ServiceDesc{ Metadata: "info/infopb/rpc.proto", } -func (m *InfoReq) Marshal() (dAtA []byte, err error) { +func (m *InfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -437,12 +438,12 @@ func (m *InfoReq) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InfoReq) MarshalTo(dAtA []byte) (int, error) { +func (m *InfoRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *InfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *InfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -450,7 +451,7 @@ func (m *InfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *InfoResp) Marshal() (dAtA []byte, err error) { +func (m *InfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -460,12 +461,12 @@ func (m *InfoResp) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InfoResp) MarshalTo(dAtA []byte) (int, error) { +func (m *InfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *InfoResp) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *InfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -700,7 +701,7 @@ func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *InfoReq) Size() (n int) { +func (m *InfoRequest) Size() (n int) { if m == nil { return 0 } @@ -709,7 +710,7 @@ func (m *InfoReq) Size() (n int) { return n } -func (m *InfoResp) Size() (n int) { +func (m *InfoResponse) Size() (n int) { if m == nil { return 0 } @@ -811,7 +812,7 @@ func sovRpc(x uint64) (n int) { func sozRpc(x uint64) (n int) { return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *InfoReq) Unmarshal(dAtA []byte) error { +func (m *InfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -834,10 +835,10 @@ func (m *InfoReq) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InfoReq: wiretype end group for non-group") + return fmt.Errorf("proto: InfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InfoReq: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: InfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -861,7 +862,7 @@ func (m *InfoReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *InfoResp) Unmarshal(dAtA []byte) error { +func (m *InfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -884,10 +885,10 @@ func (m *InfoResp) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InfoResp: wiretype end group for non-group") + return fmt.Errorf("proto: InfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InfoResp: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: InfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/pkg/info/infopb/rpc.proto b/pkg/info/infopb/rpc.proto index fb4648dd5bf..7d19c5c12d9 100644 --- a/pkg/info/infopb/rpc.proto +++ b/pkg/info/infopb/rpc.proto @@ -2,7 +2,7 @@ // Licensed under the Apache License 2.0. syntax = "proto3"; -package thanos; +package thanos.info; import "store/labelpb/types.proto"; import "gogoproto/gogo.proto"; @@ -23,12 +23,12 @@ option (gogoproto.goproto_sizecache_all) = false; /// Info represents the API that is responsible for gathering metadata about the all APIs supported by the component. service Info { /// Info returns the metadata (Eg. LabelSets, Min/Max time) about all the APIs the component supports. - rpc Info(InfoReq) returns (InfoResp); + rpc Info(InfoRequest) returns (InfoResponse); } -message InfoReq {} +message InfoRequest {} -message InfoResp { +message InfoResponse { repeated ZLabelSet label_sets = 1 [(gogoproto.nullable) = false]; string ComponentType = 2; diff --git a/pkg/query/storeset.go b/pkg/query/storeset.go index 14c9c28c8b6..c20a75a3111 100644 --- a/pkg/query/storeset.go +++ b/pkg/query/storeset.go @@ -667,7 +667,7 @@ func (s *StoreSet) getActiveStores(ctx context.Context, stores map[string]*store } } - info, err := st.info.Info(ctx, &infopb.InfoReq{}, grpc.WaitForReady(true)) + info, err := st.info.Info(ctx, &infopb.InfoRequest{}, grpc.WaitForReady(true)) if err != nil { if !seenAlready { // Close only if new diff --git a/pkg/query/storeset_test.go b/pkg/query/storeset_test.go index 38dc2bbe628..6662cdbea8b 100644 --- a/pkg/query/storeset_test.go +++ b/pkg/query/storeset_test.go @@ -132,10 +132,10 @@ func (s *testStores) CloseOne(addr string) { } type mockedInfo struct { - info infopb.InfoResp + info infopb.InfoResponse } -func (s *mockedInfo) Info(ctx context.Context, r *infopb.InfoReq) (*infopb.InfoResp, error) { +func (s *mockedInfo) Info(ctx context.Context, r *infopb.InfoRequest) (*infopb.InfoResponse, error) { return &s.info, nil } @@ -160,6 +160,7 @@ func startInfoSrvs(infoMetas []testInfoMeta) (*testInfoSrvs, error) { } for _, meta := range infoMetas { + meta := meta listener, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { // Close the servers @@ -170,7 +171,7 @@ func startInfoSrvs(infoMetas []testInfoMeta) (*testInfoSrvs, error) { srv := grpc.NewServer() infoSrv := &mockedInfo{ - info: infopb.InfoResp{ + info: infopb.InfoResponse{ LabelSets: meta.extlsetFn(listener.Addr().String()), Store: &meta.store, MetricMetadata: &meta.metadata, diff --git a/test/e2e/info_api_test.go b/test/e2e/info_api_test.go index 85d4f8146de..af4b6cf1f55 100644 --- a/test/e2e/info_api_test.go +++ b/test/e2e/info_api_test.go @@ -131,7 +131,10 @@ func TestInfo(t *testing.T) { err = runutil.Retry(time.Second, ctx.Done(), func() error { - resp, err := http.Get(url) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) + testutil.Ok(t, err) + + resp, err := http.DefaultClient.Do(req) testutil.Ok(t, err) body, err := ioutil.ReadAll(resp.Body) @@ -141,9 +144,8 @@ func TestInfo(t *testing.T) { Data map[string][]query.StoreStatus `json:"data"` } - if err = json.Unmarshal(body, &res); err != nil { - t.Fatalf("Error unmarshaling JSON body: %s", err) - } + err = json.Unmarshal(body, &res) + testutil.Ok(t, err) if err = assertStoreStatus(t, "sidecar", res.Data, expected); err != nil { return err @@ -162,7 +164,7 @@ func assertStoreStatus(t *testing.T, component string, res map[string][]query.St t.Helper() if len(res[component]) != len(expected[component]) { - return fmt.Errorf("Expected %d %s, got: %d", len(expected[component]), component, len(res[component])) + return fmt.Errorf("expected %d %s, got: %d", len(expected[component]), component, len(res[component])) } for i, v := range res[component] {