Repository navigation
[SDK-753] Stabilize flaky Android unit, instrumentation, and BCIT tests - #1099
joaodordio wants to merge 1 commit into
Conversation
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.
| if (!matches && !updateSent) { | ||
| setMembershipLevel(level) |
There was a problem hiding this comment.
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.
| if (recorded != null && callbackFinished && !isEmulatorTransportTimeout(lastReason)) { | ||
| assertEquals("Invalid Request", lastReason); | ||
| } |
There was a problem hiding this comment.
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.
📝 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.testNotificationImageloads a local PNG instead of downloading from assets.iterable.com.IterableApiResponseTest.testResponseCode400WithoutMessageretries when the emulator times out before MockWebServer answers, and reports that as an emulator timeout instead of anInvalid Requestmismatch.EmbeddedMessageIntegrationTest.testEmbeddedMessageMVPwaits for a successful embedded sync to reflectmembershipLevelbefore asserting placement 2157.🧪 How to test?
./gradlew :iterableapi:testDebugUnitTest --tests com.iterable.iterableapi.IterableNotificationTest.testNotificationImage./gradlew :iterableapi:checkstyle :iterableapi:compileDebugAndroidTestJavaWithJavacIterableApiResponseTest.testResponseCode400WithoutMessageon an emulatorEmbeddedMessageIntegrationTest.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.