Skip to content

MockClusterInvoker provides local forced mock,I tested it locally, but it doesn't work. #2489

@zonghaishang

Description

@zonghaishang
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.0
  • Operating System version: 2.7.0
  • Java version: 1.8

Steps to reproduce this issue

  1. Here is demo: Here is demo: https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-mock
  2. change consumer configuraton: <dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.samples.mock.api.DemoService" mock="force”/>

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

force mock should be trigged.

Actual Result

start failed.

I have checked code(MockClusterInvoker) :

@Override
public Result invoke(Invocation invocation) throws RpcException {
    // ….
    else if (value.startsWith("force")) {
        if (logger.isWarnEnabled()) {
            logger.info("force-mock: " + invocation.getMethodName() + " force-mock enabled , url : " + directory.getUrl());
        }
        //force:direct mock
        result = doMockInvoke(invocation, null);
    } 
       // ….
}

Metadata

Metadata

Assignees

Labels

type/bugBugs to being fixed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions