alibaba / alibaba/Sentinel

[bug] test case ParamFlowDefaultCheckerTest#testParamFlowDefaultCheckSingleValueCheckQpsMultipleThreads() assert error

Open
#2,426 5 comments 0 reactions 0 assignees View on GitHub
area/test good first issue
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

// 我看到社区大家都用中文,我也用中文好了

## Issue Description

单元测试运行失败,或许是测试用例逻辑错误,或许是代码被修改后逻辑不符合预期

### Describe what happened (or what feature you want)

我试着运行这个项目,但在check阶段出现了测试错误,或许是测试逻辑问题,或许是代码本身有bug

### How to reproduce it (as minimally and precisely as possible)

1.拉取master最新的代码

2. run :
`mvn clean install`

ParamFlowDefaultCheckerTest 状态为未通过

3. run :
`mvn test`

ParamFlowDefaultCheckerTest 状态为未通过

4.单独运行ParamFlowDefaultCheckerTest
方法testParamFlowDefaultCheckSingleValueCheckQpsMultipleThreads()断言失败

```
java.lang.AssertionError:
Expected :8
Actual :5

... ...
at com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowDefaultCheckerTest.testParamFlowDefaultCheckSingleValueCheckQpsMultipleThreads(ParamFlowDefaultCheckerTest.java:323)
... ...
```
5. 重复运行testParamFlowDefaultCheckSingleValueCheckQpsMultipleThreads()断言成功
6. 多次重复运行testParamFlowDefaultCheckSingleValueCheckQpsMultipleThreads()会出现断言失败
```
java.lang.AssertionError:
Expected :6
Actual :5

... ...
at com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowDefaultCheckerTest.testParamFlowDefaultCheckSingleValueCheckQpsMultipleThreads(ParamFlowDefaultCheckerTest.java:323)
... ...
```
多次运行的结果:会出现几率性运行成功,但大概率会失败
### Tell us your environment
oracle-jdk8 / master/ mac0s

使用oracle-jdk16 OccupiableBucketLeapArrayTest会实现失败,目前尚未确定是否是因为jdk版本缘故

### Anything else we need to know?

Contributor guide

Open the contributing guide

Research direction

Start with ParamFlowDefaultCheckerTest#testParamFlowDefaultCheckSingleValueCheckQpsMultipleThreads(), especially the assertion at line 323, and run the test repeatedly with mvn test. Compare the expected and actual results across repeated runs; done means the test behavior is deterministic and the intended assertion passes consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.