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

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

上级 1753e5e0
......@@ -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
......
......@@ -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.
......
......@@ -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);
}
}
......
......@@ -64,7 +64,7 @@
<maven-compiler-plugin.version>3.8.0</maven-compiler-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>
<repositories>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册