未验证 提交 56c264d1 编写于 作者: Z Zhenxu Ke 提交者: GitHub

test: fix flaky E2E test of Kafka (#6281)

上级 1753e5e0
...@@ -30,13 +30,13 @@ env: ...@@ -30,13 +30,13 @@ env:
jobs: jobs:
Kafka: Kafka:
name: ${{ matrix.case.name }} name: Kafka (${{ matrix.case.name }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 90 timeout-minutes: 90
strategy: strategy:
matrix: matrix:
case: case:
- name: Kafka - name: Base
class: org.apache.skywalking.e2e.kafka.KafkaE2E class: org.apache.skywalking.e2e.kafka.KafkaE2E
- name: Profiling - name: Profiling
class: org.apache.skywalking.e2e.kafka.KafkaProfileE2E class: org.apache.skywalking.e2e.kafka.KafkaProfileE2E
......
...@@ -11,6 +11,7 @@ Release Notes. ...@@ -11,6 +11,7 @@ Release Notes.
* Add ElasticSearch 7.10 to test matrix and verify it works. * Add ElasticSearch 7.10 to test matrix and verify it works.
* Replace Apache RAT with skywalking-eyes to check license headers. * 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 * 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 #### Java Agent
* The operation name of quartz-scheduler plugin, has been changed as the `quartz-scheduler/${className}` format. * The operation name of quartz-scheduler plugin, has been changed as the `quartz-scheduler/${className}` format.
......
...@@ -25,6 +25,7 @@ import java.io.IOException; ...@@ -25,6 +25,7 @@ import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.time.Duration;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -47,6 +48,7 @@ import org.testcontainers.containers.ContainerState; ...@@ -47,6 +48,7 @@ import org.testcontainers.containers.ContainerState;
import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.DockerComposeContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitStrategy;
import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.joining;
import static org.apache.skywalking.e2e.utils.Yamls.load; import static org.apache.skywalking.e2e.utils.Yamls.load;
...@@ -226,17 +228,18 @@ public final class SkyWalkingAnnotations { ...@@ -226,17 +228,18 @@ public final class SkyWalkingAnnotations {
"field cannot be annotated with both ContainerHost and ContainerPort: " + field.getName() "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)) { if (field.isAnnotationPresent(ContainerHost.class)) {
final ContainerHost host = field.getAnnotation(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)) { if (field.isAnnotationPresent(ContainerPort.class)) {
final ContainerPort port = field.getAnnotation(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)) { if (field.isAnnotationPresent(ContainerHostAndPort.class)) {
final ContainerHostAndPort hostAndPort = field.getAnnotation(ContainerHostAndPort.class); final ContainerHostAndPort hostAndPort = field.getAnnotation(ContainerHostAndPort.class);
compose.withExposedService(hostAndPort.name(), hostAndPort.port(), Wait.forListeningPort()); compose.withExposedService(hostAndPort.name(), hostAndPort.port(), waitStrategy);
} }
} }
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version> <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version> <maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
<testcontainers.version>1.15.0</testcontainers.version> <testcontainers.version>1.15.1</testcontainers.version>
</properties> </properties>
<repositories> <repositories>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册