[
https://issues.apache.org/jira/browse/SCB-705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16527454#comment-16527454
]
ASF GitHub Bot commented on SCB-705:
------------------------------------
yhs0092 commented on a change in pull request #785: [SCB-705] consumer don't
cache ReferenceConfig of an unregistered provider
URL:
https://github.com/apache/incubator-servicecomb-java-chassis/pull/785#discussion_r199121183
##########
File path:
core/src/test/java/org/apache/servicecomb/core/provider/consumer/TestConsumerProviderManager.java
##########
@@ -96,4 +108,42 @@ public void createReferenceConfig_config() {
Assert.assertEquals("1.0.0+",
referenceConfig.getMicroserviceVersionRule().getVersionRule().getVersionRule());
Assert.assertEquals(Const.RESTFUL, referenceConfig.getTransport());
}
+
+ @Test
+ public void createReferenceConfig_ProviderNotFound() {
+ EventBus eventBus = new EventBus();
+ AppManager appManager = new AppManager(eventBus);
+
+ ConsumerProviderManager consumerProviderManager = new
ConsumerProviderManager();
+ consumerProviderManager.setAppManager(appManager);
+
+ new Expectations(RegistryUtils.class) {
+ {
+ RegistryUtils.findServiceInstances(anyString, anyString,
DefinitionConst.VERSION_RULE_ALL, null);
+ result = Collections.emptyList();
+ }
+ };
+
+ new MockUp<MicroserviceVersionRule>() {
+ @Mock
+ String getAppId() {
+ return "aId";
+ }
+
+ @Mock
+ String getMicroserviceName() {
+ return "ms";
+ }
+ };
+
+ try {
+ ReferenceConfig referenceConfig =
consumerProviderManager.createReferenceConfig("app:ms");
Review comment:
fixed, please review again.
----------------------------------------------------------------
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]
> When consumer invoke an unregistered provider, it will never find this
> provider even the provider is registered later
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: SCB-705
> URL: https://issues.apache.org/jira/browse/SCB-705
> Project: Apache ServiceComb
> Issue Type: Bug
> Components: Java-Chassis
> Reporter: YaoHaishi
> Assignee: YaoHaishi
> Priority: Major
>
> Before consumer invoke provider, it will create a ReferenceConfig for this
> provider. But when the provider is not registered, it will get a wrong
> ReferenceConfig and cache it, so it will never query the service-center again
> to get the provider microservice information, and an Exception is always
> thrown to say that the provider cannot be found.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)