From 9601b46ffa10b68ea54453ac5cdf62bcf19f834f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 7 Jun 2019 15:10:49 -0700 Subject: [PATCH] Resolving testResponsesOver4MBAreAcceptedIfOptedIn delayed callback --- src/objective-c/tests/InteropTests/InteropTests.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index 7d4aee0bc90..4bdacbe4fa8 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -18,6 +18,8 @@ #import "InteropTests.h" +#import + #include #ifdef GRPC_COMPILE_WITH_CRONET @@ -701,21 +703,21 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager XCTAssertNotNil([[self class] host]); __weak XCTestExpectation *expectation = [self expectationWithDescription:@"HigherResponseSizeLimit"]; + __block NSError *callError = nil; RMTSimpleRequest *request = [RMTSimpleRequest message]; const size_t kPayloadSize = 5 * 1024 * 1024; // 5MB request.responseSize = kPayloadSize; [GRPCCall setResponseSizeLimit:6 * 1024 * 1024 forHost:[[self class] host]]; - [_service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) { - XCTAssertNil(error, @"Finished with unexpected error: %@", error); - XCTAssertEqual(response.payload.body.length, kPayloadSize); + callError = error; [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil]; + XCTAssertNil(callError, @"Finished with unexpected error: %@", callError); } - (void)testClientStreamingRPC {