From 40e7485be1caf3a0e3a8b9b04ccaf241eefb1b6e Mon Sep 17 00:00:00 2001 From: Logic Date: Thu, 27 Aug 2026 19:00:04 +0800 Subject: [PATCH] Stabilize migration recovery timing test --- .../workflow/DeploymentMigrationCommandRunnerRecoveryTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/setup/workflow/DeploymentMigrationCommandRunnerRecoveryTest.java b/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/setup/workflow/DeploymentMigrationCommandRunnerRecoveryTest.java index 0dc198b6d3..c45d91cfa1 100644 --- a/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/setup/workflow/DeploymentMigrationCommandRunnerRecoveryTest.java +++ b/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/setup/workflow/DeploymentMigrationCommandRunnerRecoveryTest.java @@ -65,12 +65,14 @@ class DeploymentMigrationCommandRunnerRecoveryTest { FileMigrationOperationStore store = new FileMigrationOperationStore(root.resolve("timeout")); RetainedCutoverCoordinator coordinator = mock(RetainedCutoverCoordinator.class); CountDownLatch allowPreparation = new CountDownLatch(1); + CountDownLatch preparationPublished = new CountDownLatch(1); AtomicInteger executions = new AtomicInteger(); when(coordinator.execute(any(), any(), any(), any(), any(), any(), any())) .thenAnswer(invocation -> { executions.incrementAndGet(); assertThat(allowPreparation.await(5, SECONDS)).isTrue(); prepare(invocation); + preparationPublished.countDown(); return retained(); }); DeploymentMigrationCommandRunner runner = runner( @@ -83,6 +85,7 @@ class DeploymentMigrationCommandRunnerRecoveryTest { assertThat(runner.activeOperationId()).contains(OPERATION); allowPreparation.countDown(); + assertThat(preparationPublished.await(5, SECONDS)).isTrue(); MigrationViewAssert.running(runner.start(request())); assertThat(executions).hasValue(1); } finally {