Skip to content

Commit 9a5afbf

Browse files
authored
Remove flaky retain count checking (#3065)
* Remove flaky retain count checking * Disable test
1 parent 346f4ed commit 9a5afbf

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

Example/InstanceID/Tests/FIRInstanceIDKeyPairMigrationTest.m

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ - (void)testMigrationIfLegacyKeyPairsExist {
139139
[self waitForExpectationsWithTimeout:1 handler:nil];
140140
}
141141

142+
// Disabling test for now. We need to find a flake free way to insure the publicKeyRef is retained.
143+
#ifdef DISABLED
142144
- (void)testUpdateKeyRefWithTagRetainsAndReleasesKeyRef {
143145
SecKeyRef publicKeyRef;
144146

@@ -154,31 +156,16 @@ - (void)testUpdateKeyRefWithTagRetainsAndReleasesKeyRef {
154156

155157
publicKeyRef = keyPair.publicKey;
156158

157-
// Retain to keep publicKeyRef alive to verify its reatin count
158-
CFRetain(publicKeyRef);
159-
160-
// 2 = 1 from keyPair + 1 from CFRetain()
161-
XCTAssertEqual(CFGetRetainCount(publicKeyRef), 2);
162-
163-
XCTestExpectation *completionExpectaion =
164-
[self expectationWithDescription:@"completionExpectaion"];
159+
XCTestExpectation *completionExpectation =
160+
[self expectationWithDescription:@"completionExpectation"];
165161
[self.keyPairStore updateKeyRef:keyPair.publicKey
166162
withTag:@"test"
167163
handler:^(NSError *error) {
168-
[completionExpectaion fulfill];
164+
[completionExpectation fulfill];
169165
}];
170-
171-
// 3 = from keyPair + 1 from CFRetain() + 1 retained by `updateKeyRef`
172-
XCTAssertEqual(CFGetRetainCount(publicKeyRef), 3);
173166
}
174-
175-
// 2 = 1 from CFRetain() + 1 retained by `updateKeyRef`
176-
XCTAssertEqual(CFGetRetainCount(publicKeyRef), 2);
177-
178167
[self waitForExpectationsWithTimeout:0.5 handler:NULL];
179-
180-
// No one else owns publicKeyRef except the test
181-
XCTAssertEqual(CFGetRetainCount(publicKeyRef), 1);
182168
}
169+
#endif
183170

184171
@end

0 commit comments

Comments
 (0)