Skip to content

Conversation

@YongGoose
Copy link
Member

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@YongGoose YongGoose changed the title bug-fix: Add common test config for dynamic server port assignment in tests [WIP] Add common test config for dynamic server port assignment in tests Jun 12, 2025
@YongGoose YongGoose force-pushed the hot-fix/port-binding-issue branch from 6dc179a to c46d7db Compare June 12, 2025 14:54
@YongGoose YongGoose changed the title [WIP] Add common test config for dynamic server port assignment in tests test: Add common test config for dynamic server port assignment in tests Jun 12, 2025
Signed-off-by: yongjunhong <[email protected]>
@YongGoose YongGoose force-pushed the hot-fix/port-binding-issue branch from 4f24cf4 to 8660d13 Compare June 12, 2025 14:56
Signed-off-by: yongjunhong <[email protected]>
Signed-off-by: yongjunhong <[email protected]>
@YongGoose YongGoose force-pushed the hot-fix/port-binding-issue branch from 1a0bee0 to 76b4d2b Compare June 12, 2025 15:26
Signed-off-by: yongjunhong <[email protected]>
Signed-off-by: yongjunhong <[email protected]>
@codecov
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.32%. Comparing base (bd717a6) to head (7b082d1).
Report is 2 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7435      +/-   ##
============================================
- Coverage     58.62%   58.32%   -0.30%     
- Complexity      571      575       +4     
============================================
  Files          1269     1269              
  Lines         45730    45774      +44     
  Branches       5548     5555       +7     
============================================
- Hits          26807    26698     -109     
- Misses        16344    16508     +164     
+ Partials       2579     2568      -11     

see 44 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: yongjunhong <[email protected]>
Signed-off-by: yongjunhong <[email protected]>
@funky-eyes funky-eyes requested a review from Copilot June 13, 2025 07:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a common test configuration enabling dynamic server port assignment in tests, ensuring that tests run on available ports instead of hard-coded ones. The key changes include:

  • Incorporation of a new DynamicPortTestConfig class to dynamically allocate ports.
  • Updates across multiple test files to import and use the DynamicPortTestConfig via @import annotations.

Reviewed Changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated no comments.

Show a summary per file
File Description
server/src/test/java/org/apache/seata/server/raft/execute/GlobalSessionExecuteTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/raft/execute/BranchSessionExecuteTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/raft/RaftSyncMessageTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/logging/AppenderTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/lock/redis/RedisLuaLockManagerTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/lock/redis/RedisLockManagerTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/lock/file/FileLockManagerImplTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/lock/db/DataBaseLockStoreDAOTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/lock/db/DataBaseLockManagerImplTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/lock/LockManagerTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/lock/DistributedLockerFactoryTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/event/DefaultCoreForEventBusTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/coordinator/DefaultCoreTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/coordinator/DefaultCoordinatorTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/controller/VGroupMappingControllerTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/controller/ClusterControllerTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration; also commented out the TestPropertySource annotation.
server/src/test/java/org/apache/seata/server/ParameterParserTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/LoaderConfTest.java Added import and @import(DynamicPortTestConfig.class) for dynamic port configuration.
server/src/test/java/org/apache/seata/server/DynamicPortTestConfig.java New file providing dynamic port assignment for tests.

@funky-eyes funky-eyes added this to the 2.5.0 milestone Jun 13, 2025
@funky-eyes funky-eyes added module/server server module type: test test case labels Jun 13, 2025
Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: yongjunhong <[email protected]>
@YongGoose
Copy link
Member Author

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2192)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2225)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2024)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:779)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
	at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1703)
	at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1801)
	at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2946)
Caused by: java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)
	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:578)
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:628)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
	at java.base/java.net.Socket.connect(Socket.java:759)
	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
	... 14 common frames omitted
 <==

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes merged commit 16be18e into apache:2.x Jun 13, 2025
9 checks passed
slievrly pushed a commit to slievrly/fescar that referenced this pull request Oct 21, 2025
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module/server server module type: test test case

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants