From 9a171c7446a7d195bf9ce1a6aa2affe328044e16 Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Fri, 21 Oct 2016 16:26:40 -0700 Subject: [PATCH 1/3] renamed unimplemented_method -> unimplemented_service --- src/csharp/Grpc.IntegrationTesting/InteropClient.cs | 8 ++++---- .../Grpc.IntegrationTesting/InteropClientServerTest.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 7a46a55a5b8..296e003bc62 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -195,8 +195,8 @@ namespace Grpc.IntegrationTesting case "status_code_and_message": await RunStatusCodeAndMessageAsync(client); break; - case "unimplemented_method": - RunUnimplementedMethod(new UnimplementedService.UnimplementedServiceClient(channel)); + case "unimplemented_service": + RunUnimplementedService(new UnimplementedService.UnimplementedServiceClient(channel)); break; case "client_compressed_unary": RunClientCompressedUnary(client); @@ -577,9 +577,9 @@ namespace Grpc.IntegrationTesting Console.WriteLine("Passed!"); } - public static void RunUnimplementedMethod(UnimplementedService.UnimplementedServiceClient client) + public static void RunUnimplementedService(UnimplementedService.UnimplementedServiceClient client) { - Console.WriteLine("running unimplemented_method"); + Console.WriteLine("running unimplemented_service"); var e = Assert.Throws(() => client.UnimplementedCall(new Empty())); Assert.AreEqual(StatusCode.Unimplemented, e.Status.StatusCode); diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs index f907f630dab..cd807e3784b 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs @@ -146,9 +146,9 @@ namespace Grpc.IntegrationTesting } [Test] - public void UnimplementedMethod() + public void UnimplementedService() { - InteropClient.RunUnimplementedMethod(new UnimplementedService.UnimplementedServiceClient(channel)); + InteropClient.RunUnimplementedService(new UnimplementedService.UnimplementedServiceClient(channel)); } } } From b2a2647446196b9dbfffa6312c5056847c1de631 Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Fri, 21 Oct 2016 16:43:57 -0700 Subject: [PATCH 2/3] added the real unimplemented_method test to csharp interop test --- .../Grpc.IntegrationTesting/InteropClient.cs | 12 ++ .../InteropClientServerTest.cs | 6 + src/csharp/Grpc.IntegrationTesting/Test.cs | 37 +++--- .../Grpc.IntegrationTesting/TestGrpc.cs | 105 +++++++++++++++++- 4 files changed, 142 insertions(+), 18 deletions(-) diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 296e003bc62..5ba83b143ed 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -198,6 +198,9 @@ namespace Grpc.IntegrationTesting case "unimplemented_service": RunUnimplementedService(new UnimplementedService.UnimplementedServiceClient(channel)); break; + case "unimplemented_method": + RunUnimplementedMethod(client); + break; case "client_compressed_unary": RunClientCompressedUnary(client); break; @@ -586,6 +589,15 @@ namespace Grpc.IntegrationTesting Console.WriteLine("Passed!"); } + public static void RunUnimplementedMethod(TestService.TestServiceClient client) + { + Console.WriteLine("running unimplemented_method"); + var e = Assert.Throws(() => client.UnimplementedCall(new Empty())); + + Assert.AreEqual(StatusCode.Unimplemented, e.Status.StatusCode); + Console.WriteLine("Passed!"); + } + public static void RunClientCompressedUnary(TestService.TestServiceClient client) { Console.WriteLine("running client_compressed_unary"); diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs index cd807e3784b..4960a53f92d 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs @@ -150,5 +150,11 @@ namespace Grpc.IntegrationTesting { InteropClient.RunUnimplementedService(new UnimplementedService.UnimplementedServiceClient(channel)); } + + [Test] + public void UnimplementedMethod() + { + InteropClient.RunUnimplementedMethod(client); + } } } diff --git a/src/csharp/Grpc.IntegrationTesting/Test.cs b/src/csharp/Grpc.IntegrationTesting/Test.cs index 88c2b8a921f..d2fa9f8013a 100644 --- a/src/csharp/Grpc.IntegrationTesting/Test.cs +++ b/src/csharp/Grpc.IntegrationTesting/Test.cs @@ -24,25 +24,28 @@ namespace Grpc.Testing { string.Concat( "CiFzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3Rlc3QucHJvdG8SDGdycGMudGVz", "dGluZxoic3JjL3Byb3RvL2dycGMvdGVzdGluZy9lbXB0eS5wcm90bxolc3Jj", - "L3Byb3RvL2dycGMvdGVzdGluZy9tZXNzYWdlcy5wcm90bzK7BAoLVGVzdFNl", + "L3Byb3RvL2dycGMvdGVzdGluZy9tZXNzYWdlcy5wcm90bzLLBQoLVGVzdFNl", "cnZpY2USNQoJRW1wdHlDYWxsEhMuZ3JwYy50ZXN0aW5nLkVtcHR5GhMuZ3Jw", "Yy50ZXN0aW5nLkVtcHR5EkYKCVVuYXJ5Q2FsbBIbLmdycGMudGVzdGluZy5T", - "aW1wbGVSZXF1ZXN0GhwuZ3JwYy50ZXN0aW5nLlNpbXBsZVJlc3BvbnNlEmwK", - "E1N0cmVhbWluZ091dHB1dENhbGwSKC5ncnBjLnRlc3RpbmcuU3RyZWFtaW5n", - "T3V0cHV0Q2FsbFJlcXVlc3QaKS5ncnBjLnRlc3RpbmcuU3RyZWFtaW5nT3V0", - "cHV0Q2FsbFJlc3BvbnNlMAESaQoSU3RyZWFtaW5nSW5wdXRDYWxsEicuZ3Jw", - "Yy50ZXN0aW5nLlN0cmVhbWluZ0lucHV0Q2FsbFJlcXVlc3QaKC5ncnBjLnRl", - "c3RpbmcuU3RyZWFtaW5nSW5wdXRDYWxsUmVzcG9uc2UoARJpCg5GdW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KC5ncnBjLnRlc3RpbmcuU3Ry", + "ZWFtaW5nSW5wdXRDYWxsUmVzcG9uc2UoARJpCg5GdWxsRHVwbGV4Q2FsbBIo", + "LmdycGMudGVzdGluZy5TdHJlYW1pbmdPdXRwdXRDYWxsUmVxdWVzdBopLmdy", + "cGMudGVzdGluZy5TdHJlYW1pbmdPdXRwdXRDYWxsUmVzcG9uc2UoATABEmkK", + "DkhhbGZEdXBsZXhDYWxsEiguZ3JwYy50ZXN0aW5nLlN0cmVhbWluZ091dHB1", + "dENhbGxSZXF1ZXN0GikuZ3JwYy50ZXN0aW5nLlN0cmVhbWluZ091dHB1dENh", + "bGxSZXNwb25zZSgBMAESPQoRVW5pbXBsZW1lbnRlZENhbGwSEy5ncnBjLnRl", + "c3RpbmcuRW1wdHkaEy5ncnBjLnRlc3RpbmcuRW1wdHkyVQoUVW5pbXBsZW1l", + "bnRlZFNlcnZpY2USPQoRVW5pbXBsZW1lbnRlZENhbGwSEy5ncnBjLnRlc3Rp", + "bmcuRW1wdHkaEy5ncnBjLnRlc3RpbmcuRW1wdHkyiQEKEFJlY29ubmVjdFNl", + "cnZpY2USOwoFU3RhcnQSHS5ncnBjLnRlc3RpbmcuUmVjb25uZWN0UGFyYW1z", + "GhMuZ3JwYy50ZXN0aW5nLkVtcHR5EjgKBFN0b3ASEy5ncnBjLnRlc3Rpbmcu", + "RW1wdHkaGy5ncnBjLnRlc3RpbmcuUmVjb25uZWN0SW5mb2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Grpc.Testing.EmptyReflection.Descriptor, global::Grpc.Testing.MessagesReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null)); diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 61f2ed4015a..8d649bf5c52 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -71,6 +71,13 @@ namespace Grpc.Testing { __Marshaller_SimpleRequest, __Marshaller_SimpleResponse); + static readonly Method __Method_CacheableUnaryCall = new Method( + MethodType.Unary, + __ServiceName, + "CacheableUnaryCall", + __Marshaller_SimpleRequest, + __Marshaller_SimpleResponse); + static readonly Method __Method_StreamingOutputCall = new Method( MethodType.ServerStreaming, __ServiceName, @@ -99,6 +106,13 @@ namespace Grpc.Testing { __Marshaller_StreamingOutputCallRequest, __Marshaller_StreamingOutputCallResponse); + static readonly Method __Method_UnimplementedCall = new Method( + MethodType.Unary, + __ServiceName, + "UnimplementedCall", + __Marshaller_Empty, + __Marshaller_Empty); + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { @@ -124,6 +138,16 @@ namespace Grpc.Testing { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// One request followed by one response. Response has cache control + /// headers set such that a caching HTTP proxy (such as GFE) can + /// satisfy subsequent requests. + /// + public virtual global::System.Threading.Tasks.Task CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context) + { + throw new RpcException(new Status(StatusCode.Unimplemented, "")); + } + /// /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. @@ -163,6 +187,15 @@ namespace Grpc.Testing { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } + /// + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented methods. + /// + public virtual global::System.Threading.Tasks.Task UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context) + { + throw new RpcException(new Status(StatusCode.Unimplemented, "")); + } + } /// Client for TestService @@ -245,6 +278,42 @@ namespace Grpc.Testing { return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request); } /// + /// One request followed by one response. Response has cache control + /// headers set such that a caching HTTP proxy (such as GFE) can + /// satisfy subsequent requests. + /// + public virtual global::Grpc.Testing.SimpleResponse CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return CacheableUnaryCall(request, new CallOptions(headers, deadline, cancellationToken)); + } + /// + /// One request followed by one response. Response has cache control + /// headers set such that a caching HTTP proxy (such as GFE) can + /// satisfy subsequent requests. + /// + public virtual global::Grpc.Testing.SimpleResponse CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_CacheableUnaryCall, null, options, request); + } + /// + /// One request followed by one response. Response has cache control + /// headers set such that a caching HTTP proxy (such as GFE) can + /// satisfy subsequent requests. + /// + public virtual AsyncUnaryCall CacheableUnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return CacheableUnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); + } + /// + /// One request followed by one response. Response has cache control + /// headers set such that a caching HTTP proxy (such as GFE) can + /// satisfy subsequent requests. + /// + public virtual AsyncUnaryCall CacheableUnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_CacheableUnaryCall, null, options, request); + } + /// /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. /// @@ -314,6 +383,38 @@ namespace Grpc.Testing { { return CallInvoker.AsyncDuplexStreamingCall(__Method_HalfDuplexCall, null, options); } + /// + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented methods. + /// + public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return UnimplementedCall(request, new CallOptions(headers, deadline, cancellationToken)); + } + /// + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented methods. + /// + public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_UnimplementedCall, null, options, request); + } + /// + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented methods. + /// + public virtual AsyncUnaryCall UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return UnimplementedCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); + } + /// + /// The test server will not implement this method. It will be used + /// to test the behavior when clients call unimplemented methods. + /// + public virtual AsyncUnaryCall UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_UnimplementedCall, null, options, request); + } /// Creates a new instance of client from given ClientBaseConfiguration. protected override TestServiceClient NewInstance(ClientBaseConfiguration configuration) { @@ -327,10 +428,12 @@ namespace Grpc.Testing { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) + .AddMethod(__Method_CacheableUnaryCall, serviceImpl.CacheableUnaryCall) .AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall) .AddMethod(__Method_StreamingInputCall, serviceImpl.StreamingInputCall) .AddMethod(__Method_FullDuplexCall, serviceImpl.FullDuplexCall) - .AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall).Build(); + .AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall) + .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } } From b53a7f7ebdff4b21ad8c8e089fe1089ce871ce0a Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Mon, 24 Oct 2016 10:38:53 -0700 Subject: [PATCH 3/3] updated the interop spec to conform with recent name change --- doc/interop-test-descriptions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/interop-test-descriptions.md b/doc/interop-test-descriptions.md index 7c153fa3fa4..96d1f2bd752 100644 --- a/doc/interop-test-descriptions.md +++ b/doc/interop-test-descriptions.md @@ -779,21 +779,21 @@ Client asserts: ### unimplemented_method -This test verifies that calling an unimplemented RPC method returns the +This test verifies that calling an unimplemented RPC method returns the UNIMPLEMENTED status code. Server features: N/A Procedure: -* Client calls `grpc.testing.TestService/UnimplementedMethod` with an empty +* Client calls `grpc.testing.TestService/UnimplementedCall` with an empty request (defined as `grpc.testing.Empty`): ``` { } ``` - + Client asserts: * received status code is 12 (UNIMPLEMENTED)