Skip to content

Commit f0a6472

Browse files
authored
[Infra] Attempt to fix some Crashlytics flakes (#13432)
1 parent a403ca3 commit f0a6472

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Crashlytics/UnitTests/FIRCLSReportManagerTests.m

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#import "FBLPromises.h"
2424
#endif
2525

26+
#import "FBLPromise+Testing.h"
27+
2628
#include "Crashlytics/Crashlytics/Components/FIRCLSContext.h"
2729
#include "Crashlytics/Crashlytics/Components/FIRCLSCrashedMarkerFile.h"
2830
#import "Crashlytics/Crashlytics/Controllers/FIRCLSAnalyticsManager.h"
@@ -201,17 +203,10 @@ - (NSArray *)uploadReportArray {
201203
#pragma mark - File/Directory Handling
202204
- (void)testCreatesNewReportOnStart {
203205
FBLPromise<NSNumber *> *promise = [self->_reportManager startWithProfiling];
206+
FBLWaitForPromisesWithTimeout(1.0);
204207

205-
XCTestExpectation *expectation =
206-
[[XCTestExpectation alloc] initWithDescription:@"waiting on promise"];
207-
[promise then:^id _Nullable(NSNumber *_Nullable value) {
208-
XCTAssertTrue([value boolValue]);
209-
XCTAssertEqual([[self contentsOfActivePath] count], 1);
210-
[expectation fulfill];
211-
return value;
212-
}];
213-
214-
[self waitForExpectations:@[ expectation ] timeout:1.0];
208+
XCTAssertTrue([promise.value boolValue]);
209+
XCTAssertEqual([[self contentsOfActivePath] count], 1);
215210
}
216211

217212
- (void)waitForPromise:(FBLPromise<NSNumber *> *)promise {
@@ -314,10 +309,11 @@ - (void)testMetricKitResolvesPromiseIfNoDiagnostics {
314309

315310
- (void)testExistingUnimportantReportOnStartWithDataCollectionDisabled {
316311
// create a report and put it in place
317-
[self createActiveReport];
312+
XCTAssertNotNil([self createActiveReport]);
318313

319314
// Starting with data collection disabled should report in nothing changing
320315
[self startReportManagerWithDataCollectionEnabled:NO];
316+
FBLWaitForPromisesWithTimeout(1.0);
321317

322318
XCTAssertEqual([[self contentsOfActivePath] count], 1);
323319

0 commit comments

Comments
 (0)