dianping / cat

CAT 作为服务端项目基础组件,提供了 Java, C/C++, Node.js, Python, Go 等多语言客户端,已经在美团点评的基础架构中间件框架(MVC框架,RPC框架,数据库框架,缓存框架等,消息队列,配置系统等)深度集成,为美团点评各业务线提供系统丰富的性能指标、健康状况、实时告警等。
Apache License 2.0
18.72k stars 5.43k forks source link

Fixing a failure seen in `MessageIdFactoryTest.java` #2323

Open krishnanand5 opened 1 year ago

krishnanand5 commented 1 year ago

In MessageIdFactoryTest.java, the following test has been found to be flaky:

REASON FOR FLAKINESS:

DETECTING THE FLAKINESS:

I used the NonDex tool to verify the flakiness in both the mentioned tests. The steps that can be used to verify the same are as follows:

  1. git clone https://github.com/dianping/cat.
  2. mvn -pl cat-client install.
  3. mvn -pl cat-client edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=com.dianping.cat.message.context.MessageIdFactoryTest#testGivenDomainInParallel.

After executing these steps, the following error will be hit:

 T E S T S
-------------------------------------------------------
Concurrency config is parallel='none', perCoreThreadCount=true, threadCount=2, useUnlimitedThreads=false
Running com.dianping.cat.message.context.MessageIdFactoryTest
Tests run: 6, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: -289,157.592 sec <<< FAILURE!

Results :

Failed tests:   testDefaultDomainInParallel(com.dianping.cat.message.context.MessageIdFactoryTest): Not all threads completed in time. expected:<123400> but was:<38720>
  testGivenDomainInParallel(com.dianping.cat.message.context.MessageIdFactoryTest): Not all threads completed in time. expected:<123400> but was:<29820>

Tests run: 6, Failures: 2, Errors: 0, Skipped: 0

PROPOSED SOLUTION: