Skip to content
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

Migrating and enabling sync session integration test #6884

Merged
merged 19 commits into from
Jun 4, 2020

Conversation

rorbech
Copy link
Contributor

@rorbech rorbech commented May 28, 2020

This migrates the sync session test to Kotlin and reenables them for the new sync.

Issues uncovered and fixed:

Issues uncovered but not address

  • Realms with different partition keys do not have distinct paths Opening same Realm with different partition values #6882
  • Bad changeset errors, when re-syncing the same scheme against a server after updating the partition value. Only seems to be an issue if scheme contains double (in which case the resynced type is float) or schema contains list (in which case the resynced type differs in nullability). Apparently the server does not support Double and list with nullable elements. Issues are filed on server side.
  • Other ignored tests with not yet uncovered causes. Could just be a matter of erroneous test/test framework (not all tests are migrated to use BlockingLoooperThread), but needs investigation. Reasons are:
    • Need to clean server between tests/runs
    • Does not terminate
    • Re-logging in does not authorize
    • Asserts with no_session when tearing down, meaning that all session are not closed, but realm seems to be closed, so further investigation is needed

@rorbech rorbech marked this pull request as ready for review June 3, 2020 07:43
# Conflicts:
#	realm/realm-library/build.gradle
#	realm/realm-library/src/objectServer/java/io/realm/internal/SyncObjectServerFacade.java
#	realm/realm-library/src/objectServer/java/io/realm/mongodb/sync/SyncConfiguration.java
#	realm/realm-library/src/syncTestUtils/kotlin/io/realm/TestSyncConfigurationFactory.kt
val columnRealmInteger = MutableRealmInteger.ofNull()
var columnRealmObject: SyncDog? = null
var columnRealmList: RealmList<SyncDog>? = null
var columnStringList: RealmList<String>? = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these will fail unless made @required, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Tests using this are currently all ignore. It took me some time to realise that lists with null elements where not supported on the server. The initial upload worked and the subsequent sync failed because of mismatched schema as the server just "truncated" the nullable parameter on the initial upload. Issue is raised on the server. Will fix in another PR when the issue is also fixed on the server.

* limitations under the License.
*/

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License is duplicated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix in another PR along with the other SyncAllTypesSchema comments.

import java.math.BigDecimal
import java.util.*

open class SyncSupportedTypes : RealmObject() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I get having both this class and SyncAllTypes we should probably only keep one of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I introduced this one to enable successful testing while keeping the SyncAllTypes to track the issues of re-syncing with the server. Did not have the overview of what actually caused the trouble (lacking server support for Double and lists with nullable elements). Will clean it up in another PR along with the other SyncAlllTypesSchema

@@ -252,17 +252,17 @@ JNIEXPORT jlong JNICALL Java_io_realm_mongodb_sync_SyncSession_nativeAddConnecti
return 0;
}

static JavaClass java_syncmanager_class(env, "io/realm/mongodb/sync/Sync");
static JavaMethod java_notify_connection_listener(env, java_syncmanager_class, "notifyConnectionListeners", "(Ljava/lang/String;JJ)V", true);
static JavaClass java_syncmanager_class(env, "io/realm/mongodb/sync/SyncSession");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably rename the java_syncmanager_class variables as that is no longer accurate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will leave it for now, but will put a not on that in the issue for cleaning up the memory leak.

@rorbech
Copy link
Contributor Author

rorbech commented Jun 4, 2020

Merging after full local build and test as CI does not seem to progress and the failing tests from previous CI failures seems flaky and are not related to this PR.

@rorbech rorbech merged commit aa0ffc4 into v10 Jun 4, 2020
@rorbech rorbech deleted the cr/sync-integration-test-session branch June 4, 2020 18:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants