Skip to content

Commit 4fe2314

Browse files
committed
Avoid tsan issue in the paging test.
1 parent 1cae05f commit 4fe2314

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

UnitTests/GTLRServiceTest.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,12 @@ - (void)testService_SingleQuery_Paging {
835835
service.fetcherService.testBlock = ^(GTMSessionFetcher *fetcherToTest,
836836
GTMSessionFetcherTestResponse testResponse) {
837837
checkRequestParamsAndHeaders(fetcherToTest.request);
838-
XCTAssertEqual(queryTicket.pagesFetchedCounter, (NSUInteger)pageCounter);
838+
// There's a chance the test block will get calls at the same time as the query is being
839+
// started, so there could a a race for access to `queryTicket`, so skip inspecing it
840+
// for the first page.
841+
if (pageCounter != 0) {
842+
XCTAssertEqual(queryTicket.pagesFetchedCounter, (NSUInteger)pageCounter);
843+
}
839844

840845
++pageCounter;
841846

0 commit comments

Comments
 (0)