Skip to content

Commit 948c460

Browse files
authored
Update to a more recent rtdb emulator version (#14002)
1 parent 56b0475 commit 948c460

File tree

3 files changed

+26
-33
lines changed

3 files changed

+26
-33
lines changed

FirebaseDatabase/Tests/Helpers/FTestContants.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
#define Firebase_FTestContants_h
1919

2020
#define kFirebaseTestTimeout 7
21-
#define kFirebaseTestWaitUntilTimeout 5
21+
#define kFirebaseTestWaitUntilTimeout 10
2222

2323
#endif

FirebaseDatabase/Tests/Integration/FEventTests.m

+24-31
Original file line numberDiff line numberDiff line change
@@ -362,42 +362,35 @@ - (void)testOnceValueFiresExactlyOnce {
362362
}
363363

364364
- (void)testOnceChildAddedFiresExactlyOnce {
365-
__block int badCount = 0;
365+
for (int i = 0; i < 100; i++) {
366+
FIRDatabaseReference* path = [FTestHelpers getRandomNode];
367+
__block BOOL firstCall = YES;
366368

367-
// for(int i = 0; i < 100; i++) {
369+
__block BOOL done = NO;
368370

369-
FIRDatabaseReference* path = [FTestHelpers getRandomNode];
370-
__block BOOL firstCall = YES;
371-
372-
__block BOOL done = NO;
373-
374-
[path observeSingleEventOfType:FIRDataEventTypeChildAdded
375-
withBlock:^(FIRDataSnapshot* snapshot) {
376-
XCTAssertTrue(firstCall, @"Properly saw first call");
377-
firstCall = NO;
378-
XCTAssertEqualObjects(@42, [snapshot value], @"Properly saw node value");
379-
XCTAssertEqualObjects(@"foo", [snapshot key],
380-
@"Properly saw the first node");
381-
if (![[snapshot value] isEqual:@42]) {
382-
exit(-1);
383-
badCount = badCount + 1;
384-
}
385-
386-
done = YES;
387-
}];
388-
389-
[[path child:@"foo"] setValue:@42];
390-
[[path child:@"bar"] setValue:@84]; // XXX FIXME sometimes this event fires first
391-
[[path child:@"foo"] setValue:@168];
371+
[path observeSingleEventOfType:FIRDataEventTypeChildAdded
372+
withBlock:^(FIRDataSnapshot* snapshot) {
373+
XCTAssertTrue(firstCall, @"Properly saw first call");
374+
firstCall = NO;
375+
XCTAssertEqualObjects(@42, [snapshot value], @"Properly saw node value");
376+
XCTAssertEqualObjects(@"foo", [snapshot key],
377+
@"Properly saw the first node");
378+
if (![[snapshot value] isEqual:@42]) {
379+
exit(-1);
380+
}
392381

393-
// [path setValue:nil withCompletionBlock:^(BOOL status) { done = YES; }];
394-
[self waitUntil:^BOOL {
395-
return done;
396-
}];
382+
done = YES;
383+
}];
397384

398-
// }
385+
[[path child:@"foo"] setValue:@42];
386+
[[path child:@"bar"] setValue:@84]; // XXX FIXME sometimes this event fires first
387+
[[path child:@"foo"] setValue:@168];
399388

400-
NSLog(@"BADCOUNT: %d", badCount);
389+
// [path setValue:nil withCompletionBlock:^(BOOL status) { done = YES; }];
390+
[self waitUntil:^BOOL {
391+
return done;
392+
}];
393+
}
401394
}
402395

403396
- (void)testOnceValueFiresExactlyOnceEvenIfThereIsASetInsideCallback {

scripts/run_database_emulator.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
set -euo pipefail
2222

23-
VERSION='4.7.2'
23+
VERSION='4.12.0'
2424
FILENAME="firebase-database-emulator-v${VERSION}.jar"
2525
URL="https://storage.googleapis.com/firebase-preview-drop/emulator/${FILENAME}"
2626

0 commit comments

Comments
 (0)