Skip to content

Commit

Permalink
Update to a more recent rtdb emulator version (#14002)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Oct 30, 2024
1 parent 56b0475 commit 948c460
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 33 deletions.
2 changes: 1 addition & 1 deletion FirebaseDatabase/Tests/Helpers/FTestContants.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
#define Firebase_FTestContants_h

#define kFirebaseTestTimeout 7
#define kFirebaseTestWaitUntilTimeout 5
#define kFirebaseTestWaitUntilTimeout 10

#endif
55 changes: 24 additions & 31 deletions FirebaseDatabase/Tests/Integration/FEventTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -362,42 +362,35 @@ - (void)testOnceValueFiresExactlyOnce {
}

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

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

FIRDatabaseReference* path = [FTestHelpers getRandomNode];
__block BOOL firstCall = YES;

__block BOOL done = NO;

[path observeSingleEventOfType:FIRDataEventTypeChildAdded
withBlock:^(FIRDataSnapshot* snapshot) {
XCTAssertTrue(firstCall, @"Properly saw first call");
firstCall = NO;
XCTAssertEqualObjects(@42, [snapshot value], @"Properly saw node value");
XCTAssertEqualObjects(@"foo", [snapshot key],
@"Properly saw the first node");
if (![[snapshot value] isEqual:@42]) {
exit(-1);
badCount = badCount + 1;
}

done = YES;
}];

[[path child:@"foo"] setValue:@42];
[[path child:@"bar"] setValue:@84]; // XXX FIXME sometimes this event fires first
[[path child:@"foo"] setValue:@168];
[path observeSingleEventOfType:FIRDataEventTypeChildAdded
withBlock:^(FIRDataSnapshot* snapshot) {
XCTAssertTrue(firstCall, @"Properly saw first call");
firstCall = NO;
XCTAssertEqualObjects(@42, [snapshot value], @"Properly saw node value");
XCTAssertEqualObjects(@"foo", [snapshot key],
@"Properly saw the first node");
if (![[snapshot value] isEqual:@42]) {
exit(-1);
}

// [path setValue:nil withCompletionBlock:^(BOOL status) { done = YES; }];
[self waitUntil:^BOOL {
return done;
}];
done = YES;
}];

// }
[[path child:@"foo"] setValue:@42];
[[path child:@"bar"] setValue:@84]; // XXX FIXME sometimes this event fires first
[[path child:@"foo"] setValue:@168];

NSLog(@"BADCOUNT: %d", badCount);
// [path setValue:nil withCompletionBlock:^(BOOL status) { done = YES; }];
[self waitUntil:^BOOL {
return done;
}];
}
}

- (void)testOnceValueFiresExactlyOnceEvenIfThereIsASetInsideCallback {
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_database_emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

set -euo pipefail

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

Expand Down

0 comments on commit 948c460

Please sign in to comment.