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

Using test parameter to feed BAAS URL to device farm #1642

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

nhachicha
Copy link
Collaborator

@nhachicha nhachicha commented Jan 27, 2024

Using AndroidTestRunner to parametrise the URL of the BAAS server when running Sync tests on Device Farm. We now can replay the sync test without the need to rebuild the APK. see https://github.com/realm/realm-kotlin/actions/runs/7679635078/job/20931215946#step:8:43
image

@cla-bot cla-bot bot added the cla: yes label Jan 27, 2024
@nhachicha nhachicha marked this pull request as ready for review January 27, 2024 17:19
Copy link
Contributor

@cmelchior cmelchior left a comment

Choose a reason for hiding this comment

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

Nice 💯

run: |
OUTPUT=$(bash cli.sh poll ${{ steps.baas_cli_start.outputs.baas_container_id }} | jq -r '.httpUrl')
echo "baas_container_hostname=$OUTPUT" >> $GITHUB_OUTPUT

- name: Build Android Sync Test Apk
working-directory: packages
run: ./gradlew -PsyncTestUrl=${{ steps.baas_cli_poll.outputs.baas_container_hostname }} :test-sync:packageDebug :test-sync:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we remove the syncTestUrl from here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch 👍

val arguments: Bundle = InstrumentationRegistry.getArguments()
// if the test runner provided an argument for the BAAS URL use it
// Example: adb shell am instrument -w -e baas_url "http"//8.8.8.8:2134" -r io.realm.sync.testapp.test/androidx.test.runner.AndroidJUnitRunner
return arguments.getString("baas_url") ?: SyncServerConfig.url
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice solution to this 👍

- Fixing test
@nhachicha nhachicha merged commit c0ac0fe into cm/sync-tests Jan 29, 2024
40 of 54 checks passed
@nhachicha nhachicha deleted the nh/GHA/dynamic_device_farm_baas_url branch January 29, 2024 22:47
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants