[
https://issues.apache.org/jira/browse/SCB-772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16554250#comment-16554250
]
ASF GitHub Bot commented on SCB-772:
------------------------------------
liubao68 closed pull request #835: [SCB-772]fix unit test fail on ubuntu for
unknown reasons
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/835
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/demo/demo-spring-boot-discovery/demo-spring-boot-discovery-client/src/test/resources/logback-test.xml
b/demo/demo-spring-boot-discovery/demo-spring-boot-discovery-client/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..3f394068d
--- /dev/null
+++
b/demo/demo-spring-boot-discovery/demo-spring-boot-discovery-client/src/test/resources/logback-test.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<configuration>
+ <include resource="org/springframework/boot/logging/logback/base.xml"/>
+ <logger name="org.springframework" level="ERROR"/>
+</configuration>
\ No newline at end of file
diff --git
a/demo/demo-spring-boot-discovery/demo-spring-boot-discovery-server/src/main/resources/logback-test.xml
b/demo/demo-spring-boot-discovery/demo-spring-boot-discovery-server/src/main/resources/logback-test.xml
new file mode 100644
index 000000000..3f394068d
--- /dev/null
+++
b/demo/demo-spring-boot-discovery/demo-spring-boot-discovery-server/src/main/resources/logback-test.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<configuration>
+ <include resource="org/springframework/boot/logging/logback/base.xml"/>
+ <logger name="org.springframework" level="ERROR"/>
+</configuration>
\ No newline at end of file
diff --git
a/demo/demo-spring-boot-discovery/demo-spring-boot-zuul-proxy/src/test/resources/logback-test.xml
b/demo/demo-spring-boot-discovery/demo-spring-boot-zuul-proxy/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..3f394068d
--- /dev/null
+++
b/demo/demo-spring-boot-discovery/demo-spring-boot-zuul-proxy/src/test/resources/logback-test.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<configuration>
+ <include resource="org/springframework/boot/logging/logback/base.xml"/>
+ <logger name="org.springframework" level="ERROR"/>
+</configuration>
\ No newline at end of file
diff --git
a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceHandler2.java
b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceHandler2.java
index 8a2916737..a0c3c1015 100644
---
a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceHandler2.java
+++
b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceHandler2.java
@@ -36,10 +36,7 @@
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
-
-import mockit.Expectations;
-import mockit.Injectable;
-import mockit.Mocked;
+import org.mockito.Mockito;
/**
*
@@ -50,16 +47,16 @@
@After
public void teardown() {
CseContext.getInstance().setTransportManager(null);
- RegistryUtils.setServiceRegistry(null);
ArchaiusUtils.resetConfig();
}
@Test
- public void testZoneAwareAndIsolationFilterWorks(@Injectable Invocation
invocation,
- @Mocked RegistryUtils registryUtils,
- @Injectable InstanceCacheManager instanceCacheManager, @Injectable
ServiceRegistry serviceRegistry,
- @Injectable TransportManager transportManager,
- @Injectable Transport transport) {
+ public void testZoneAwareAndIsolationFilterWorks() {
+ Invocation invocation = Mockito.mock(Invocation.class);
+ InstanceCacheManager instanceCacheManager =
Mockito.mock(InstanceCacheManager.class);
+ ServiceRegistry serviceRegistry = Mockito.mock(ServiceRegistry.class);
+ TransportManager transportManager = Mockito.mock(TransportManager.class);
+ Transport transport = Mockito.mock(Transport.class);
ArchaiusUtils.setProperty("servicecomb.loadbalance.filter.operation.enabled",
"false");
// set up data
@@ -107,28 +104,17 @@ public void
testZoneAwareAndIsolationFilterWorks(@Injectable Invocation invocati
DiscoveryTreeNode parent = new
DiscoveryTreeNode().name("parent").data(data);
CseContext.getInstance().setTransportManager(transportManager);
- new Expectations() {
- {
- invocation.getAppId();
- result = "testApp";
- invocation.getMicroserviceName();
- result = "testMicroserviceName";
- invocation.getMicroserviceVersionRule();
- result = "0.0.0+";
- invocation.getConfigTransportName();
- result = "rest";
- RegistryUtils.getMicroserviceInstance();
- result = myself;
- RegistryUtils.getServiceRegistry();
- result = serviceRegistry;
- serviceRegistry.getInstanceCacheManager();
- result = instanceCacheManager;
- instanceCacheManager.getOrCreateVersionedCache("testApp",
"testMicroserviceName", "0.0.0+");
- result = parent;
- transportManager.findTransport("rest");
- result = transport;
- }
- };
+ RegistryUtils.setServiceRegistry(serviceRegistry);
+
+ Mockito.when(invocation.getAppId()).thenReturn("testApp");
+
Mockito.when(invocation.getMicroserviceName()).thenReturn("testMicroserviceName");
+ Mockito.when(invocation.getMicroserviceVersionRule()).thenReturn("0.0.0+");
+ Mockito.when(invocation.getConfigTransportName()).thenReturn("rest");
+ Mockito.when(serviceRegistry.getMicroserviceInstance()).thenReturn(myself);
+
Mockito.when(serviceRegistry.getInstanceCacheManager()).thenReturn(instanceCacheManager);
+ Mockito.when(instanceCacheManager.getOrCreateVersionedCache("testApp",
"testMicroserviceName", "0.0.0+"))
+ .thenReturn(parent);
+ Mockito.when(transportManager.findTransport("rest")).thenReturn(transport);
LoadbalanceHandler handler = null;
LoadBalancer loadBalancer = null;
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Java Chassis::Handlers::Loadbalance test failed
> -----------------------------------------------
>
> Key: SCB-772
> URL: https://issues.apache.org/jira/browse/SCB-772
> Project: Apache ServiceComb
> Issue Type: Bug
> Components: Java-Chassis
> Affects Versions: java-chassis-1.0.0-m2
> Environment: JDK :
> java version "1.8.0_171"
> Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
> Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
> OS :
> Linux version 4.4.0-104-generic (buildd@lgw01-amd64-022) (gcc version 5.4.0
> 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5) ) #127-Ubuntu SMP Mon Dec 11
> 12:16:42 UTC 2017
> Reporter: yangyongzheng
> Assignee: yangyongzheng
> Priority: Critical
> Fix For: java-chassis-1.0.0
>
>
> Java Chassis::Handlers::Loadbalance test failed:
> 2018-07-24 09:45:08,429 [main ] ERROR ExceptionUtils -
> Exception: org.apache.servicecomb.core.exception.CseException; No available
> address found. microserviceName=ms, version=null, discoveryGroupName=null
> ServiceDefinitionException Code:servicecomb.lb.no.available.address,
> Message:No available address found. microserviceName=ms, version=null,
> discoveryGroupName=null
> at
> org.apache.servicecomb.core.exception.ExceptionUtils.createCseException(ExceptionUtils.java:57)
> at
> org.apache.servicecomb.core.exception.ExceptionUtils.lbAddressNotFound(ExceptionUtils.java:88)
> at
> org.apache.servicecomb.loadbalance.LoadbalanceHandler.send(LoadbalanceHandler.java:135)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at mockit.internal.util.MethodReflection.invoke(MethodReflection.java:120)
> at mockit.internal.util.MethodReflection.invoke(MethodReflection.java:185)
> at mockit.Deencapsulation.invoke(Deencapsulation.java:210)
> at
> org.apache.servicecomb.loadbalance.TestLoadbalanceHandler.send_noEndPoint(TestLoadbalanceHandler.java:195)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> at
> mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:162)
> at
> mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:71)
> at
> mockit.integration.junit4.internal.MockFrameworkMethod.invokeExplosively(MockFrameworkMethod.java:37)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
> at
> org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
> at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> at
> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
> at
> org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
> at
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
> at
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
> at
> org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
> at
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
> at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
> 2018-07-24 09:45:08,493 [main ] INFO DiscoveryTree - DiscoveryFilter
> org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter, enabled true.
> 2018-07-24 09:45:08,542 [main ] INFO DiscoveryTree - DiscoveryFilter
> org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter, enabled true.
> 2018-07-24 09:45:08,581 [main ] WARN URLConfigurationSource - No URLs will be
> polled as dynamic configuration sources.
> 2018-07-24 09:45:08,581 [main ] INFO URLConfigurationSource - To enable URLs
> as dynamic configuration sources, define System property
> archaius.configurationSource.additionalUrls or make config.properties
> available on classpath.
> 2018-07-24 09:45:08,582 [main ] INFO DynamicPropertyFactory -
> DynamicPropertyFactory is initialized with configuration sources:
> com.netflix.config.ConcurrentCompositeConfiguration@7e094740
> 2018-07-24 09:45:08,655 [main ] INFO DiscoveryTree - DiscoveryFilter
> org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter, enabled true.
> 2018-07-24 09:45:08,671 [main ] WARN URLConfigurationSource - No URLs will be
> polled as dynamic configuration sources.
> 2018-07-24 09:45:08,671 [main ] INFO URLConfigurationSource - To enable URLs
> as dynamic configuration sources, define System property
> archaius.configurationSource.additionalUrls or make config.properties
> available on classpath.
> 2018-07-24 09:45:08,671 [main ] INFO DynamicPropertyFactory -
> DynamicPropertyFactory is initialized with configuration sources:
> com.netflix.config.ConcurrentCompositeConfiguration@52d10fb8
> 2018-07-24 09:45:08,774 [main ] INFO DiscoveryTree - DiscoveryFilter
> org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter, enabled true.
> 2018-07-24 09:45:08,815 [main ] WARN URLConfigurationSource - No URLs will be
> polled as dynamic configuration sources.
> 2018-07-24 09:45:08,815 [main ] INFO URLConfigurationSource - To enable URLs
> as dynamic configuration sources, define System property
> archaius.configurationSource.additionalUrls or make config.properties
> available on classpath.
> 2018-07-24 09:45:08,815 [main ] INFO DynamicPropertyFactory -
> DynamicPropertyFactory is initialized with configuration sources:
> com.netflix.config.ConcurrentCompositeConfiguration@a8a8b75
> 2018-07-24 09:45:08,888 [main ] INFO DiscoveryTree - DiscoveryFilter
> org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter, enabled true.
> 2018-07-24 09:45:08,938 [main ] INFO DiscoveryTree - DiscoveryFilter
> org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter, enabled true.
> 2018-07-24 09:45:08,939 [main ] INFO DiscoveryTree - DiscoveryFilter
> org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter, enabled true.
> 2018-07-24 09:45:08,964 [main ] WARN URLConfigurationSource - No URLs will be
> polled as dynamic configuration sources.
> 2018-07-24 09:45:08,964 [main ] INFO URLConfigurationSource - To enable URLs
> as dynamic configuration sources, define System property
> archaius.configurationSource.additionalUrls or make config.properties
> available on classpath.
> 2018-07-24 09:45:08,964 [main ] INFO DynamicPropertyFactory -
> DynamicPropertyFactory is initialized with configuration sources:
> com.netflix.config.ConcurrentCompositeConfiguration@ddf20fd
> 2018-07-24 09:45:08,968 [main ] INFO ExtensionsManager - Using load balance
> rule com.netflix.loadbalancer.RoundRobinRule for microservice ms.
> 2018-07-24 09:45:08,970 [main ] INFO SPIServiceUtils - Found SPI service
> org.apache.servicecomb.loadbalance.ServerListFilterExt, count=0.
> 2018-07-24 09:45:09,033 [main ] INFO DiscoveryTree - DiscoveryFilter
> org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter, enabled true.
> Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.929 sec -
> in org.apache.servicecomb.loadbalance.TestLoadbalanceHandler
> Running org.apache.servicecomb.loadbalance.TestLoadBalanceHandler2
> 2018-07-24 09:45:09,145 [main ] WARN URLConfigurationSource - No URLs will be
> polled as dynamic configuration sources.
> 2018-07-24 09:45:09,146 [main ] INFO URLConfigurationSource - To enable URLs
> as dynamic configuration sources, define System property
> archaius.configurationSource.additionalUrls or make config.properties
> available on classpath.
> 2018-07-24 09:45:09,146 [main ] INFO DynamicPropertyFactory -
> DynamicPropertyFactory is initialized with configuration sources:
> com.netflix.config.ConcurrentCompositeConfiguration@7d37f1c
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.177 sec <<<
> FAILURE! - in org.apache.servicecomb.loadbalance.TestLoadBalanceHandler2
> testZoneAwareAndIsolationFilterWorks(org.apache.servicecomb.loadbalance.TestLoadBalanceHandler2)
> Time elapsed: 0.124 sec <<< ERROR!
> java.lang.NullPointerException
> at
> org.apache.servicecomb.loadbalance.TestLoadBalanceHandler2.testZoneAwareAndIsolationFilterWorks(TestLoadBalanceHandler2.java:110)
> 2018-07-24 09:45:09,223 [Thread-6 ] INFO WeightedResponseTimeRule - Stopping
> NFLoadBalancer-serverWeightTimer-unknown
> 2018-07-24 09:45:09,223 [Thread-4 ] INFO WeightedResponseTimeRule - Stopping
> NFLoadBalancer-serverWeightTimer-unknown
> 2018-07-24 09:45:09,223 [Thread-2 ] INFO WeightedResponseTimeRule - Stopping
> NFLoadBalancer-serverWeightTimer-unknown
> XXXTTTTT120
> XXXTTTTT120
> XXXTTTTT120
> XXXTTTTT120
> 2018-07-24 09:45:18,216 [ancerStatsTimer] INFO ServiceCombLoadBalancerStats -
> ping mark server instance2 failure.
> 2018-07-24 09:45:18,216 [ancerStatsTimer] INFO ServiceCombLoadBalancerStats -
> ping mark server instance1 failure.
> XXXTTTTT121
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10.064 sec -
> in org.apache.servicecomb.loadbalance.TestServiceCombLoadBalancerStats
> Results :
> Tests in error:
> TestLoadBalanceHandler2.testZoneAwareAndIsolationFilterWorks:110 »
> NullPointer
> Tests run: 55, Failures: 0, Errors: 1, Skipped: 0
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)