Kaiyao Ke created FLINK-35455:
---------------------------------
Summary: Non-idempotent unit tests
Key: FLINK-35455
URL: https://issues.apache.org/jira/browse/FLINK-35455
Project: Flink
Issue Type: Bug
Reporter: Kaiyao Ke
We found that several unit tests are non-idempotent, as they pass in the first
run but fail in the second run. These will not be triggered by the CI since
Surefire only executes a test once by default. A fix is necessary since unit
tests shall be self-contained, ensuring that the state of the system under test
is consistent at the beginning of each test. In practice, fixing non-idempotent
tests can help proactively avoid state pollution that results in test order
dependency (which could cause problems under test selection , prioritization or
parallelization).
An example of a non-idempotent test:
`SerializerConfigImplTest#testLoadingTypeInfoFactoriesFromSerializationConfig`
This test fails in repeated runs because a typeInfoFactory for type `class
org.apache.flink.api.common.serialization.SerializerConfigImplTest` is already
registered in the first test execution.
Reproduce (using the `NIOInspector` plugin because Surefire does not support
re-running a specific test twice without changing the source code):
```
cd flink-core
mvn edu.illinois:NIOInspector:rerun
-Dtest=org.apache.flink.api.common.serialization.SerializerConfigImplTest#testLoadingTypeInfoFactoriesFromSerializationConfig
```
Please kindly let us know if you find it necessary to resolve test
non-idempotency. We would open PRs to fix tests like this if so.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)