Skip to content
Snippets Groups Projects
Commit 2a7906cf authored by Michael Lumish's avatar Michael Lumish
Browse files

Merge pull request #1643 from jcanizales/fixes-server-streaming-test

Fix false positive in server streaming test.
parents ad654aca e454f4af
No related branches found
No related tags found
No related merge requests found
......@@ -129,6 +129,7 @@
- (void)testServerStreamingRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ServerStreaming"];
NSArray *expectedSizes = @[@31415, @9, @2653, @58979];
RMTStreamingOutputCallRequest *request = [RMTStreamingOutputCallRequest message];
......@@ -144,15 +145,22 @@
RMTStreamingOutputCallResponse *response,
NSError *error){
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
RMTStreamingOutputCallResponse *expectedResponse = [RMTStreamingOutputCallResponse message];
expectedResponse.payload.type = RMTPayloadType_Compressable;
int expectedSize = [expectedSizes[index] unsignedIntegerValue];
expectedResponse.payload.body = [NSMutableData dataWithLength:expectedSize];
XCTAssertEqualObjects(response, expectedResponse);
[expectation fulfill];
index += 1;
XCTAssertTrue(done || response, @"Event handler called without an event.");
if (response) {
XCTAssertLessThan(index, 4, @"More than 4 responses received.");
RMTStreamingOutputCallResponse * expected = [RMTStreamingOutputCallResponse message];
expected.payload.type = RMTPayloadType_Compressable;
int expectedSize = [expectedSizes[index] unsignedIntegerValue];
expected.payload.body = [NSMutableData dataWithLength:expectedSize];
XCTAssertEqualObjects(response, expected);
index += 1;
}
if (done) {
XCTAssertEqual(index, 4, @"Received %i responses instead of 4.", index);
[expectation fulfill];
}
}];
[self waitForExpectationsWithTimeout:4 handler:nil];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment