You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicecomb.apache.org by "Haishi Yao (Jira)" <ji...@apache.org> on 2019/10/10 06:49:00 UTC

[jira] [Commented] (SCB-1388) test on "handler-loadbalance" project,cannot all success

    [ https://issues.apache.org/jira/browse/SCB-1388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16948259#comment-16948259 ] 

Haishi Yao commented on SCB-1388:
---------------------------------

There is another kind of random UT failure in TestLoadBalanceHandler2, which is related to the accuracy error of System#sleep method. The pull request #1344 is appended to this issue to fix it.

> test on "handler-loadbalance" project,cannot all success
> --------------------------------------------------------
>
>                 Key: SCB-1388
>                 URL: https://issues.apache.org/jira/browse/SCB-1388
>             Project: Apache ServiceComb
>          Issue Type: Test
>          Components: Java-Chassis
>    Affects Versions: java-chassis-1.2.1
>         Environment: Eclipse Java EE IDE for Web Developers.
> Version: Oxygen.1a Release (4.7.1a)
> Build id: 20171005-1200
>            Reporter: litianpeng
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> when use junit test on the "handler-loadbalance" project,there will be something wrong in TestLoadBalanceHandler2.java.In TestLoadBalanceHandler2.java:
>  
> {code:java}
> //代码占位符
> @BeforeClass
> public static void beforeClass() {
> //prepare for defineEndpointAndHandle
>   ArchaiusUtils.setProperty("servicecomb.loadbalance.userDefinedEndpoint.enabled", "true");
> // avoid mock
> }
> {code}
> beforeclass,when only test on TestLoadBalanceHandler2.java,the property will set to be "true",and in LoadBalanceHandler:
>  
> {code:java}
> //代码占位符
> public static final boolean supportDefinedEndpoint =
> DynamicPropertyFactory.getInstance()
> .getBooleanProperty("servicecomb.loadbalance.userDefinedEndpoint.enabled", false).get();
> {code}
> the "supportDefinedEndpoint" will set to be "true".
>  
> However, when we test on the whole project,before test on "TestLoadBalanceHandler2", if it execute on "TestLoadBalanceHandler", in this class,it will init the LoadbalanceHandler, and the "supportDefinedEndpoint" will set to be "false" , because this attribute is a final static,after this, "supportDefinedEndpoint" will never set to be true, so then test on "TestLoadBalanceHandler2.testConfigEndpoint()":
> {code:java}
> //代码占位符
> invocation.addLocalContext("scb-endpoint", "rest://127.0.0.1:8080?sslEnabled=true&protocol=http2");
> try {
> handler.handle(invocation, asyncResp);
> } catch (Exception e) {
> }
> {code}
> the "invocation.getEndpoint().getEndpoint()" will not change to "rest://127.0.0.1:8080?sslEnabled=true&protocol=http2".
>  
> And when I use eclipse to execute the junit test,this will happen, and in intelj, it will not.But I think this should be update.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)