-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Crashlytics] Fix flaky tests #15551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
09d61fb
c6c90ad
18d6d48
21e20ad
3e59f61
8c1c5bb
7a6d04f
240a561
dbba8ce
b3be77b
d86bcf9
db32311
7783cf6
9f5ffeb
cae9e43
17fdac8
6f16835
33a701d
91aa4ad
3883034
32d465b
62556dc
9f25a5f
581dcf4
9dee833
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,27 +127,33 @@ | |
| - (void)cacheSettingsWithGoogleAppID:(NSString *)googleAppID | ||
| currentTimestamp:(NSTimeInterval)currentTimestamp | ||
| expectedRemoveCount:(NSInteger)expectedRemoveCount { | ||
| self.fileManager.removeExpectation = [[XCTestExpectation alloc] | ||
| initWithDescription:@"FIRCLSMockFileManager.removeExpectation.cache"]; | ||
| self.fileManager.removeCount = 0; | ||
| self.fileManager.expectedRemoveCount = expectedRemoveCount; | ||
|
|
||
| XCTestExpectation *expectation = | ||
| [self expectationForNotification:FIRCLSMockFileManagerDidRemoveItemNotification | ||
| object:nil | ||
| handler:nil]; | ||
| expectation.expectedFulfillmentCount = expectedRemoveCount; | ||
|
|
||
| [self.settings cacheSettingsWithGoogleAppID:googleAppID currentTimestamp:currentTimestamp]; | ||
|
|
||
| [self waitForExpectations:@[ self.fileManager.removeExpectation ] timeout:1]; | ||
| [self waitForExpectations:@[ expectation ] timeout:5.0]; | ||
|
Check failure on line 140 in Crashlytics/UnitTests/FIRCLSSettingsTests.m
|
||
| } | ||
|
|
||
| - (void)reloadFromCacheWithGoogleAppID:(NSString *)googleAppID | ||
| currentTimestamp:(NSTimeInterval)currentTimestamp | ||
| expectedRemoveCount:(NSInteger)expectedRemoveCount { | ||
| self.fileManager.removeExpectation = [[XCTestExpectation alloc] | ||
| initWithDescription:@"FIRCLSMockFileManager.removeExpectation.reload"]; | ||
| self.fileManager.removeCount = 0; | ||
| self.fileManager.expectedRemoveCount = expectedRemoveCount; | ||
|
|
||
| XCTestExpectation *expectation = | ||
| [self expectationForNotification:FIRCLSMockFileManagerDidRemoveItemNotification | ||
| object:nil | ||
| handler:nil]; | ||
| expectation.expectedFulfillmentCount = expectedRemoveCount; | ||
|
|
||
| [self.settings reloadFromCacheWithGoogleAppID:googleAppID currentTimestamp:currentTimestamp]; | ||
|
|
||
| [self waitForExpectations:@[ self.fileManager.removeExpectation ] timeout:5.0]; | ||
| [self waitForExpectations:@[ expectation ] timeout:10.0]; | ||
|
Check failure on line 156 in Crashlytics/UnitTests/FIRCLSSettingsTests.m
|
||
| } | ||
|
|
||
| - (void)testActivatedSettingsCached { | ||
|
|
@@ -205,10 +211,6 @@ | |
| [self writeSettings:FIRCLSTestSettingsActivated error:&error]; | ||
| XCTAssertNil(error, "%@", error); | ||
|
|
||
| // 1 delete for clearing the cache key, plus 2 for the deletes from reloading and clearing the | ||
| // cache and cache key | ||
| self.fileManager.expectedRemoveCount = 3; | ||
|
|
||
| NSTimeInterval currentTimestamp = [NSDate timeIntervalSinceReferenceDate]; | ||
| [self.settings cacheSettingsWithGoogleAppID:TestGoogleAppID currentTimestamp:currentTimestamp]; | ||
|
|
||
|
|
@@ -238,10 +240,6 @@ | |
| [self writeSettings:FIRCLSTestSettingsActivated error:&error]; | ||
| XCTAssertNil(error, "%@", error); | ||
|
|
||
| // 1 delete for clearing the cache key, plus 2 for the deletes from reloading and clearing the | ||
| // cache and cache key | ||
| self.fileManager.expectedRemoveCount = 3; | ||
|
|
||
| NSTimeInterval currentTimestamp = [NSDate timeIntervalSinceReferenceDate]; | ||
| [self.settings cacheSettingsWithGoogleAppID:TestGoogleAppID currentTimestamp:currentTimestamp]; | ||
|
|
||
|
|
@@ -272,10 +270,6 @@ | |
| [self writeSettings:FIRCLSTestSettingsActivated error:&error]; | ||
| XCTAssertNil(error, "%@", error); | ||
|
|
||
| // 1 delete for clearing the cache key, plus 2 for the deletes from reloading and clearing the | ||
| // cache and cache key | ||
| self.fileManager.expectedRemoveCount = 3; | ||
|
|
||
| NSTimeInterval currentTimestamp = [NSDate timeIntervalSinceReferenceDate]; | ||
| [self.settings cacheSettingsWithGoogleAppID:TestGoogleAppID currentTimestamp:currentTimestamp]; | ||
|
|
||
|
|
@@ -387,7 +381,7 @@ | |
| // Cache them, and reload. Since it's corrupted we should delete it all | ||
| [self cacheSettingsWithGoogleAppID:TestGoogleAppID | ||
| currentTimestamp:currentTimestamp | ||
| expectedRemoveCount:2]; | ||
| expectedRemoveCount:3]; | ||
|
||
|
|
||
| // Should have default values because we deleted the cache and settingsDictionary | ||
| XCTAssertEqual(self.settings.isCacheExpired, YES); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.