funky-eyes opened a new pull request, #8051:
URL: https://github.com/apache/incubator-seata/pull/8051
`ServerV1ToClientV2Test` could time out waiting for responses when earlier
tests left `transport.protocol=grpc` in shared configuration state. In that
condition, the V2 client in the compatibility suite could initialize with the
wrong transport and never receive the expected V1 server response.
- **Problem**
- The multi-version compatibility tests assume the Seata transport, but
they were reading process-wide configuration that could be mutated by earlier
gRPC-oriented tests.
- This made `doSendRegister()` fail intermittently with `Should receive
response within timeout`.
- **Change**
- Force `transport.protocol` to `seata` in `MultiVersionCompatibilityTest`
setup before creating the V2 client/server test fixtures.
- Capture the pre-existing `transport.protocol` value and restore it in
teardown so the test does not leak configuration changes into other suites.
- **Effect**
- `ServerV1ToClientV2Test` now runs against the intended transport
regardless of prior test ordering.
- The compatibility suite becomes self-contained instead of depending on
global configuration state left behind by other tests.
- **Implementation sketch**
```java
@BeforeEach
public void setUp() {
originalTransportProtocol =
ConfigurationFactory.getInstance().getConfig(ConfigurationKeys.TRANSPORT_PROTOCOL);
ConfigurationTestHelper.putConfig(ConfigurationKeys.TRANSPORT_PROTOCOL,
Protocol.SEATA.value);
// initialize test fixtures...
}
@AfterEach
public void tearDown() throws InterruptedException {
// shutdown fixtures...
if (StringUtils.isBlank(originalTransportProtocol)) {
ConfigurationTestHelper.removeConfig(ConfigurationKeys.TRANSPORT_PROTOCOL);
} else {
ConfigurationTestHelper.putConfig(ConfigurationKeys.TRANSPORT_PROTOCOL,
originalTransportProtocol);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]