Skip to content

Run connected tests on a mac-metal emulator - #1121

Merged
mokagio merged 10 commits into
trunkfrom
ainfra-3575-does-aztec-android-need-firebase-secrets-mac-metal
Nov 3, 2026
Merged

mokagio merged 10 commits into
trunkfrom
ainfra-3575-does-aztec-android-need-firebase-secrets-mac-metal

Conversation

@mokagio

@mokagio mokagio commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes AINFRA-3575:

  • Restore the connected tests
  • Move from Firebase Test Lab to an API 34 arm64-v8a emulator on mac-metal
  • Remove the only use of firebase.secrets.json, so we no longer track encrypted secrets in the repo
image
Details from AI agent regarding the investigation that resulted in this solution

BaseTest also stops requesting storage permission above API 29, which failed nearly the whole suite on API 34.

The alternatives, each run with the same BaseTest fix:

Building the APKs on the android queue and running them with Marathon took longer than plain Gradle (build 883, 16m 48s against 14m 26s), so this stays on Gradle.

One tradeoff to be aware of: capacity. mac-metal is a small pool of physical machines, so running there could clog the queue. But, this repo sees little activity, so it seem like a good way to settle the issue.

Test

  1. Read the Connected Tests step on Buildkite and its uploaded reports.

Firebase Test Lab rejects `Nexus5X`, so no test has run since at least September 2025.
Jeremy Massel listed moving to `mac-metal` as one option in AINFRA-3575.
The artifact paths change because the old ones pointed at `:aztec` unit test results.

---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
Connected tests were the only consumer of `firebase.secrets.json`, and they now run on an emulator.
That leaves nothing to migrate to `a8c-secrets`, which is the question AINFRA-3575 asked.

---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
@mokagio mokagio self-assigned this Nov 3, 2026
The app declares `WRITE_EXTERNAL_STORAGE` up to API 29 and `READ_EXTERNAL_STORAGE` up to API 32.
On API 34 `GrantPermissionRule` therefore fails with `READ_EXTERNAL_STORAGE cannot be granted!`, which failed nearly the whole connected suite before any test body ran.

---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
`mac-metal` is a small pool of physical machines, so it should not spend time compiling.
Day One and Tumblr split the work the same way, and run the prebuilt APKs with Marathon, which `mac-metal` agents already have.
Retries stay off so that flaky tests remain visible.

---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
With Marathon's defaults, `Connected Tests` took 17m 34s, compared to 13m 20s when Gradle also compiled on the same machine.
The log shows a video recorded for every test, and the default batching runs tests one at a time.

---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
Building on the `android` queue and running with Marathon saved no `mac-metal` time, and made the whole build about 3 minutes longer.
Compiling there took 18s in build 878, and Marathon's test run took about a minute longer than Gradle's.

---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
@mokagio mokagio changed the title Explore AINFRA-3575 option 2: emulator on mac-metal Run connected tests on a mac-metal emulator Nov 3, 2026
@mokagio
mokagio marked this pull request as ready for review November 3, 2026 05:24
Copilot AI balanced review requested due to automatic review settings November 3, 2026 05:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the migration of connected Android tests from Firebase Test Lab to a Buildkite emulator.

No open issues 🎉

What changed in this PR

Restores connected Android tests by replacing Firebase Test Lab with an API 34 ARM64 emulator on Buildkite’s mac-metal queue, removing the Firebase secrets dependency.

Changes:

  • Runs connected tests through Gradle and uploads their reports and results.
  • Requests storage permission only on API 29 and below.
  • Removes the configure plugin and obsolete Firebase secrets configuration.
File Description
build.gradle Removes the configure plugin and its dependency.
app/​src/​androidTest/​kotlin/​org/​wordpress/​aztec/​demo/​BaseTest.kt Skips storage permission requests above API 29.
.gitignore Removes configure-file and Firebase secret ignore rules.
.configure Deletes the Firebase secrets configuration.
.buildkite/​pipeline.yml Selects mac-metal and collects connected-test artifacts.
.buildkite/​commands/​connected-tests.sh Starts an API 34 ARM64 emulator and runs Gradle connected tests.

Review effort: Balanced

Devs can still have a decrypted copy locally after the Firebase setup goes away.
The rule stays until they've had time to clean up, tracked in the secrets allowances cleanup on Linear.

---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
@mokagio
mokagio requested review from jkmassel and wzieba November 3, 2026 05:46

@Twinsen81 Twinsen81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two small suggestions. Neither one is blocking.

Comment thread .buildkite/pipeline.yml Resolved
Comment thread .buildkite/commands/connected-tests.sh Outdated
Comment on lines +6 to +8
start-android-emulator \
--system-image "system-images;android-34;google_apis;arm64-v8a" \
--device "pixel_5"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion, not blocking: keep the emulator logs.

Without --logs-dir, start-android-emulator writes emulator-stdout.txt and emulator-stderr.txt into the AVD directory. That directory is outside the checkout and the pre-exit hook deletes it, so the job cannot upload these files. The test logcat is already in androidTest-results/connected, but only the emulator output shows an emulator crash or adb going offline during the run. These are the likely causes if the step becomes flaky again.

Suggested change
start-android-emulator \
--system-image "system-images;android-34;google_apis;arm64-v8a" \
--device "pixel_5"
start-android-emulator \
--system-image "system-images;android-34;google_apis;arm64-v8a" \
--device "pixel_5" \
--logs-dir "build/emulator-logs"

Then add - "build/emulator-logs/**/*" to artifact_paths in pipeline.yml.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Adopted in 230ace5

@Twinsen81 Twinsen81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving. The two suggestions above are not blocking.

mokagio and others added 2 commits November 4, 2026 10:10
Co-authored-by: Evgenii Plokhov <plokhov@gmail.com>
By default the emulator's stdout and stderr land in the AVD directory, which is outside the checkout and removed by the `pre-exit` hook, so the job cannot upload them.
They are what shows an emulator crash or adb going offline if the step becomes flaky.

Requested in review: #1121 (comment)

---

Generated with the help of Claude Code (Opus 5.5), https://code.claude.com
@mokagio
mokagio enabled auto-merge November 3, 2026 23:16
@mokagio
mokagio merged commit e012d73 into trunk Nov 3, 2026
12 of 14 checks passed
@mokagio
mokagio deleted the ainfra-3575-does-aztec-android-need-firebase-secrets-mac-metal branch November 3, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants