Add comments and no longer export helper func
This commit is contained in:
@ -465,7 +465,7 @@ var (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
func ValidateMetadata(header, trailer metadata.MD) {
|
func validateMetadata(header, trailer metadata.MD) {
|
||||||
if len(header[initialMetadataKey]) != 1 {
|
if len(header[initialMetadataKey]) != 1 {
|
||||||
grpclog.Fatalf("Expected exactly one header from server. Received %d", len(header[initialMetadataKey]))
|
grpclog.Fatalf("Expected exactly one header from server. Received %d", len(header[initialMetadataKey]))
|
||||||
}
|
}
|
||||||
@ -505,7 +505,7 @@ func DoCustomMetadata(tc testpb.TestServiceClient) {
|
|||||||
if t != testpb.PayloadType_COMPRESSABLE || s != 1 {
|
if t != testpb.PayloadType_COMPRESSABLE || s != 1 {
|
||||||
grpclog.Fatalf("Got the reply with type %d len %d; want %d, %d", t, s, testpb.PayloadType_COMPRESSABLE, 1)
|
grpclog.Fatalf("Got the reply with type %d len %d; want %d, %d", t, s, testpb.PayloadType_COMPRESSABLE, 1)
|
||||||
}
|
}
|
||||||
ValidateMetadata(header, trailer)
|
validateMetadata(header, trailer)
|
||||||
|
|
||||||
// Testing with FullDuplex
|
// Testing with FullDuplex
|
||||||
stream, err := tc.FullDuplexCall(ctx)
|
stream, err := tc.FullDuplexCall(ctx)
|
||||||
@ -539,7 +539,7 @@ func DoCustomMetadata(tc testpb.TestServiceClient) {
|
|||||||
grpclog.Fatalf("%v failed to complete the custom metadata test: %v", stream, err)
|
grpclog.Fatalf("%v failed to complete the custom metadata test: %v", stream, err)
|
||||||
}
|
}
|
||||||
streamTrailer := stream.Trailer()
|
streamTrailer := stream.Trailer()
|
||||||
ValidateMetadata(streamHeader, streamTrailer)
|
validateMetadata(streamHeader, streamTrailer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DoStatusCodeAndMessage checks that the status code is propagated back to the client.
|
// DoStatusCodeAndMessage checks that the status code is propagated back to the client.
|
||||||
@ -577,6 +577,7 @@ func DoStatusCodeAndMessage(tc testpb.TestServiceClient) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DoUnimplementedService attempts to call a method from an unimplemented service.
|
||||||
func DoUnimplementedService(tc testpb.UnimplementedServiceClient) {
|
func DoUnimplementedService(tc testpb.UnimplementedServiceClient) {
|
||||||
var code int32 = 12
|
var code int32 = 12
|
||||||
expectedCode := codes.Code(code)
|
expectedCode := codes.Code(code)
|
||||||
@ -586,6 +587,7 @@ func DoUnimplementedService(tc testpb.UnimplementedServiceClient) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DoUnimplementedMethod attempts to call an unimplemented method.
|
||||||
func DoUnimplementedMethod(serverAddr string) {
|
func DoUnimplementedMethod(serverAddr string) {
|
||||||
cc, err := grpc.Dial(serverAddr, grpc.WithInsecure(), grpc.WithBlock())
|
cc, err := grpc.Dial(serverAddr, grpc.WithInsecure(), grpc.WithBlock())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user