Skip to content

Commit

Permalink
Bump core to version 13.23.1 (#1545)
Browse files Browse the repository at this point in the history
  • Loading branch information
clementetb authored Oct 19, 2023
1 parent 0cc98c0 commit 93a05a1
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 31 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 1.12.0-SNAPSHOT (YYYY-MM-DD)

This release upgrades the Sync metadata in a way that is not compatible with older versions. To downgrade a Sync app from this version, you'll need to manually delete the metadata folder located at `$[SYNC-ROOT-DIRECTORY]/mongodb-realm/[APP-ID]/server-utility/metadata/`. This will log out all users.

### Breaking Changes
* None.

Expand Down Expand Up @@ -32,7 +34,7 @@ GET requests. (Issue [#1517](https://github.com/realm/realm-kotlin/pull/1517))
* Minimum Android SDK: 16.

### Internal
* None.
* Updated to Realm Core 13.23.1, commit 3618b2e9d679cd2880be8df17b79d4cc6d71ff76.


## 1.11.1 (2023-09-07)
Expand Down
6 changes: 3 additions & 3 deletions dependencies.list
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Version of MongoDB Realm used by integration tests
# See https://github.com/realm/ci/packages/147854 for available versions
MONGODB_REALM_SERVER=2023-09-22
MONGODB_REALM_SERVER=2023-10-10

# `BAAS` and `BAAS-UI` projects commit hashes matching MONGODB_REALM_SERVER image version
# note that the MONGODB_REALM_SERVER image is a nightly build, find the matching commits
# for that date within the following repositories:
# https://github.com/10gen/baas/
# https://github.com/10gen/baas-ui/
REALM_BAAS_GIT_HASH=0b7562d0401d72c909369030dc29332542614ba3
REALM_BAAS_UI_GIT_HASH=24baee4eb0e9736969a00a7bfac849565bca17f4
REALM_BAAS_GIT_HASH=8246fc548763eb908b8090df864e9924e3330a0d
REALM_BAAS_UI_GIT_HASH=8a1843be2bf24f2faa705c5470a5bdd8d954f7ea
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ expect object RealmInterop {
// User
fun realm_user_get_all_identities(user: RealmUserPointer): List<SyncUserIdentity>
fun realm_user_get_identity(user: RealmUserPointer): String
fun realm_user_get_auth_provider(user: RealmUserPointer): AuthProvider
fun realm_user_get_access_token(user: RealmUserPointer): String
fun realm_user_get_refresh_token(user: RealmUserPointer): String
fun realm_user_get_device_id(user: RealmUserPointer): String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1114,10 +1114,6 @@ actual object RealmInterop {
return realmc.realm_user_get_identity(user.cptr())
}

actual fun realm_user_get_auth_provider(user: RealmUserPointer): AuthProvider {
return AuthProvider.of(realmc.realm_user_get_auth_provider(user.cptr()))
}

actual fun realm_user_get_access_token(user: RealmUserPointer): String {
return realmc.realm_user_get_access_token(user.cptr())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2287,10 +2287,6 @@ actual object RealmInterop {
return realm_wrapper.realm_user_get_identity(user.cptr()).safeKString("identity")
}

actual fun realm_user_get_auth_provider(user: RealmUserPointer): AuthProvider {
return AuthProvider.of(realm_wrapper.realm_user_get_auth_provider(user.cptr()))
}

actual fun realm_user_is_logged_in(user: RealmUserPointer): Boolean {
return realm_wrapper.realm_user_is_logged_in(user.cptr())
}
Expand Down
2 changes: 1 addition & 1 deletion packages/external/core
Submodule core updated 208 files
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public interface User {
* Returns the provider type used to log the user in.
* If a user logs out, the authentication provider last used to log the user in will still be returned.
*/
@Deprecated("Users might have multiple providers. This will return the provider of the first identity of the user", ReplaceWith("identities"))
public val provider: AuthenticationProvider

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class UserImpl(
override val loggedIn: Boolean
get() = RealmInterop.realm_user_is_logged_in(nativePointer)
override val provider: AuthenticationProvider
get() = AuthenticationProviderImpl.fromId(RealmInterop.realm_user_get_auth_provider(nativePointer))
get() = identities.first().provider
override val accessToken: String
get() = RealmInterop.realm_user_get_access_token(nativePointer)
override val refreshToken: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import io.realm.kotlin.TypedRealm
import io.realm.kotlin.internal.ConfigurationImpl
import io.realm.kotlin.internal.ContextLogger
import io.realm.kotlin.internal.ObjectIdImpl
import io.realm.kotlin.internal.REALM_FILE_EXTENSION
import io.realm.kotlin.internal.interop.RealmInterop
import io.realm.kotlin.internal.interop.SchemaMode
import io.realm.kotlin.internal.platform.PATH_SEPARATOR
Expand Down Expand Up @@ -606,12 +605,7 @@ public interface SyncConfiguration : Configuration {
)
}

// Remove .realm extension if user has overridden filename manually
return if (name != null) {
absolutePath.removeSuffix(REALM_FILE_EXTENSION)
} else {
absolutePath
}
return absolutePath
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ class RealmTests {
@Suppress("LongMethod")
fun deleteRealm() {
val fileSystem = FileSystem.SYSTEM
val testDir = PlatformUtils.createTempDir("test_dir")
val testDir = PlatformUtils.createTempDir()
val testDirPath = testDir.toPath()
assertTrue(fileSystem.exists(testDirPath))

Expand Down Expand Up @@ -510,7 +510,7 @@ class RealmTests {
@Test
fun deleteRealm_fileDoesNotExists() {
val fileSystem = FileSystem.SYSTEM
val testDir = PlatformUtils.createTempDir("test_dir")
val testDir = PlatformUtils.createTempDir()
val configuration = RealmConfiguration.Builder(schema = setOf(Parent::class, Child::class))
.directory(testDir)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ class AppTests {
Realm.open(syncConfig).close()

// Create a configuration pointing to the metadata Realm for that app
val lastSetSchemaVersion = 6L
val lastSetSchemaVersion = 7L
val metadataDir = "${app.configuration.syncRootDirectory}/mongodb-realm/${app.configuration.appId}/server-utility/metadata/"
val config = RealmConfiguration
.Builder(setOf())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class FlexibleSyncIntegrationTests {

val exception: CompensatingWriteException = channel.receiveOrFail()

assertTrue(exception.message!!.startsWith("[Sync][CompensatingWrite(1033)] Client attempted a write that is outside of permissions or query filters; it has been reverted Logs:"), exception.message)
assertTrue(exception.message!!.startsWith("[Sync][CompensatingWrite(1033)] Client attempted a write that is not allowed; it has been reverted Logs:"), exception.message)
assertEquals(1, exception.writes.size)

exception.writes[0].run {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class SyncClientResetIntegrationTests {

block(syncMode, app, user, configBuilderGenerator(user))
} finally {
logChannel.close()
app.close()
}
}
Expand Down Expand Up @@ -442,10 +443,11 @@ class SyncClientResetIntegrationTests {

// Validate Realm instance has been correctly updated
assertEquals(0, objectChannel.receiveOrFail().list.size)

objectChannel.close()
job.cancel()
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -531,15 +533,20 @@ class SyncClientResetIntegrationTests {
assertEquals(ClientResetEvents.ON_BEFORE_RESET, channel.receiveOrFail())
assertEquals(ClientResetEvents.ON_AFTER_RESET, channel.receiveOrFail())

// TODO We must not need this. Force updating the instance pointer.
// Object count down to 0 just after the reset
assertEquals(0, objectChannel.receiveOrFail().list.size)

// TODO https://github.com/realm/realm-core/issues/7065
// We must not need this. Force updating the instance pointer.
realm.write { }

// Validate Realm instance has been correctly updated
assertEquals(1, objectChannel.receiveOrFail().list.size)

objectChannel.close()
job.cancel()
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -611,6 +618,7 @@ class SyncClientResetIntegrationTests {
}
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -686,6 +694,7 @@ class SyncClientResetIntegrationTests {
}
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -759,6 +768,8 @@ class SyncClientResetIntegrationTests {
assertEquals(ClientResetEvents.ON_MANUAL_RESET_FALLBACK, channel.receiveOrFail())
}
}

channel.close()
}

@Test
Expand Down Expand Up @@ -846,6 +857,7 @@ class SyncClientResetIntegrationTests {
assertEquals(ClientResetEvents.ON_MANUAL_RESET_FALLBACK, channel.receiveOrFail())
}
}
channel.close()
}

// ---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -954,6 +966,7 @@ class SyncClientResetIntegrationTests {
}
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -1006,6 +1019,7 @@ class SyncClientResetIntegrationTests {
}
}
}
channel.close()
}

// ---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1066,6 +1080,7 @@ class SyncClientResetIntegrationTests {
assertEquals(ClientResetEvents.ON_AFTER_RESET, channel.receiveOrFail())
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -1117,6 +1132,7 @@ class SyncClientResetIntegrationTests {
assertTrue(exception.message!!.contains("Simulate Client Reset"))
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -1175,6 +1191,7 @@ class SyncClientResetIntegrationTests {
assertEquals(ClientResetEvents.ON_MANUAL_RESET_FALLBACK, channel.receiveOrFail())
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -1245,6 +1262,7 @@ class SyncClientResetIntegrationTests {
}
}
}
channel.close()
}

// ---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1307,6 +1325,7 @@ class SyncClientResetIntegrationTests {
assertEquals(ClientResetEvents.ON_AFTER_RECOVERY, channel.receiveOrFail())
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -1374,6 +1393,7 @@ class SyncClientResetIntegrationTests {
assertEquals(ClientResetEvents.ON_AFTER_DISCARD, channel.receiveOrFail())
}
}
channel.close()
}

@Test
Expand Down Expand Up @@ -1448,5 +1468,6 @@ class SyncClientResetIntegrationTests {
}
}
}
channel.close()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1261,8 +1261,11 @@ class SyncConfigTests {
val config: SyncConfiguration = SyncConfiguration.Builder(user, partitionValue, setOf())
.name(fileName)
.build()
val suffix = pathOf("", "mongodb-realm", user.app.configuration.appId, user.id, fileName)

val expectedFilename = if (fileName.endsWith(".realm")) fileName else "$fileName.realm"

val suffix = pathOf("", "mongodb-realm", user.app.configuration.appId, user.id, expectedFilename)
assertTrue(config.path.endsWith(suffix), "${config.path} failed.")
assertEquals(fileName, config.name, "${config.name} failed.")
assertEquals(expectedFilename, config.name, "${config.name} failed.")
}
}

0 comments on commit 93a05a1

Please sign in to comment.