-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug]spi在单元测试中不能跨模块加载 #1689
Comments
举个例子描述下? |
比如说我在模块A使用了spi解析了模块B里实现了某个接口的类ClassA,这在正常的应用中是可以的,可是我在模块A的单元测试中,使用到了spi去解析ClassA却没有办法解析。比如:我们在sentinel-core里面去解析ClusterTokenClient.class(这个接口的实现类在sentinel-cluster-client-default)里面,如果是运行是没有问题的,但是这样的操作放在单元测试却不行,可以随便找个sentienl-core和sentinel-cluster-client-default里面的测试加入这行代码对比一下:
|
我们也可以在core里面测试使用entry = SphU.entry("cluster-resource2");这个操作并不会加载sentinel-extension里面的热点流控的slot,可以打印一下slot的轨迹看一下 |
你的意思就是ClusterTokenClient这个实现加载不到?我看了一下,slot的实现类可以加载到的(ProcessorSlot) |
你在core的单元测试里面能加载ClusterTokenClient? |
可能我不太会用这个spi,但确实存在我说的问题,比较迷的是在sentinel-param-flow-control-extension的单元测试能加载其他的slot。反过来core的单元测试却不能加载热点流控的slot |
我明白了是我的理解问题,感谢大家的帮助 |
你为什么要SPI加载一个接口 |
…kerStatsManager. (alibaba#2029)
Issue Description
Type: bug report or feature request
Describe what happened (or what feature you want)
只要不是在一个模块中的资源不能通过spi在单元测试中加载,就会让调用其他模块的spi的测试无法通过。会导致很多正常代码在单元测试中无法通过
Describe what you expected to happen
How to reproduce it (as minimally and precisely as possible)
Tell us your environment
Anything else we need to know?
The text was updated successfully, but these errors were encountered: