From 7ef055fef77684f1a0bc81583dd176fe52d117b6 Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Tue, 7 Apr 2026 17:12:49 -0400 Subject: [PATCH 1/2] fix: increase MPLatch timeout from 5s to 30s The 5-second timeout is too short for WebView JS bridge tests running on newer GitHub Actions runner images (ubuntu24/20260309.50+). The MParticleJSInterfaceITest tests consistently fail because JS execution in the emulator WebView doesn't complete within 5 seconds on these environments. Increasing to 30 seconds provides sufficient margin while still catching genuine hangs via the workflow-level timeout-minutes: 15. Co-Authored-By: Claude Opus 4.6 (1M context) --- testutils/src/main/java/com/mparticle/testutils/MPLatch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testutils/src/main/java/com/mparticle/testutils/MPLatch.java b/testutils/src/main/java/com/mparticle/testutils/MPLatch.java index 7a89d11cd..cb36e412d 100644 --- a/testutils/src/main/java/com/mparticle/testutils/MPLatch.java +++ b/testutils/src/main/java/com/mparticle/testutils/MPLatch.java @@ -49,7 +49,7 @@ public void countDown() { @Override public void await() throws InterruptedException { - int timeoutTimeMs = 5 * 1000; + int timeoutTimeMs = 30 * 1000; synchronized (this) { if (count == countDowned) { return; From 48f497fa0e70c6c3a83e4c32c6b3feb40e2f0cb9 Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Wed, 8 Apr 2026 08:35:41 -0400 Subject: [PATCH 2/2] fix: use explicit 30s timeout in JS bridge tests only Instead of increasing the global MPLatch timeout (used by 20+ test files), use an explicit 30-second await in MParticleJSInterfaceITest only. WebView JS execution needs more time on newer CI runner images, but other tests don't need the longer timeout. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../internal/MParticleJSInterfaceITest.java | 23 +++++++++++-------- .../java/com/mparticle/testutils/MPLatch.java | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/android-core/src/androidTest/java/com/mparticle/internal/MParticleJSInterfaceITest.java b/android-core/src/androidTest/java/com/mparticle/internal/MParticleJSInterfaceITest.java index 0a1832b0a..55d40222b 100644 --- a/android-core/src/androidTest/java/com/mparticle/internal/MParticleJSInterfaceITest.java +++ b/android-core/src/androidTest/java/com/mparticle/internal/MParticleJSInterfaceITest.java @@ -33,6 +33,8 @@ import com.mparticle.testutils.BaseCleanStartedEachTest; import com.mparticle.testutils.BuildConfig; import com.mparticle.testutils.MPLatch; + +import java.util.concurrent.TimeUnit; import com.mparticle.testutils.RandomUtils; import org.json.JSONArray; @@ -68,6 +70,7 @@ public class MParticleJSInterfaceITest extends BaseCleanStartedEachTest { private static boolean sdkFetchedSuccessfully = false; private static String bridgeToken = new RandomUtils().getAlphaString(5); private static String bridgeVersion = "2"; + private static final int WEBVIEW_TIMEOUT_SECONDS = 30; private static final String jsStartupMParticle = "window.mParticle = {\n" + " config: {\n" + @@ -238,7 +241,7 @@ public void setUserAttribute(String json) { } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -263,7 +266,7 @@ public void removeUserAttribute(String json) { } } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -304,7 +307,7 @@ public void setUserAttribute(String json) { } } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -361,7 +364,7 @@ public void logEvent(String json) { } } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -443,7 +446,7 @@ public void logEvent(String json) { } }); assertNull(error.value); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -470,7 +473,7 @@ public void logout(String json) { } } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -496,7 +499,7 @@ public void logout() { latch.countDown(); } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -522,7 +525,7 @@ public void login(String json) { } } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -548,7 +551,7 @@ public void login() { latch.countDown(); } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } @@ -574,7 +577,7 @@ public void modify(String json) { } } }); - latch.await(); + latch.await(WEBVIEW_TIMEOUT_SECONDS, TimeUnit.SECONDS); assertTrue(called.value); } diff --git a/testutils/src/main/java/com/mparticle/testutils/MPLatch.java b/testutils/src/main/java/com/mparticle/testutils/MPLatch.java index cb36e412d..7a89d11cd 100644 --- a/testutils/src/main/java/com/mparticle/testutils/MPLatch.java +++ b/testutils/src/main/java/com/mparticle/testutils/MPLatch.java @@ -49,7 +49,7 @@ public void countDown() { @Override public void await() throws InterruptedException { - int timeoutTimeMs = 30 * 1000; + int timeoutTimeMs = 5 * 1000; synchronized (this) { if (count == countDowned) { return;