Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Crashlytics/Crashlytics/Models/FIRCLSSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,15 @@ - (NSDictionary *)loadCacheKey {

- (void)deleteCachedSettings {
__weak FIRCLSSettings *weakSelf = self;
#ifndef FIREBASE_IS_NIGHTLY_TESTING
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
#endif
__strong FIRCLSSettings *strongSelf = weakSelf;
if ([strongSelf.fileManager fileExistsAtPath:strongSelf.fileManager.settingsFilePath]) {
[strongSelf.fileManager removeItemAtPath:strongSelf.fileManager.settingsFilePath];
}
if ([strongSelf.fileManager fileExistsAtPath:strongSelf.fileManager.settingsCacheKeyPath]) {
[strongSelf.fileManager removeItemAtPath:strongSelf.fileManager.settingsCacheKeyPath];
}
#ifndef FIREBASE_IS_NIGHTLY_TESTING
});
#endif

@synchronized(self) {
self.isCacheKeyExpired = YES;
Expand Down
16 changes: 15 additions & 1 deletion Crashlytics/UnitTests/FIRCLSSettingsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

- (void)setUp {
[super setUp];

[self drainBackgroundQueue];
_fileManager = [[FIRCLSMockFileManager alloc] init];

_appIDModel = [[FABMockApplicationIdentifierModel alloc] init];
Expand Down Expand Up @@ -134,7 +134,11 @@

[self.settings cacheSettingsWithGoogleAppID:googleAppID currentTimestamp:currentTimestamp];

if (expectedRemoveCount) {
[self drainBackgroundQueue];
}

[self waitForExpectations:@[ self.fileManager.removeExpectation ] timeout:1];

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, tvOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, visionOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, visionOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-26, Xcode_26.1, iOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, iOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".

Check failure on line 141 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testCorruptCache, Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.cache".
}

- (void)reloadFromCacheWithGoogleAppID:(NSString *)googleAppID
Expand All @@ -147,9 +151,19 @@

[self.settings reloadFromCacheWithGoogleAppID:googleAppID currentTimestamp:currentTimestamp];

if (expectedRemoveCount) {
[self drainBackgroundQueue];
}

[self waitForExpectations:@[ self.fileManager.removeExpectation ] timeout:5.0];

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

testActivatedSettingsMissingCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, tvOS)

testGoogleAppIDChanged, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, tvOS)

testCorruptCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, tvOS)

testActivatedSettingsMissingCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, visionOS)

testGoogleAppIDChanged, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, visionOS)

testCorruptCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, visionOS)

testActivatedSettingsMissingCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-26, Xcode_26.1, iOS)

testCorruptCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-26, Xcode_26.1, iOS)

testActivatedSettingsMissingCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, iOS)

testActivatedSettingsMissingCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testActivatedSettingsMissingCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testCorruptCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".

Check failure on line 158 in Crashlytics/UnitTests/FIRCLSSettingsTests.m

View workflow job for this annotation

GitHub Actions / spm / spm (macos-14, Xcode_16.2, iOS)

testActivatedSettingsMissingCacheKey, Asynchronous wait failed: Exceeded timeout of 5 seconds, with unfulfilled expectations: "FIRCLSMockFileManager.removeExpectation.reload".
}

- (void)drainBackgroundQueue {
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
// This queue is used by `- [FIRCLSSettings deleteCachedSettings]`.
});
}

- (void)testActivatedSettingsCached {
NSError *error = nil;
[self writeSettings:FIRCLSTestSettingsActivated error:&error];
Expand Down
Loading