Skip to content

Commit

Permalink
[Fix-16228] Fix E2E health check url is not correct (apache#16227)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanwenjun authored Jun 27, 2024
1 parent 46eff34 commit 0e2d0fb
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ services:
dolphinscheduler:
image: apache/dolphinscheduler-standalone-server:ci
environment:
MASTER_MAX_CPU_LOAD_AVG: 100
WORKER_TENANT_AUTO_CREATE: 'true'
ports:
- "12345:12345"
networks:
network:
ipv4_address: 10.5.0.5
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 60s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ services:
dolphinscheduler:
image: apache/dolphinscheduler-standalone-server:ci
environment:
MASTER_MAX_CPU_LOAD_AVG: 100
WORKER_TENANT_AUTO_CREATE: 'true'
ports:
- "12345:12345"
networks:
- api-test
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 60s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ services:
dolphinscheduler:
image: apache/dolphinscheduler-standalone-server:ci
environment:
MASTER_MAX_CPU_LOAD_AVG: 100
WORKER_TENANT_AUTO_CREATE: 'true'
ports:
- "12345:12345"
networks:
- api-test
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 60s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ services:
dolphinscheduler:
image: apache/dolphinscheduler-standalone-server:ci
environment:
MASTER_MAX_CPU_LOAD_AVG: 100
WORKER_TENANT_AUTO_CREATE: 'true'
ports:
- "12345:12345"
Expand All @@ -31,7 +30,7 @@ services:
- ./download-mysql.sh:/tmp/download-mysql.sh
entrypoint: [ 'bash', '-c', '/bin/bash /tmp/download-mysql.sh && /opt/dolphinscheduler/bin/start.sh && tail -f /dev/null' ]
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 60s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ services:
dolphinscheduler:
image: apache/dolphinscheduler-standalone-server:ci
environment:
MASTER_MAX_CPU_LOAD_AVG: 100
WORKER_TENANT_AUTO_CREATE: 'true'
ports:
- "12345:12345"
networks:
- api-test
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 60s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ services:
dolphinscheduler:
image: apache/dolphinscheduler-standalone-server:ci
environment:
MASTER_MAX_CPU_LOAD_AVG: 100
WORKER_TENANT_AUTO_CREATE: 'true'
ports:
- "12345:12345"
networks:
- api-test
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 60s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ services:
dolphinscheduler:
image: apache/dolphinscheduler-standalone-server:ci
environment:
MASTER_MAX_CPU_LOAD_AVG: 100
WORKER_TENANT_AUTO_CREATE: 'true'
ports:
- "12345:12345"
networks:
- api-test
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 60s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
import java.time.Duration;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.slf4j.Logger;
import org.testcontainers.containers.ContainerState;
import org.testcontainers.containers.DockerComposeContainer;
import org.testcontainers.containers.wait.strategy.Wait;

Expand All @@ -49,6 +51,9 @@ public void beforeAll(ExtensionContext context) {
if (!localMode) {
compose = createDockerCompose(context);
compose.start();
compose.getContainerByServiceName(serviceName)
.map(ContainerState::isHealthy)
.orElseThrow(() -> new IllegalStateException("DolphinScheduler service is not healthy"));
}
}

Expand All @@ -63,17 +68,17 @@ private DockerComposeContainer<?> createDockerCompose(ExtensionContext context)
final Class<?> clazz = context.getRequiredTestClass();
final DolphinScheduler annotation = clazz.getAnnotation(DolphinScheduler.class);
final List<File> files = Stream.of(annotation.composeFiles())
.map(it -> DolphinScheduler.class.getClassLoader().getResource(it))
.filter(Objects::nonNull)
.map(URL::getPath)
.map(File::new)
.collect(Collectors.toList());
.map(it -> DolphinScheduler.class.getClassLoader().getResource(it))
.filter(Objects::nonNull)
.map(URL::getPath)
.map(File::new)
.collect(Collectors.toList());

compose = new DockerComposeContainer<>(files)
.withPull(true)
.withTailChildContainers(true)
.withLogConsumer(serviceName, outputFrame -> log.info(outputFrame.getUtf8String()))
.waitingFor(serviceName, Wait.forHealthcheck().withStartupTimeout(Duration.ofSeconds(Constants.DOCKER_COMPOSE_DEFAULT_TIMEOUT)));
.withPull(true)
.withTailChildContainers(true)
.withLogConsumer(serviceName, outputFrame -> log.info(outputFrame.getUtf8String()))
.waitingFor(serviceName, Wait.forHealthcheck().withStartupTimeout(Duration.ofSeconds(Constants.DOCKER_COMPOSE_DEFAULT_TIMEOUT)));

return compose;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.dolphinscheduler.dao.repository.impl;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;

import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
Expand All @@ -34,7 +33,6 @@
import org.apache.commons.lang3.RandomUtils;

import java.util.List;
import java.util.stream.Collectors;

import org.junit.jupiter.api.RepeatedTest;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -63,14 +61,6 @@ void fetchCommandByIdSlot() {
}

List<Command> commands = commandDao.queryCommandByIdSlot(currentSlotIndex, totalSlot, idStep, fetchSize);
assertFalse(commands.isEmpty(),
"Commands should not be empty, currentSlotIndex: " + currentSlotIndex +
", totalSlot: " + totalSlot +
", idStep: " + idStep +
", fetchSize: " + fetchSize +
", total command size: " + commandSize +
", total commands: "
+ commandDao.queryAll().stream().map(Command::getId).collect(Collectors.toList()));
assertThat(commands.size())
.isEqualTo(commandDao.queryAll()
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
networks:
- e2e
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 5s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
networks:
- e2e
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 5s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
networks:
- e2e
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 5s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
- ./download-mysql.sh:/tmp/download-mysql.sh
entrypoint: ['bash', '-c', '/bin/bash /tmp/download-mysql.sh && /opt/dolphinscheduler/bin/start.sh && tail -f /dev/null']
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 5s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ services:
networks:
- e2e
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 300s
timeout: 5s
retries: 120
depends_on:
postgres:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
networks:
- e2e
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 5s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
networks:
- e2e
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 5s
retries: 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
networks:
- e2e
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 5s
timeout: 5s
retries: 120
Expand Down

0 comments on commit 0e2d0fb

Please sign in to comment.