diff --git a/FirebaseDatabase/Tests/Helpers/FTestContants.h b/FirebaseDatabase/Tests/Helpers/FTestContants.h index bc8dd8de75e..d310d0abec9 100644 --- a/FirebaseDatabase/Tests/Helpers/FTestContants.h +++ b/FirebaseDatabase/Tests/Helpers/FTestContants.h @@ -18,6 +18,6 @@ #define Firebase_FTestContants_h #define kFirebaseTestTimeout 7 -#define kFirebaseTestWaitUntilTimeout 5 +#define kFirebaseTestWaitUntilTimeout 10 #endif diff --git a/FirebaseDatabase/Tests/Integration/FEventTests.m b/FirebaseDatabase/Tests/Integration/FEventTests.m index 69da5c9479c..8d2e87477c2 100644 --- a/FirebaseDatabase/Tests/Integration/FEventTests.m +++ b/FirebaseDatabase/Tests/Integration/FEventTests.m @@ -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 { diff --git a/scripts/run_database_emulator.sh b/scripts/run_database_emulator.sh index f8d846f10a9..806bde338fd 100755 --- a/scripts/run_database_emulator.sh +++ b/scripts/run_database_emulator.sh @@ -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}"