[FlakyTest]Try to fix flaky test ReplicatorTest.testReplicatorOnPartitionedTopic.#9659
Conversation
Try to make the test stable by append System.nanoTime to namespace it creates to avoid "Namespace already exists" exception.
eolivelli
left a comment
There was a problem hiding this comment.
Usually that error is due to the test retry policy and it hides the real error.
This fix cannot be enough to fix the flakyness.
Do you have the real error in the test? That is the logs of the first run that failed?
@eolivelli Sample stack trace is Make the namespace name unique for different execution/retry should able to get rid of this exception. |
eolivelli
left a comment
There was a problem hiding this comment.
I believe that if we want to go this way we should have a more consistent way of generating unique topic names.
Can we create a general purpose function that creates an unique topic name? IIRC there is something like that somewhere else is some suite
| log.info("--- Starting ReplicatorTest::{} --- ", methodName); | ||
|
|
||
| final String namespace = "pulsar/partitionedNs-" + isPartitionedTopic; | ||
| final String namespace = "pulsar/partitionedNs-" + isPartitionedTopic + "-" + System.nanoTime();; |
There was a problem hiding this comment.
1)I searched the code, but I didn’t see a namespace with the same name in other places
2)There are two ";"
There was a problem hiding this comment.
fixed the duplicate ";"
It could be namespace left from other test run, the zookeeper used for test will have a temp dir to store data with same name. It could be really hard to debug in github action VM but make namespace unique across different test run should solve the issue for us.
|
We could use something like making it a |
|
@eolivelli Updated per you comment. |
eolivelli
left a comment
There was a problem hiding this comment.
What about using the new method in BrokerTestBase, or better to remove the newTopicName in BrokerTestBase ?
pulsar-broker/src/test/java/org/apache/pulsar/broker/BrokerTestUtil.java
Outdated
Show resolved
Hide resolved
…o in ReplicatorTest to use BrokerTestUtil.newUniqueName.
|
/pulsarbot run-failure-checks |
2 similar comments
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
…tionedTopic. (apache#9659) Fixes apache#9457 Not sure why state is not cleaned up but exception is indicating metadata of namespace the test trying to create already exist so use a different namespace name for different test run should able to fix it. Append System.nanoTime to the namespace used to avoid being affect by previous state. This seems working fine for other test cases in the same test. (cherry picked from commit 738ec6a)
Fixes #9457
Motivation
Not sure why state is not cleaned up but exception is indicating metadata of namespace the test trying to create already exist so use a different namespace name for different test run should able to fix it.
Modifications
Append System.nanoTime to the namespace used to avoid being affect by previous state. This seems working fine for other test cases in the same test.