Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-462

Migration test utility for CI

      Describe your problem or use case

      • It's difficult to officially test realm migrations, especially in environments without access to a device or emulator. Even with access to a device, performing an end-to-end test (e.g. in a production app version) requires installing an app file on top of a pre-existing app file and opening the app to see if the migration succeeded.
      • Tests can be written & test {{Realm}}s with injected realm files can be created to validate realm migrations in a testing environment, but there's still a bit of data setup and boilerplate involved

      Describe the solution you'd like

      • A migration test utility that can perform the same migration checks on initialization that occur when an app (in this case Android) is installed, without a device or emulator required
      • This could be a script/executable, or a separate Gradle task/module, etc, that takes two realm files as input and outputs the same information within the RealmMigrationNeededException that is printed to the console on startup
      • Ideally this would not depend on the Android framework so it could run in a scripting/CI environment

      Additional context

      • We can hack together a CI solution to solve this problem and detect realm migrations as a pull request confirmation step, but it's fairly messy and hard to detect when the app has started up or crashed.

      Questions

      • Is something like this currently even possible, given how Realm is setup today?
      • If so, is this something that can be accomplished in a 3rd party/community PR?
      • Is this something that must always rely on the Android framework, given how Realm is setup today? Or is it possible to run as a standalone tool outside of Android?

      Digging around in the realm repository, looking at this makes me think that the migration detection happens in native code.

      I'd love to help make this a reality and contribute, and I can provide help in the Gradle/Android side of things, but my knowledge of CPP is limited.

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: