mirror of https://github.com/grpc/grpc-go.git
change health check package name
This commit is contained in:
parent
178b68e281
commit
3839435526
|
|
@ -3,7 +3,7 @@
|
||||||
// DO NOT EDIT!
|
// DO NOT EDIT!
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package grpc_health_v1alpha is a generated protocol buffer package.
|
Package grpc_health_v1 is a generated protocol buffer package.
|
||||||
|
|
||||||
It is generated from these files:
|
It is generated from these files:
|
||||||
health.proto
|
health.proto
|
||||||
|
|
@ -12,7 +12,7 @@ It has these top-level messages:
|
||||||
HealthCheckRequest
|
HealthCheckRequest
|
||||||
HealthCheckResponse
|
HealthCheckResponse
|
||||||
*/
|
*/
|
||||||
package grpc_health_v1alpha
|
package grpc_health_v1
|
||||||
|
|
||||||
import proto "github.com/golang/protobuf/proto"
|
import proto "github.com/golang/protobuf/proto"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
|
|
@ -68,7 +68,7 @@ func (*HealthCheckRequest) ProtoMessage() {}
|
||||||
func (*HealthCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
func (*HealthCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||||
|
|
||||||
type HealthCheckResponse struct {
|
type HealthCheckResponse struct {
|
||||||
Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=grpc.health.v1alpha.HealthCheckResponse_ServingStatus" json:"status,omitempty"`
|
Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} }
|
func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} }
|
||||||
|
|
@ -77,9 +77,9 @@ func (*HealthCheckResponse) ProtoMessage() {}
|
||||||
func (*HealthCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
func (*HealthCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*HealthCheckRequest)(nil), "grpc.health.v1alpha.HealthCheckRequest")
|
proto.RegisterType((*HealthCheckRequest)(nil), "grpc.health.v1.HealthCheckRequest")
|
||||||
proto.RegisterType((*HealthCheckResponse)(nil), "grpc.health.v1alpha.HealthCheckResponse")
|
proto.RegisterType((*HealthCheckResponse)(nil), "grpc.health.v1.HealthCheckResponse")
|
||||||
proto.RegisterEnum("grpc.health.v1alpha.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value)
|
proto.RegisterEnum("grpc.health.v1.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
|
@ -102,7 +102,7 @@ func NewHealthClient(cc *grpc.ClientConn) HealthClient {
|
||||||
|
|
||||||
func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
|
func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
|
||||||
out := new(HealthCheckResponse)
|
out := new(HealthCheckResponse)
|
||||||
err := grpc.Invoke(ctx, "/grpc.health.v1alpha.Health/Check", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, c.cc, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +132,7 @@ func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||||
}
|
}
|
||||||
|
|
||||||
var _Health_serviceDesc = grpc.ServiceDesc{
|
var _Health_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "grpc.health.v1alpha.Health",
|
ServiceName: "grpc.health.v1.Health",
|
||||||
HandlerType: (*HealthServer)(nil),
|
HandlerType: (*HealthServer)(nil),
|
||||||
Methods: []grpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
{
|
{
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package grpc.health.v1alpha;
|
package grpc.health.v1;
|
||||||
|
|
||||||
message HealthCheckRequest {
|
message HealthCheckRequest {
|
||||||
string service = 1;
|
string service = 1;
|
||||||
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
healthpb "google.golang.org/grpc/health/grpc_health_v1alpha"
|
healthpb "google.golang.org/grpc/health/grpc_health_v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HealthServer struct {
|
type HealthServer struct {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ import (
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
"google.golang.org/grpc/grpclog"
|
"google.golang.org/grpc/grpclog"
|
||||||
"google.golang.org/grpc/health"
|
"google.golang.org/grpc/health"
|
||||||
healthpb "google.golang.org/grpc/health/grpc_health_v1alpha"
|
healthpb "google.golang.org/grpc/health/grpc_health_v1"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"google.golang.org/grpc/peer"
|
"google.golang.org/grpc/peer"
|
||||||
testpb "google.golang.org/grpc/test/grpc_testing"
|
testpb "google.golang.org/grpc/test/grpc_testing"
|
||||||
|
|
@ -603,13 +603,13 @@ func TestHealthCheckOnSuccess(t *testing.T) {
|
||||||
func testHealthCheckOnSuccess(t *testing.T, e env) {
|
func testHealthCheckOnSuccess(t *testing.T, e env) {
|
||||||
te := newTest(t, e)
|
te := newTest(t, e)
|
||||||
hs := health.NewHealthServer()
|
hs := health.NewHealthServer()
|
||||||
hs.SetServingStatus("grpc.health.v1alpha.Health", 1)
|
hs.SetServingStatus("grpc.health.v1.Health", 1)
|
||||||
te.healthServer = hs
|
te.healthServer = hs
|
||||||
te.startServer()
|
te.startServer()
|
||||||
defer te.tearDown()
|
defer te.tearDown()
|
||||||
|
|
||||||
cc := te.clientConn()
|
cc := te.clientConn()
|
||||||
if _, err := healthCheck(1*time.Second, cc, "grpc.health.v1alpha.Health"); err != nil {
|
if _, err := healthCheck(1*time.Second, cc, "grpc.health.v1.Health"); err != nil {
|
||||||
t.Fatalf("Health/Check(_, _) = _, %v, want _, <nil>", err)
|
t.Fatalf("Health/Check(_, _) = _, %v, want _, <nil>", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -629,13 +629,13 @@ func testHealthCheckOnFailure(t *testing.T, e env) {
|
||||||
"grpc: the client connection is closing; please retry",
|
"grpc: the client connection is closing; please retry",
|
||||||
)
|
)
|
||||||
hs := health.NewHealthServer()
|
hs := health.NewHealthServer()
|
||||||
hs.SetServingStatus("grpc.health.v1alpha.HealthCheck", 1)
|
hs.SetServingStatus("grpc.health.v1.HealthCheck", 1)
|
||||||
te.healthServer = hs
|
te.healthServer = hs
|
||||||
te.startServer()
|
te.startServer()
|
||||||
defer te.tearDown()
|
defer te.tearDown()
|
||||||
|
|
||||||
cc := te.clientConn()
|
cc := te.clientConn()
|
||||||
if _, err := healthCheck(0*time.Second, cc, "grpc.health.v1alpha.Health"); err != grpc.Errorf(codes.DeadlineExceeded, "context deadline exceeded") {
|
if _, err := healthCheck(0*time.Second, cc, "grpc.health.v1.Health"); err != grpc.Errorf(codes.DeadlineExceeded, "context deadline exceeded") {
|
||||||
t.Fatalf("Health/Check(_, _) = _, %v, want _, error code %d", err, codes.DeadlineExceeded)
|
t.Fatalf("Health/Check(_, _) = _, %v, want _, error code %d", err, codes.DeadlineExceeded)
|
||||||
}
|
}
|
||||||
awaitNewConnLogOutput()
|
awaitNewConnLogOutput()
|
||||||
|
|
@ -652,7 +652,7 @@ func testHealthCheckOff(t *testing.T, e env) {
|
||||||
te := newTest(t, e)
|
te := newTest(t, e)
|
||||||
te.startServer()
|
te.startServer()
|
||||||
defer te.tearDown()
|
defer te.tearDown()
|
||||||
want := grpc.Errorf(codes.Unimplemented, "unknown service grpc.health.v1alpha.Health")
|
want := grpc.Errorf(codes.Unimplemented, "unknown service grpc.health.v1.Health")
|
||||||
if _, err := healthCheck(1*time.Second, te.clientConn(), ""); err != want {
|
if _, err := healthCheck(1*time.Second, te.clientConn(), ""); err != want {
|
||||||
t.Fatalf("Health/Check(_, _) = _, %v, want _, error %v", err, want)
|
t.Fatalf("Health/Check(_, _) = _, %v, want _, error %v", err, want)
|
||||||
}
|
}
|
||||||
|
|
@ -680,19 +680,19 @@ func testHealthCheckServingStatus(t *testing.T, e env) {
|
||||||
if out.Status != healthpb.HealthCheckResponse_SERVING {
|
if out.Status != healthpb.HealthCheckResponse_SERVING {
|
||||||
t.Fatalf("Got the serving status %v, want SERVING", out.Status)
|
t.Fatalf("Got the serving status %v, want SERVING", out.Status)
|
||||||
}
|
}
|
||||||
if _, err := healthCheck(1*time.Second, cc, "grpc.health.v1alpha.Health"); err != grpc.Errorf(codes.NotFound, "unknown service") {
|
if _, err := healthCheck(1*time.Second, cc, "grpc.health.v1.Health"); err != grpc.Errorf(codes.NotFound, "unknown service") {
|
||||||
t.Fatalf("Health/Check(_, _) = _, %v, want _, error code %d", err, codes.NotFound)
|
t.Fatalf("Health/Check(_, _) = _, %v, want _, error code %d", err, codes.NotFound)
|
||||||
}
|
}
|
||||||
hs.SetServingStatus("grpc.health.v1alpha.Health", healthpb.HealthCheckResponse_SERVING)
|
hs.SetServingStatus("grpc.health.v1.Health", healthpb.HealthCheckResponse_SERVING)
|
||||||
out, err = healthCheck(1*time.Second, cc, "grpc.health.v1alpha.Health")
|
out, err = healthCheck(1*time.Second, cc, "grpc.health.v1.Health")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Health/Check(_, _) = _, %v, want _, <nil>", err)
|
t.Fatalf("Health/Check(_, _) = _, %v, want _, <nil>", err)
|
||||||
}
|
}
|
||||||
if out.Status != healthpb.HealthCheckResponse_SERVING {
|
if out.Status != healthpb.HealthCheckResponse_SERVING {
|
||||||
t.Fatalf("Got the serving status %v, want SERVING", out.Status)
|
t.Fatalf("Got the serving status %v, want SERVING", out.Status)
|
||||||
}
|
}
|
||||||
hs.SetServingStatus("grpc.health.v1alpha.Health", healthpb.HealthCheckResponse_NOT_SERVING)
|
hs.SetServingStatus("grpc.health.v1.Health", healthpb.HealthCheckResponse_NOT_SERVING)
|
||||||
out, err = healthCheck(1*time.Second, cc, "grpc.health.v1alpha.Health")
|
out, err = healthCheck(1*time.Second, cc, "grpc.health.v1.Health")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Health/Check(_, _) = _, %v, want _, <nil>", err)
|
t.Fatalf("Health/Check(_, _) = _, %v, want _, <nil>", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue