apache / paimon

Apache Paimon is a lake format that enables building a Realtime Lakehouse Architecture with Flink and Spark for both streaming and batch operations.
https://paimon.apache.org/
Apache License 2.0
2.29k stars 916 forks source link

[Bug] the UT of MySqlSyncDatabaseTableListITCase is not stable #1759

Closed wg1026688210 closed 1 year ago

wg1026688210 commented 1 year ago

Search before asking

Paimon version

branch :master

https://github.com/wg1026688210/incubator-paimon/actions/runs/5787149320/job/15683426163

Error: Failures: Error: MySqlSyncDatabaseTableListITCase.testActionRunResult:132 Expecting actual: ["shard_2_t3", "shard_2_t1", "shard_1_t2", "shard_2_t22", "shard_1_t3", "shard_2_tb", "shard_1_t11", "x_shard_1_t1", "shard_1_s2", "shard_1_taa"] to contain exactly in any order: ["shard_1_t11", "shard_1_t2", "shard_1_t3", "shard_1_taa", "shard_1_s2", "shard_2_t1", "shard_2_t22", "shard_2_t3", "shard_2_tb", "x_shard_1_t1", "shard_2_s3", "shard_3_tab"] but could not find the following elements: ["shard_2_s3", "shard_3_tab"]

Compute Engine

Flink

Minimal reproduce step

Executing this method MySqlSyncDatabaseTableListITCase.testActionRunResult multiple times or using @RepeatTest

What doesn't meet your expectations?

ut pass

Anything else?

No response

Are you willing to submit a PR?

yuzelin commented 1 year ago

Thanks for reporting. However, I don't think this test is unstable. Let me explain why it fails. The first test may write new table
into the MySQL database (see line 96), so the tests after will read the new tables and the check at line 82 will fail. A simple validation is changing startContainers into @BeforeEach and MySqlActionITCaseBase#stopContainers into @AfterEach, then the repeat tests will succeed because the mysql environment has been reset. But the test base is also used for other tests, and I think this is not a big problem, so it is not necessary to change it. WDYT?

wg1026688210 commented 1 year ago

hi~ @yuzelin The frequency of this error occurrence is quite high and
I tested it 5 times and encountered this issue twice. This may affect the unit tests of other pr. And are there any other reasons why this situation might occur? I only tested this method and encountered failures on the first attempt.

zhuangchong commented 1 year ago

related pr: #1752 1752