Skip to content

Commit

Permalink
fix: naming convention, ut problems
Browse files Browse the repository at this point in the history
  • Loading branch information
emptyOVO committed Nov 7, 2024
1 parent 0e4ac8e commit 9a38e26
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@
import static org.apache.inlong.manager.schedule.dolphinscheduler.DolphinSchedulerContainerEnvConstants.DS_USERNAME;
import static org.apache.inlong.manager.schedule.dolphinscheduler.DolphinSchedulerContainerEnvConstants.HTTP_BASE_URL;

public abstract class DolphinScheduleContainerEnvTest extends BaseScheduleTest {
public abstract class DolphinScheduleContainerTestEnv extends BaseScheduleTest {

protected static GenericContainer<?> dolphinSchedulerContainer;

private static final Logger DS_LOG = LoggerFactory.getLogger(DolphinScheduleContainerEnvTest.class);
private static final Logger DS_LOG = LoggerFactory.getLogger(DolphinScheduleContainerTestEnv.class);

// DS env generated final url and final token
protected static String DS_URL;
protected static String DS_TOKEN;

public static void setUp() throws Exception {
public static void envSetUp() throws Exception {
dolphinSchedulerContainer =
new GenericContainer<>(DS_IMAGE_NAME + ":" + DS_IMAGE_TAG)
.withExposedPorts(12345, 25333)
Expand Down Expand Up @@ -126,7 +126,7 @@ private static String accessToken() throws Exception {
return null;
}

public static void tearDown() {
public static void envShutDown() {
if (dolphinSchedulerContainer != null) {
dolphinSchedulerContainer.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.Timeout;

import static org.apache.inlong.manager.schedule.dolphinscheduler.DolphinSchedulerContainerEnvConstants.INLONG_DS_TEST_ADDRESS;
Expand All @@ -30,21 +33,22 @@
import static org.apache.inlong.manager.schedule.dolphinscheduler.DolphinSchedulerContainerEnvConstants.INLONG_DS_TEST_USERNAME;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class DolphinScheduleEngineTest extends DolphinScheduleContainerEnvTest {
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class DolphinScheduleEngineTest extends DolphinScheduleContainerTestEnv {

private static DolphinScheduleEngine dolphinScheduleEngine;

@BeforeAll
public static void initDolphinSchedulerEngine() throws Exception {
setUp();
envSetUp();
assertTrue(dolphinSchedulerContainer.isRunning(), "DolphinScheduler container should be running");

dolphinScheduleEngine = new DolphinScheduleEngine(INLONG_DS_TEST_ADDRESS, INLONG_DS_TEST_PORT,
INLONG_DS_TEST_USERNAME, INLONG_DS_TEST_PASSWORD, DS_URL, DS_TOKEN);
}

@Test
@Order(1)
@Timeout(30)
public void testRegisterScheduleInfo() {
// 1. test for normal schedule
Expand All @@ -63,6 +67,7 @@ private void testRegister(ScheduleInfo scheduleInfo) {
}

@Test
@Order(2)
@Timeout(30)
public void testUnRegisterScheduleInfo() {
// 1. test for normal schedule
Expand All @@ -85,6 +90,7 @@ private void testUnRegister(ScheduleInfo scheduleInfo) {
}

@Test
@Order(3)
@Timeout(30)
public void testUpdateScheduleInfo() {
// 1. test for normal schedule
Expand All @@ -105,6 +111,6 @@ private void testUpdate(ScheduleInfo scheduleInfo) {
@AfterAll
public static void testStopEngine() {
dolphinScheduleEngine.stop();
tearDown();
envShutDown();
}
}

0 comments on commit 9a38e26

Please sign in to comment.