-
Notifications
You must be signed in to change notification settings - Fork 168
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
Begin decoupling sync tests from App #7351
Conversation
5dc6089
to
d5713a4
Compare
d5713a4
to
8560b50
Compare
Pull Request Test Coverage Report for Build thomas.goyne_179Details
💛 - Coveralls |
8560b50
to
15eb07c
Compare
Co-authored-by: James Stone <[email protected]>
15eb07c
to
280ce60
Compare
@@ -22,7 +22,7 @@ | |||
* Fix a minor race condition when backing up Realm files before a client reset which could have lead to overwriting an existing file. ([PR #7341](https://github.com/realm/realm-core/pull/7341)). | |||
|
|||
### Breaking changes | |||
* None. | |||
* SyncManager no longer supports reconfiguring after calling reset_for_testing(). SyncManager::configure() has been folded into the constructor, and reset_for_testing() has been renamed to tear_down_for_testing(). ([PR #7351](https://github.com/realm/realm-core/pull/7351)) |
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.
I wonder if this should be under internals section. Are users supposed to use reset_for_testing?
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.
It's a breaking change for the SDKs which use it in their tests.
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.
right. but don't we share the breaking changes with the users?
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.
The SDKs are the users of core. They should not copy and paste this into their own changelogs.
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.
LGTM - oh, it looks like you just merged.
@@ -78,7 +78,7 @@ util::Optional<std::string> to_optional_string(StringData sd) | |||
std::vector<AuditEvent> get_audit_events(TestSyncManager& manager, bool parse_events = true) | |||
{ | |||
// Wait for all sessions to be fully uploaded and then tear them down | |||
auto sync_manager = manager.app()->sync_manager(); | |||
auto sync_manager = manager.sync_manager(); |
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.
Nice! These changes are definitely a lot cleaner
auto user = app->sync_manager()->get_user("user", ENCODE_FAKE_JWT("not_a_real_token"), | ||
ENCODE_FAKE_JWT("also_not_a_real_token"), dummy_device_id); | ||
TestSyncManager tsm; | ||
auto user = tsm.fake_user(); |
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.
💯
Another pile of changes extracted from #7300 with the hopes of making it more reviewable.
The primary change here is that TestSyncManager no longer has an App, and a new type OfflineAppSession replaces it for things testing App using a mock transport. Our test types are now:
This removes the ability to reconfigure SyncManager after calling reset_for_testing(). This was something that was originally needed because SyncManager was a singleton, but that hasn't been the case ever since v10 and tests can now just create a new SyncManager. No one appears to have been relying on this. reset_for_testing() has been renamed to tear_down_for_testing() to reflect the change in functionality.
Footnotes
Or won't post-app services split, anyway. Currently the actual implementation is still fairly coupled. ↩