carryxyh commented on a change in pull request #2024: Binding attachment before a clusterInvoker invoke. URL: https://github.com/apache/incubator-dubbo/pull/2024#discussion_r202256311
########## File path: dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/ForkingClusterInvokerTest.java ########## @@ -120,8 +122,32 @@ public void testInvokeExceptoin() { } } + @Test + public void testClearRpcContext() { + resetInvokerToException(); + ForkingClusterInvoker<ForkingClusterInvokerTest> invoker = new ForkingClusterInvoker<ForkingClusterInvokerTest>( + dic); + + String attachKey = "attach"; + String attachValue = "value"; + + RpcContext.getContext().setAttachment(attachKey, attachValue); + + Map<String, String> attachments = RpcContext.getContext().getAttachments(); + Assert.assertTrue("set attachment failed!", attachments != null && attachments.size() == 1); + try { + invoker.invoke(invocation); + Assert.fail(); + } catch (RpcException expected) { + Assert.assertTrue(expected.getMessage().contains("Failed to forking invoke provider")); + assertFalse(expected.getCause() instanceof RpcException); Review comment: Ok, will fix it soon. Change junit.framework.Assert to org.junit.Assert. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org