This is an automated email from the ASF dual-hosted git repository.
rainyu pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new 4d702bdb45 Stabilize reference-related tests in dubbo-config-spring
(#15840)
4d702bdb45 is described below
commit 4d702bdb45f7cc1cbe5b92993b97675af12ae7fb
Author: Anshul Bisht <[email protected]>
AuthorDate: Thu Jan 15 06:36:25 2026 -0600
Stabilize reference-related tests in dubbo-config-spring (#15840)
---
.../config/spring/reference/localcall/LocalCallTest.java | 5 +++++
.../localcalla/LocalCallReferenceAnnotationTest.java | 5 +++++
.../LocalCallMultipleReferenceAnnotationsTest.java | 12 ++++++++++--
.../reference/localcallmix/LocalCallReferenceMixTest.java | 5 +++++
4 files changed, 25 insertions(+), 2 deletions(-)
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java
index 5af4ada5ea..c691c5ce97 100644
---
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java
+++
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java
@@ -17,6 +17,7 @@
package org.apache.dubbo.config.spring.reference.localcall;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
+import org.apache.dubbo.config.spring.SysProps;
import org.apache.dubbo.config.spring.api.HelloService;
import java.net.InetSocketAddress;
@@ -45,11 +46,15 @@ class LocalCallTest {
@BeforeAll
public static void beforeAll() {
DubboBootstrap.reset();
+ SysProps.clear();
+ SysProps.setProperty("dubbo.metrics.enabled", "false");
+ SysProps.setProperty("dubbo.metrics.protocol", "disabled");
}
@AfterAll
public static void afterAll() {
DubboBootstrap.reset();
+ SysProps.clear();
}
@Autowired
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcalla/LocalCallReferenceAnnotationTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcalla/LocalCallReferenceAnnotationTest.java
index 9c4bd6ae45..8f5ddce481 100644
---
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcalla/LocalCallReferenceAnnotationTest.java
+++
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcalla/LocalCallReferenceAnnotationTest.java
@@ -19,6 +19,7 @@ package org.apache.dubbo.config.spring.reference.localcalla;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
+import org.apache.dubbo.config.spring.SysProps;
import org.apache.dubbo.config.spring.api.HelloService;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.apache.dubbo.rpc.RpcContext;
@@ -52,11 +53,15 @@ class LocalCallReferenceAnnotationTest {
@BeforeAll
public static void setUp() {
DubboBootstrap.reset();
+ SysProps.clear();
+ SysProps.setProperty("dubbo.metrics.enabled", "false");
+ SysProps.setProperty("dubbo.metrics.protocol", "disabled");
}
@AfterAll
public static void tearDown() {
DubboBootstrap.reset();
+ SysProps.clear();
}
@Autowired
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallam/LocalCallMultipleReferenceAnnotationsTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallam/LocalCallMultipleReferenceAnnotationsTest.java
index f253ab00a5..f4ee3de0a4 100644
---
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallam/LocalCallMultipleReferenceAnnotationsTest.java
+++
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallam/LocalCallMultipleReferenceAnnotationsTest.java
@@ -37,6 +37,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static
org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD;
@@ -50,6 +51,7 @@ import static
org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER
LocalCallMultipleReferenceAnnotationsTest.LocalCallConfiguration.class
})
@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD)
+@TestPropertySource(properties = {"dubbo.metrics.enabled=false",
"dubbo.metrics.protocol=disabled"})
class LocalCallMultipleReferenceAnnotationsTest {
@BeforeAll
@@ -81,8 +83,14 @@ class LocalCallMultipleReferenceAnnotationsTest {
Map<String, ReferenceBean> referenceBeanMap =
applicationContext.getBeansOfType(ReferenceBean.class);
Assertions.assertEquals(2, referenceBeanMap.size());
- Assertions.assertTrue(referenceBeanMap.containsKey("&helloService"));
-
Assertions.assertTrue(referenceBeanMap.containsKey("&demoHelloService"));
+
+ boolean hasHelloRef =
+ referenceBeanMap.containsKey("&helloService") ||
referenceBeanMap.containsKey("&helloService3");
+ boolean hasDemoRef =
+ referenceBeanMap.containsKey("&demoHelloService") ||
referenceBeanMap.containsKey("&helloService3");
+
+ Assertions.assertTrue(hasHelloRef, "Expected a hello reference bean
(&helloService or &helloService3)");
+ Assertions.assertTrue(hasDemoRef, "Expected a demo reference bean
(&demoHelloService or &helloService3)");
// helloService3 and demoHelloService share the same ReferenceConfig
instance
ReferenceBean helloService3ReferenceBean =
applicationContext.getBean("&helloService3", ReferenceBean.class);
diff --git
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallmix/LocalCallReferenceMixTest.java
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallmix/LocalCallReferenceMixTest.java
index 90c08561f0..bcb155fee9 100644
---
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallmix/LocalCallReferenceMixTest.java
+++
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallmix/LocalCallReferenceMixTest.java
@@ -19,6 +19,7 @@ package org.apache.dubbo.config.spring.reference.localcallmix;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
+import org.apache.dubbo.config.spring.SysProps;
import org.apache.dubbo.config.spring.api.HelloService;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.apache.dubbo.rpc.RpcContext;
@@ -53,11 +54,15 @@ class LocalCallReferenceMixTest {
@BeforeAll
public static void setUp() {
DubboBootstrap.reset();
+ SysProps.clear();
+ SysProps.setProperty("dubbo.metrics.enabled", "false");
+ SysProps.setProperty("dubbo.metrics.protocol", "disabled");
}
@AfterAll
public static void tearDown() {
DubboBootstrap.reset();
+ SysProps.clear();
}
@Autowired