From d8011d857a699b1c366463ef3a0d4b33658bb020 Mon Sep 17 00:00:00 2001 From: xiangzihao <460888207@qq.com> Date: Tue, 11 Jun 2024 13:46:21 +0800 Subject: [PATCH] improve e2e m1 chip local mode (#16130) Co-authored-by: Rick Cheng --- dolphinscheduler-e2e/README.md | 24 +++++++++++++++++++ .../e2e/core/DolphinSchedulerExtension.java | 9 +++---- dolphinscheduler-e2e/pom.xml | 4 ++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/dolphinscheduler-e2e/README.md b/dolphinscheduler-e2e/README.md index f2fbcead77..eb332de90e 100644 --- a/dolphinscheduler-e2e/README.md +++ b/dolphinscheduler-e2e/README.md @@ -97,3 +97,27 @@ class TenantE2ETest { - For UI tests, it's common that the pages might need some time to load, or the operations might need some time to complete, we can use `await().untilAsserted(() -> {})` to wait for the assertions. +## Local development + +### Mac M1 +Add VM options to the test configuration in IntelliJ IDEA: +``` +# In this mode you need to install docker desktop for mac and run it with locally +-Dm1_chip=true +``` + +### Running locally(without Docker) +``` +# In this mode you need to start frontend and backend services locally +-Dlocal=true +``` + +### Running locally(with Docker) +``` +# In this mode you only need to install docker locally +``` + +- To run the tests locally, you need to have the DolphinScheduler running locally. You should add `dolphinscheduler-e2e/pom.xml` to the maven project + Since it does not participate in project compilation, it is not in the main project. +- Running run test class `org.apache.dolphinscheduler.e2e.cases.UserE2ETest` in the IDE. After execution, the test video will be saved as mp4 in a local temporary directory. Such as + `/var/folders/hf/123/T/record-3123/PASSED-[engine:junit-jupiter]/[class:org.apache.dolphinscheduler.e2e.cases.UserE2ETest]-20240606-152333.mp4` diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java index 21c740952c..dcf22a2d6d 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java @@ -134,8 +134,8 @@ final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCall private void setBrowserContainerByOsName() { DockerImageName imageName; - if (LOCAL_MODE && M1_CHIP_FLAG) { - imageName = DockerImageName.parse("seleniarm/standalone-chromium:4.1.2-20220227") + if (M1_CHIP_FLAG) { + imageName = DockerImageName.parse("seleniarm/standalone-chromium:124.0-chromedriver-124.0") .asCompatibleSubstituteFor("selenium/standalone-chrome"); browser = new BrowserWebDriverContainer<>(imageName) @@ -143,6 +143,7 @@ final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCall .withCreateContainerCmdModifier(cmd -> cmd.withUser("root")) .withFileSystemBind(Constants.HOST_CHROME_DOWNLOAD_PATH.toFile().getAbsolutePath(), Constants.SELENIUM_CONTAINER_CHROME_DOWNLOAD_PATH) + .withRecordingMode(RECORD_ALL, record.toFile(), MP4) .withStartupTimeout(Duration.ofSeconds(300)); } else { browser = new BrowserWebDriverContainer<>() @@ -203,7 +204,7 @@ final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCall .map(URL::getPath) .map(File::new) .collect(Collectors.toList()); - + ComposeContainer compose = new ComposeContainer(files) .withPull(true) .withTailChildContainers(true) @@ -213,7 +214,7 @@ final class DolphinSchedulerExtension implements BeforeAllCallback, AfterAllCall DOCKER_PORT, Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(300))) .withLogConsumer(serviceName, outputFrame -> LOGGER.info(outputFrame.getUtf8String())) .waitingFor(serviceName, Wait.forHealthcheck().withStartupTimeout(Duration.ofSeconds(300))); - + return compose; } diff --git a/dolphinscheduler-e2e/pom.xml b/dolphinscheduler-e2e/pom.xml index c7ce90b1a6..6731240486 100644 --- a/dolphinscheduler-e2e/pom.xml +++ b/dolphinscheduler-e2e/pom.xml @@ -36,7 +36,7 @@ UTF-8 5.8.1 - 4.6.0 + 4.13.0 1.18.20 3.20.2 1.5.30 @@ -119,7 +119,7 @@ org.testcontainers testcontainers-bom - 1.19.3 + 1.19.8 import pom