Skip to content

Commit 61f4c9b

Browse files
authored
V3.0 develop fix test (#13197)
* Fix Class case exception during publish config. * Fix metrics controller unit test.
1 parent c1bce61 commit 61f4c9b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

config/src/main/java/com/alibaba/nacos/config/server/model/form/ConfigFormV3.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ public void setGroupName(String groupName) {
4040
this.groupName = groupName;
4141
}
4242

43-
@Override
44-
public ConfigFormV3 clone() {
45-
ConfigFormV3 configFormV3 = (ConfigFormV3) super.clone();
46-
configFormV3.setGroupName(groupName);
47-
return configFormV3;
48-
}
49-
5043
@Override
5144
public void validate() throws NacosApiException {
5245
if (StringUtils.isBlank(groupName)) {

config/src/test/java/com/alibaba/nacos/config/server/controller/v3/MetricControllerV3Test.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.alibaba.nacos.core.remote.ConnectionManager;
2727
import com.alibaba.nacos.sys.env.EnvUtil;
2828
import jakarta.servlet.ServletContext;
29+
import org.junit.jupiter.api.AfterEach;
2930
import org.junit.jupiter.api.BeforeEach;
3031
import org.junit.jupiter.api.Test;
3132
import org.junit.jupiter.api.extension.ExtendWith;
@@ -76,13 +77,19 @@ class MetricControllerV3Test {
7677

7778
@BeforeEach
7879
void setUp() {
80+
System.setProperty("nacos.core.auth.admin.enabled", "false");
7981
EnvUtil.setEnvironment(new StandardEnvironment());
8082
when(servletContext.getContextPath()).thenReturn("/nacos");
8183
ReflectionTestUtils.setField(metricsControllerV3, "serverMemberManager", memberManager);
8284
ReflectionTestUtils.setField(metricsControllerV3, "connectionManager", connectionManager);
8385
mockMvc = MockMvcBuilders.standaloneSetup(metricsControllerV3).build();
8486
}
8587

88+
@AfterEach
89+
void tearDown() {
90+
System.clearProperty("nacos.core.auth.admin.enabled");
91+
}
92+
8693
@Test
8794
void testGetClusterMetric() throws Exception {
8895
List<Member> members = new ArrayList<>();

0 commit comments

Comments
 (0)