From 60939588d8d2971e159f888315a25c0686e2155a Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Thu, 22 Oct 2026 21:19:43 +0300 Subject: [PATCH] Wait for the lines logged after a request's removal before asserting them Two tests waited until a request file was gone, then checked a line that the SDK logs only after it removes the file: the request drop age test the line of the request's owner, the backoff test the "not backing off" line of the last request. On a busy runner the check could run in between and fail, as the drop age test did on CI with "expected:<1> but was:<0>". Both now wait for their line with awaitLogs. --- .../sdk/java/internal/ModuleConfigurationNetworkTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleConfigurationNetworkTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleConfigurationNetworkTests.java index ec818463..2ae7b0eb 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleConfigurationNetworkTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleConfigurationNetworkTests.java @@ -198,7 +198,7 @@ public void backoff_neverAfterARequestOlderThanTheRequestAge_norWhileTheServerTu Assert.assertTrue("the old requests never drained, logs: " + logs, waitFor(() -> queueServer.received.size() == 2 && queuedRequestCount() == 0)); Assert.assertEquals(Arrays.asList("old_1", "old_2"), receivedParams("marker")); - Assert.assertEquals(2, logsContaining("but the request is older than [1] hours, " + NOT_BACKING_OFF)); + awaitLogs("but the request is older than [1] hours, " + NOT_BACKING_OFF, 2); Assert.assertEquals(0, logsContaining(BACKOFF_STARTED)); Countly.instance().halt(); @@ -396,7 +396,7 @@ public void requestDropAge_settlesTheJourneyTriggerOfADroppedRequest_andALaterTr push(new ServerConfigBuilder().networking(true).journeyTriggerEvents(names("purchase")).dropOldRequestTime(1)); Assert.assertTrue("the aged request was never dropped, logs: " + logs, waitNudging(() -> queuedRequestCount() == 0)); Assert.assertEquals(1, logsContaining(DROPPED_UNSENT)); - Assert.assertEquals(1, logsContaining("carrying a journey trigger failed with code [" + Transport.NO_RESPONSE_CODE + "], the content zone is not refreshed")); + awaitLogs("carrying a journey trigger failed with code [" + Transport.NO_RESPONSE_CODE + "], the content zone is not refreshed", 1); Assert.assertTrue(pending.isEmpty()); Assert.assertTrue(queueServer.received.isEmpty()); assertZoneIsInactive(0);