From 70720fe6b0ddf42cf27bcef62a729ab81b06abdf Mon Sep 17 00:00:00 2001 From: Nikhil Bharadwaj Ramashasthri Date: Tue, 14 Jul 2026 07:01:09 -0700 Subject: [PATCH] Fix flaky testBypassSignalDependenciesWithBlocking by waiting for async notify The bypass action runs on a virtual thread. The enqueue verification waits with timeout(30000), but the following notify verification had no timeout, so it raced the third notify call and intermittently failed with TooFewActualInvocations (wanted 3, got 2). Use the same timeout-based verification as the surrounding assertions. --- .../maestro/engine/dao/MaestroStepInstanceActionDaoTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maestro-engine/src/test/java/com/netflix/maestro/engine/dao/MaestroStepInstanceActionDaoTest.java b/maestro-engine/src/test/java/com/netflix/maestro/engine/dao/MaestroStepInstanceActionDaoTest.java index 4b7f77ed..cd448695 100644 --- a/maestro-engine/src/test/java/com/netflix/maestro/engine/dao/MaestroStepInstanceActionDaoTest.java +++ b/maestro-engine/src/test/java/com/netflix/maestro/engine/dao/MaestroStepInstanceActionDaoTest.java @@ -696,7 +696,9 @@ public void testBypassSignalDependenciesWithBlocking() throws SQLException { Thread.ofVirtual().start(() -> spyDao.bypassStepDependencies(instance, "job1", user, true)); verify(queueSystem, timeout(30000).times(1)).enqueue(any(), any(InstanceActionJobEvent.class)); - verify(queueSystem, times(3)).notify(any()); + // the action runs on a virtual thread, so the third notify can land after the enqueue + // verification above; wait for it instead of racing it + verify(queueSystem, timeout(30000).times(3)).notify(any()); // assert that the action was saved Assert.assertTrue(actionDao.tryGetAction(summary, "job1").isPresent()); Assert.assertEquals(