Skip to content

[SDK-753] Stabilize flaky Android unit, instrumentation, and BCIT tests - #1099

Open
joaodordio wants to merge 1 commit into
masterfrom
fix/SDK-753-stabilize-flaky-android-tests
Open

joaodordio wants to merge 1 commit into
masterfrom
fix/SDK-753-stabilize-flaky-android-tests

Conversation

@joaodordio

@joaodordio joaodordio commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

📝 Summary

Stop three Android tests from failing on live image downloads, emulator HTTP timeouts, and fixed sleeps before profile updates land.

🎟️ Jira Ticket: SDK-753

📖 Description

Test-only. IterableNotificationTest.testNotificationImage loads a local PNG instead of downloading from assets.iterable.com. IterableApiResponseTest.testResponseCode400WithoutMessage retries when the emulator times out before MockWebServer answers, and reports that as an emulator timeout instead of an Invalid Request mismatch. EmbeddedMessageIntegrationTest.testEmbeddedMessageMVP waits for a successful embedded sync to reflect membershipLevel before asserting placement 2157.

🧪 How to test?

  • ./gradlew :iterableapi:testDebugUnitTest --tests com.iterable.iterableapi.IterableNotificationTest.testNotificationImage
  • ./gradlew :iterableapi:checkstyle :iterableapi:compileDebugAndroidTestJavaWithJavac
  • Run IterableApiResponseTest.testResponseCode400WithoutMessage on an emulator
  • Run BCIT EmbeddedMessageIntegrationTest.testEmbeddedMessageMVP

🧾 Changelog

No customer facing changes

📹 Loom recording if applicable

N/A

🐞 Github Issues solved

None

📚 Docs PR if applicable

None. No public API or customer-facing behavior change.

The image unit test, the 400 instrumentation case, and the embedded BCIT membership check were failing when CI could not download a live asset, the emulator timed out, or a profile update had not propagated yet.
@joaodordio
joaodordio marked this pull request as ready for review October 6, 2026 11:02
@joaodordio
joaodordio requested a review from a team as a code owner October 6, 2026 11:02
@joaodordio joaodordio self-assigned this Oct 6, 2026
Comment on lines +299 to +300
if (!matches && !updateSent) {
setMembershipLevel(level)

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.

setMembershipLevel(level) only runs after a successful sync disagrees with present; if the standard placement is already absent, the helper returns after two matching syncs without ever setting membershipLevel=standard.
This can pass while testing an unset or stale profile.

The fix would be to establish the requested membership before accepting the placement state.
Suggest sending the update unconditionally, or forcing an observable transition, before polling for its resulting placement state.

Comment on lines +162 to +164
if (recorded != null && callbackFinished && !isEmulatorTransportTimeout(lastReason)) {
assertEquals("Invalid Request", lastReason);
}

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.

Suggest failing any completed callback with an unrecognized non-transport reason even when takeRequest() timed out.

The request can reach MockWebServer after that five-second wait, so recorded == null can suppress an unexpected SDK result and a later attempt can make the test pass, masking the product assertion.

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.

2 participants