Fix timeout test

pull/12339/head
Muxi Yan 8 years ago
parent 9894661712
commit 2795eae06e
  1. 12
      src/objective-c/tests/GRPCClientTests.m

@ -28,6 +28,7 @@
#import <RemoteTest/Messages.pbobjc.h> #import <RemoteTest/Messages.pbobjc.h>
#import <RxLibrary/GRXWriteable.h> #import <RxLibrary/GRXWriteable.h>
#import <RxLibrary/GRXWriter+Immediate.h> #import <RxLibrary/GRXWriter+Immediate.h>
#import <RxLibrary/GRXBufferedPipe.h>
#define TEST_TIMEOUT 16 #define TEST_TIMEOUT 16
@ -39,6 +40,7 @@ static NSString * const kRemoteSSLHost = @"grpc-test.sandbox.googleapis.com";
static GRPCProtoMethod *kInexistentMethod; static GRPCProtoMethod *kInexistentMethod;
static GRPCProtoMethod *kEmptyCallMethod; static GRPCProtoMethod *kEmptyCallMethod;
static GRPCProtoMethod *kUnaryCallMethod; static GRPCProtoMethod *kUnaryCallMethod;
static GRPCProtoMethod *kFullDuplexCallMethod;
/** Observer class for testing that responseMetadata is KVO-compliant */ /** Observer class for testing that responseMetadata is KVO-compliant */
@interface PassthroughObserver : NSObject @interface PassthroughObserver : NSObject
@ -106,6 +108,9 @@ static GRPCProtoMethod *kUnaryCallMethod;
kUnaryCallMethod = [[GRPCProtoMethod alloc] initWithPackage:kPackage kUnaryCallMethod = [[GRPCProtoMethod alloc] initWithPackage:kPackage
service:kService service:kService
method:@"UnaryCall"]; method:@"UnaryCall"];
kFullDuplexCallMethod = [[GRPCProtoMethod alloc] initWithPackage:kPackage
service:kService
method:@"FullDuplexCall"];
} }
- (void)testConnectionToRemoteServer { - (void)testConnectionToRemoteServer {
@ -423,11 +428,12 @@ static GRPCProtoMethod *kUnaryCallMethod;
} }
- (void)testTimeout { - (void)testTimeout {
__weak XCTestExpectation *completion = [self expectationWithDescription:@"Empty RPC completed."]; __weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."];
GRXBufferedPipe *pipe = [GRXBufferedPipe pipe];
GRPCCall *call = [[GRPCCall alloc] initWithHost:kHostAddress GRPCCall *call = [[GRPCCall alloc] initWithHost:kHostAddress
path:kEmptyCallMethod.HTTPPath path:kFullDuplexCallMethod.HTTPPath
requestsWriter:[GRXWriter writerWithValue:[NSData data]]]; requestsWriter:pipe];
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
XCTAssert(0, @"Failure: response received; Expect: no response received."); XCTAssert(0, @"Failure: response received; Expect: no response received.");

Loading…
Cancel
Save