-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework sync config initialization #7857
Changes from 8 commits
efe75b8
464231d
960115a
1a0f70e
1d520f4
be9bcae
9fad9d4
02dce57
9e204e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -953,7 +953,7 @@ - (void)testFlexibleSyncInitialSubscriptionAwait { | |
CHECK_COUNT(11, Person, realm); | ||
[ex fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for extending the timeout times in most of the server tests and the app creation?, isn't this enhancement supposed to make opening the realm faster There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests have been failing pretty consistently with timeouts due to the server being slow. All of the timeouts I bumped were ones which failed at least occasionally when using Xcode's "run tests repeatably until failure". |
||
} | ||
|
||
- (void)testFlexibleSyncInitialSubscriptionDoNotRerunOnOpen { | ||
|
@@ -1007,7 +1007,7 @@ - (void)testFlexibleSyncInitialSubscriptionRerunOnOpen { | |
CHECK_COUNT(11, Person, realm); | ||
[ex fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
XCTAssertEqual(openCount, 1); | ||
|
||
__block RLMRealm *realm; | ||
|
@@ -1021,7 +1021,7 @@ - (void)testFlexibleSyncInitialSubscriptionRerunOnOpen { | |
CHECK_COUNT(16, Person, realm); | ||
[ex2 fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
XCTAssertEqual(openCount, 2); | ||
|
||
[self dispatchAsyncAndWait:^{ | ||
|
@@ -1072,7 +1072,7 @@ - (void)testFlexibleSyncInitialOnConnectionTimeout { | |
XCTAssertNil(realm); | ||
[ex fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
|
||
[proxy stop]; | ||
} | ||
|
@@ -1095,6 +1095,6 @@ - (void)testFlexibleSyncInitialSubscriptionThrowsError { | |
|
||
[ex fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
} | ||
@end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ - (void)testLogoutSpecificUser { | |
[expectation fulfill]; | ||
}]; | ||
|
||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
} | ||
|
||
- (void)testSwitchUser { | ||
|
@@ -205,14 +205,14 @@ - (void)testDeviceRegistration { | |
XCTAssertNil(error); | ||
[expectation fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
|
||
expectation = [self expectationWithDescription:@"should deregister device"]; | ||
[client deregisterDeviceForUser:self.app.currentUser completion:^(NSError *error) { | ||
XCTAssertNil(error); | ||
[expectation fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
} | ||
|
||
// FIXME: Reenable once possible underlying race condition is understood | ||
|
@@ -576,7 +576,7 @@ - (void)testSyncErrorHandlerErrorDomain { | |
encryptionKey:nil | ||
stopPolicy:RLMSyncStopPolicyAfterChangesUploaded]; | ||
|
||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
} | ||
|
||
#pragma mark - User Profile | ||
|
@@ -1432,7 +1432,7 @@ - (void)testClientReset { | |
[ex fulfill]; | ||
}; | ||
[user simulateClientResetErrorForSession:@"realm_id"]; | ||
[self waitForExpectationsWithTimeout:10 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30 handler:nil]; | ||
XCTAssertNotNil(theError); | ||
XCTAssertTrue(theError.code == RLMSyncErrorClientResetError); | ||
NSString *pathValue = [theError rlmSync_clientResetBackedUpRealmPath]; | ||
|
@@ -1457,7 +1457,7 @@ - (void)testClientResetManualInitiation { | |
[ex fulfill]; | ||
}; | ||
[user simulateClientResetErrorForSession:partitionValue]; | ||
[self waitForExpectationsWithTimeout:10 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30 handler:nil]; | ||
XCTAssertNotNil(theError); | ||
} | ||
// At this point the Realm should be invalidated and client reset should be possible. | ||
|
@@ -1550,7 +1550,7 @@ - (void)testStreamingDownloadNotifier { | |
}]; | ||
// Wait for the child process to upload everything. | ||
RLMRunChildAndWait(); | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
[token invalidate]; | ||
// The notifier should have been called at least twice: once at the beginning and at least once | ||
// to report progress. | ||
|
@@ -1592,7 +1592,7 @@ - (void)testStreamingUploadNotifier { | |
} | ||
[realm commitWriteTransaction]; | ||
// Wait for upload to begin and finish | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
[token invalidate]; | ||
// The notifier should have been called at least twice: once at the beginning and at least once | ||
// to report progress. | ||
|
@@ -1633,7 +1633,7 @@ - (void)testDownloadRealm { | |
return 0; | ||
}; | ||
XCTAssertNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String)); | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
XCTAssertGreaterThan(fileSize(c.pathOnDisk), 0U); | ||
XCTAssertNil(RLMGetAnyCachedRealmForPath(c.pathOnDisk.UTF8String)); | ||
} | ||
|
@@ -1799,7 +1799,7 @@ - (void)testAsyncOpenConnectionTimeout { | |
XCTAssertNil(realm); | ||
[ex fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
|
||
// Delay below the timeout should work | ||
proxy.delay = 0.5; | ||
|
@@ -1812,7 +1812,7 @@ - (void)testAsyncOpenConnectionTimeout { | |
XCTAssertNil(error); | ||
[ex fulfill]; | ||
}]; | ||
[self waitForExpectationsWithTimeout:10.0 handler:nil]; | ||
[self waitForExpectationsWithTimeout:30.0 handler:nil]; | ||
|
||
[proxy stop]; | ||
} | ||
|
@@ -2624,6 +2624,13 @@ - (void)testWatchWithMatchFilterAsync { | |
|
||
- (NSArray<RLMObjectId *> *)insertDogDocuments:(RLMMongoCollection *)collection { | ||
__block NSArray<RLMObjectId *> *objectIds; | ||
XCTestExpectation *ex = [self expectationWithDescription:@"delete existing documents"]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't we cleaning all documents on every tearDown, why duplicating it here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, we don't delete anything on tearDown. The sync tests use a separate partition for each test so that they don't see each others data, but these tests are accessing the collection directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does deleting all documents before inserting obscure what this function is intended for? Should the calling function just call something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We never want to call them separately, but I guess the name should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, lets change the name to avoid confusion in the future |
||
[collection deleteManyDocumentsWhere:@{} completion:^(NSInteger, NSError *error) { | ||
XCTAssertNil(error); | ||
[ex fulfill]; | ||
}]; | ||
[self waitForExpectations:@[ex] timeout:60.0]; | ||
|
||
XCTestExpectation *insertManyExpectation = [self expectationWithDescription:@"should insert documents"]; | ||
[collection insertManyDocuments:@[ | ||
@{@"name": @"fido", @"breed": @"cane corso"}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this enhancement coming from a user issue, could be valuable to tag this here?