This is an automated email from the ASF dual-hosted git repository.
maobaolong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new a15751b59 [MINOR] fix(test): Fix flaky test for
CoordinatorGrpcServerTest#testGrpcConnectionSize (#2323)
a15751b59 is described below
commit a15751b59da2496934e64efb5790a4db7e1856a0
Author: maobaolong <[email protected]>
AuthorDate: Wed Jan 8 09:42:59 2025 +0800
[MINOR] fix(test): Fix flaky test for
CoordinatorGrpcServerTest#testGrpcConnectionSize (#2323)
### What changes were proposed in this pull request?
Fix flaky test for CoordinatorGrpcServerTest#testGrpcConnectionSize
### Why are the changes needed?
Do some efforts to make Ci more stable.
### Does this PR introduce _any_ user-facing change?
NO
### How was this patch tested?
Existing UTs.
---
.../uniffle/test/CoordinatorGrpcServerTest.java | 44 ++++++++++++----------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/CoordinatorGrpcServerTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/CoordinatorGrpcServerTest.java
index 242004553..cc75624b8 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/CoordinatorGrpcServerTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/CoordinatorGrpcServerTest.java
@@ -69,30 +69,34 @@ public class CoordinatorGrpcServerTest {
.grpcMetrics(grpcMetrics)
.addService(new MockedCoordinatorGrpcService())
.build();
- grpcServer.start();
+ try {
+ grpcServer.start();
- // case1: test the single one connection metric
- double connSize =
grpcMetrics.getGaugeMap().get(GRPC_SERVER_CONNECTION_NUMBER_KEY).get();
- assertEquals(0, connSize);
+ // case1: test the single one connection metric
+ double connSize =
grpcMetrics.getGaugeMap().get(GRPC_SERVER_CONNECTION_NUMBER_KEY).get();
+ assertEquals(0, connSize);
- CoordinatorGrpcClient coordinatorGrpcClient = new
CoordinatorGrpcClient("localhost", 20001);
- coordinatorGrpcClient.registerApplicationInfo(
- new RssApplicationInfoRequest("testGrpcConnectionSize", 10000,
"user"));
+ // case2: test the multiple connections
+ try (CoordinatorGrpcClient coordinatorGrpcClient =
+ new CoordinatorGrpcClient("localhost", 20001);
+ CoordinatorGrpcClient client1 = new
CoordinatorGrpcClient("localhost", 20001);
+ CoordinatorGrpcClient client2 = new
CoordinatorGrpcClient("localhost", 20001)) {
+ coordinatorGrpcClient.registerApplicationInfo(
+ new RssApplicationInfoRequest("testGrpcConnectionSize", 10000,
"user"));
- connSize =
grpcMetrics.getGaugeMap().get(GRPC_SERVER_CONNECTION_NUMBER_KEY).get();
- assertEquals(1, connSize);
+ connSize =
grpcMetrics.getGaugeMap().get(GRPC_SERVER_CONNECTION_NUMBER_KEY).get();
+ assertEquals(1, connSize);
- // case2: test the multiple connections
- CoordinatorGrpcClient client1 = new CoordinatorGrpcClient("localhost",
20001);
- CoordinatorGrpcClient client2 = new CoordinatorGrpcClient("localhost",
20001);
- client1.registerApplicationInfo(
- new RssApplicationInfoRequest("testGrpcConnectionSize", 10000,
"user"));
- client2.registerApplicationInfo(
- new RssApplicationInfoRequest("testGrpcConnectionSize", 10000,
"user"));
+ client1.registerApplicationInfo(
+ new RssApplicationInfoRequest("testGrpcConnectionSize", 10000,
"user"));
+ client2.registerApplicationInfo(
+ new RssApplicationInfoRequest("testGrpcConnectionSize", 10000,
"user"));
- connSize =
grpcMetrics.getGaugeMap().get(GRPC_SERVER_CONNECTION_NUMBER_KEY).get();
- assertEquals(3, connSize);
-
- grpcServer.stop();
+ connSize =
grpcMetrics.getGaugeMap().get(GRPC_SERVER_CONNECTION_NUMBER_KEY).get();
+ assertEquals(3, connSize);
+ }
+ } finally {
+ grpcServer.stop();
+ }
}
}