diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-adbspark/src/test/java/org/apache/dolphinscheduler/plugin/task/adbspark/AdbSparkTaskTest.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-adbspark/src/test/java/org/apache/dolphinscheduler/plugin/task/adbspark/AdbSparkTaskTest.java index cd032234bc9d..3dc1cb0a4fc3 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-adbspark/src/test/java/org/apache/dolphinscheduler/plugin/task/adbspark/AdbSparkTaskTest.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-adbspark/src/test/java/org/apache/dolphinscheduler/plugin/task/adbspark/AdbSparkTaskTest.java @@ -158,6 +158,11 @@ public void testTraceApplication() throws Exception { adbSparkTask.setAppIds(mockAppId); // mock + when(mockAdbSparkClient.submitSparkApp(any())).thenReturn(mockSubmitSparkAppResponse); + when(mockSubmitSparkAppResponse.getBody()).thenReturn(mockSubmitSparkAppResponseBody); + when(mockSubmitSparkAppResponseBody.getData()).thenReturn(mockSubmitSparkAppResponseBodyData); + when(mockSubmitSparkAppResponseBodyData.getAppId()).thenReturn(mockAppId); + when(mockAdbSparkClient.getSparkAppState(any(GetSparkAppStateRequest.class))) .thenReturn(mockGetSparkAppStateResponse); when(mockGetSparkAppStateResponse.getBody()).thenReturn(mockGetSparkAppStateResponseBody); @@ -165,6 +170,7 @@ public void testTraceApplication() throws Exception { when(mockGetSparkAppStateResponseBodyData.getState()).thenReturn("COMPLETED"); // action + adbSparkTask.submitApplication(); adbSparkTask.trackApplicationStatus(); // verify @@ -177,7 +183,20 @@ public void testCancelApplication() throws Exception { adbSparkTask.init(); adbSparkTask.setAppIds(mockAppId); + // mock + when(mockAdbSparkClient.submitSparkApp(any())).thenReturn(mockSubmitSparkAppResponse); + when(mockSubmitSparkAppResponse.getBody()).thenReturn(mockSubmitSparkAppResponseBody); + when(mockSubmitSparkAppResponseBody.getData()).thenReturn(mockSubmitSparkAppResponseBodyData); + when(mockSubmitSparkAppResponseBodyData.getAppId()).thenReturn(mockAppId); + + when(mockAdbSparkClient.getSparkAppState(any(GetSparkAppStateRequest.class))) + .thenReturn(mockGetSparkAppStateResponse); + when(mockGetSparkAppStateResponse.getBody()).thenReturn(mockGetSparkAppStateResponseBody); + when(mockGetSparkAppStateResponseBody.getData()).thenReturn(mockGetSparkAppStateResponseBodyData); + when(mockGetSparkAppStateResponseBodyData.getState()).thenReturn("SUBMITTED"); + // action + adbSparkTask.submitApplication(); adbSparkTask.cancelApplication(); // verify diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-aliyun-adb-spark.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-aliyun-adb-spark.ts index ad4990bb8f6c..2c2e450de645 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-aliyun-adb-spark.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-aliyun-adb-spark.ts @@ -15,9 +15,8 @@ * limitations under the License. */ import { useI18n } from 'vue-i18n' -import {useCustomParams, useResources} from '.' +import { useCustomParams } from '.' import type { IJsonItem } from '../types' -import {ref} from "vue"; export function useADBSPARK(model: { [field: string]: any}): IJsonItem[] {