From 266cecac72609938b9e831ba141da786400249a7 Mon Sep 17 00:00:00 2001 From: coldless177 Date: Fri, 1 Nov 2024 10:24:12 +0800 Subject: [PATCH] fix ConfigureClusterTaskTest Unexpected method calls: ClusterConfigurationRequest.getRequiredHostGroups() error fix AsyncCallableServiceTest Unexpected method calls: Callable.call() error --- .../ambari/server/topology/AsyncCallableServiceTest.java | 2 +- .../ambari/server/topology/ConfigureClusterTaskTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/AsyncCallableServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/AsyncCallableServiceTest.java index 348b8272b55..06c1d60275f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/AsyncCallableServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/AsyncCallableServiceTest.java @@ -152,7 +152,7 @@ public void testCallableServiceShouldExitWhenTaskCompleted() throws Exception { @Test public void testCallableServiceShouldRetryTaskExecutionTillTimeoutExceededWhenTaskThrowsException() throws Exception { // GIVEN - expect(taskMock.call()).andThrow(new IllegalStateException("****************** TESTING ****************")).times(2, 3); + expect(taskMock.call()).andThrow(new IllegalStateException("****************** TESTING ****************")).times(2, 20); onErrorMock.accept(anyObject(IllegalStateException.class)); replayAll(); asyncCallableService = new AsyncCallableService<>(taskMock, TIMEOUT, RETRY_DELAY, "test", onErrorMock); diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java index 925e6cbfa09..6e5f47dbd15 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java @@ -90,6 +90,9 @@ public void testsShouldConfigureClusterTaskExecuteWhenCalledFromAsyncCallableSer // GIVEN expect(clusterConfigurationRequest.getRequiredHostGroups()).andReturn(Collections.emptyList()); expect(clusterTopology.getHostGroupInfo()).andReturn(Collections.emptyMap()); + expect(clusterTopology.getClusterId()).andReturn(1L).anyTimes(); + expect(clusterTopology.getAmbariContext()).andReturn(ambariContext); + expect(ambariContext.getClusterName(1L)).andReturn("testCluster"); clusterConfigurationRequest.process(); replayAll();