From 56c264d1fa640115197ed19bb8a68388c6fa3b95 Mon Sep 17 00:00:00 2001 From: Zhenxu Ke Date: Sat, 30 Jan 2021 11:46:05 +0800 Subject: [PATCH] test: fix flaky E2E test of Kafka (#6281) --- .github/workflows/e2e.kafka.yaml | 4 ++-- CHANGES.md | 1 + .../org/apache/skywalking/e2e/SkyWalkingAnnotations.java | 9 ++++++--- test/e2e/pom.xml | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e.kafka.yaml b/.github/workflows/e2e.kafka.yaml index 7a795352e..0cf63b68c 100644 --- a/.github/workflows/e2e.kafka.yaml +++ b/.github/workflows/e2e.kafka.yaml @@ -30,13 +30,13 @@ env: jobs: Kafka: - name: ${{ matrix.case.name }} + name: Kafka (${{ matrix.case.name }}) runs-on: ubuntu-latest timeout-minutes: 90 strategy: matrix: case: - - name: Kafka + - name: Base class: org.apache.skywalking.e2e.kafka.KafkaE2E - name: Profiling class: org.apache.skywalking.e2e.kafka.KafkaProfileE2E diff --git a/CHANGES.md b/CHANGES.md index 46dc3a0d1..1696a4e0f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,7 @@ Release Notes. * Add ElasticSearch 7.10 to test matrix and verify it works. * Replace Apache RAT with skywalking-eyes to check license headers. * Set up test of Envoy ALS / MetricsService under Istio 1.8.2 to verify Envoy V3 protocol +* Test: fix flaky E2E test of Kafka. #### Java Agent * The operation name of quartz-scheduler plugin, has been changed as the `quartz-scheduler/${className}` format. diff --git a/test/e2e/e2e-common/src/main/java/org/apache/skywalking/e2e/SkyWalkingAnnotations.java b/test/e2e/e2e-common/src/main/java/org/apache/skywalking/e2e/SkyWalkingAnnotations.java index 96817d8f5..e6ef236e0 100644 --- a/test/e2e/e2e-common/src/main/java/org/apache/skywalking/e2e/SkyWalkingAnnotations.java +++ b/test/e2e/e2e-common/src/main/java/org/apache/skywalking/e2e/SkyWalkingAnnotations.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.lang.reflect.Field; import java.nio.file.Path; import java.nio.file.Paths; +import java.time.Duration; import java.util.LinkedList; import java.util.List; import java.util.Objects; @@ -47,6 +48,7 @@ import org.testcontainers.containers.ContainerState; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.containers.wait.strategy.WaitStrategy; import static java.util.stream.Collectors.joining; import static org.apache.skywalking.e2e.utils.Yamls.load; @@ -226,17 +228,18 @@ public final class SkyWalkingAnnotations { "field cannot be annotated with both ContainerHost and ContainerPort: " + field.getName() ); } + final WaitStrategy waitStrategy = Wait.forListeningPort().withStartupTimeout(Duration.ofMinutes(5)); if (field.isAnnotationPresent(ContainerHost.class)) { final ContainerHost host = field.getAnnotation(ContainerHost.class); - compose.withExposedService(host.name(), host.port(), Wait.forListeningPort()); + compose.withExposedService(host.name(), host.port(), waitStrategy); } if (field.isAnnotationPresent(ContainerPort.class)) { final ContainerPort port = field.getAnnotation(ContainerPort.class); - compose.withExposedService(port.name(), port.port(), Wait.forListeningPort()); + compose.withExposedService(port.name(), port.port(), waitStrategy); } if (field.isAnnotationPresent(ContainerHostAndPort.class)) { final ContainerHostAndPort hostAndPort = field.getAnnotation(ContainerHostAndPort.class); - compose.withExposedService(hostAndPort.name(), hostAndPort.port(), Wait.forListeningPort()); + compose.withExposedService(hostAndPort.name(), hostAndPort.port(), waitStrategy); } } diff --git a/test/e2e/pom.xml b/test/e2e/pom.xml index 1e5288593..2e3ee235d 100644 --- a/test/e2e/pom.xml +++ b/test/e2e/pom.xml @@ -64,7 +64,7 @@ 3.8.0 3.1.0 - 1.15.0 + 1.15.1