Add one more cancel test

pull/16190/head
Muxi Yan 6 years ago
parent fd69f74b20
commit a7c41346d8
  1. 31
      src/objective-c/tests/InteropTests.m

@ -655,6 +655,37 @@ BOOL isRemoteInteropTest(NSString *host) {
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
}
- (void)testCancelAfterFirstRequestWithV2API {
XCTAssertNotNil([[self class] host]);
__weak XCTestExpectation *completionExpectation =
[self expectationWithDescription:@"Call completed."];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = self.class.transportType;
options.PEMRootCertificates = self.class.PEMRootCertificates;
options.hostNameOverride = [[self class] hostNameOverride];
id request =
[RMTStreamingOutputCallRequest messageWithPayloadSize:@21782 requestedResponseSize:@31415];
__block GRPCStreamingProtoCall *call = [_service
fullDuplexCallWithResponseHandler:[[InteropTestsBlockCallbacks alloc]
initWithInitialMetadataCallback:nil
messageCallback:^(id message) {
XCTFail(@"Received unexpected response.");
}
closeCallback:^(NSDictionary *trailingMetadata,
NSError *error) {
XCTAssertEqual(error.code, GRPC_STATUS_CANCELLED);
[completionExpectation fulfill];
}]
callOptions:options];
[call writeMessage:request];
[call cancel];
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
}
- (void)testRPCAfterClosingOpenConnections {
XCTAssertNotNil([[self class] host]);
__weak XCTestExpectation *expectation =

Loading…
Cancel
Save