Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump version to 2.4.0 #96

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.ctrip.framework.apollo.monitor.internal.ApolloClientMonitorContext;
import com.ctrip.framework.apollo.monitor.internal.exporter.ApolloClientMetricsExporterFactory;
import com.ctrip.framework.apollo.util.ConfigUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand Down Expand Up @@ -49,6 +50,11 @@ public void setUp() {
resetConfigMonitorInitializer();
}

@After
public void tearDown() throws Exception {
MockInjector.reset();
}

@Test
public void testInitializeWhenMonitorEnabledAndNotInitialized() {
when(mockConfigUtil.isClientMonitorEnabled()).thenReturn(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.models.V1ConfigMap;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.test.util.ReflectionTestUtils;
Expand Down Expand Up @@ -81,6 +82,11 @@ public void setUp() {
k8sConfigMapConfigRepository = new K8sConfigMapConfigRepository(someAppId, someNamespace, upstreamRepo);
}

@After
public void tearDown() throws Exception {
MockInjector.reset();
}

/**
* 测试setConfigMapKey方法,当cluster和namespace都为正常值时
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import io.kubernetes.client.openapi.models.V1Pod;
import io.kubernetes.client.openapi.models.V1PodList;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
Expand Down Expand Up @@ -60,6 +61,11 @@ public void setUp() {
MockInjector.setInstance(CoreV1Api.class, coreV1Api);
}

@After
public void tearDown() throws Exception {
MockInjector.reset();
}

/**
* 测试 createConfigMap 成功创建配置
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.ctrip.framework.apollo.monitor.api.ApolloClientNamespaceMonitorApi;
import com.ctrip.framework.apollo.monitor.api.ApolloClientThreadPoolMonitorApi;
import com.ctrip.framework.apollo.monitor.internal.exporter.ApolloClientMetricsExporter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand Down Expand Up @@ -57,7 +58,11 @@ public void setUp(){
MockInjector.setInstance(ApolloClientMonitorContext.class, monitorContext);

configMonitor = new DefaultConfigMonitor();
}

@After
public void tearDown() throws Exception {
MockInjector.reset();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.ctrip.framework.apollo.monitor.internal.listener.ApolloClientMonitorEventListener;
import com.ctrip.framework.apollo.monitor.internal.ApolloClientMonitorContext;
import com.ctrip.framework.apollo.util.ConfigUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -47,6 +48,11 @@ public void setUp() {
ApolloClientMonitorEventPublisher.reset();
}

@After
public void tearDown() throws Exception {
MockInjector.reset();
}
nobodyiam marked this conversation as resolved.
Show resolved Hide resolved

@Test
public void testPublish_WhenClientMonitorEnabled_CollectorSupportsEvent() {
when(mockConfigUtil.isClientMonitorEnabled()).thenReturn(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.ctrip.framework.apollo.monitor.internal.exporter.impl.DefaultApolloClientMetricsExporterFactory;
import com.ctrip.framework.apollo.monitor.internal.listener.ApolloClientMonitorEventListener;
import com.ctrip.framework.apollo.util.ConfigUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand All @@ -48,6 +49,11 @@ public void setUp() {
factory = new DefaultApolloClientMetricsExporterFactory();
}

@After
public void tearDown() throws Exception {
MockInjector.reset();
}

@Test
public void testGetMetricsReporter_NoExternalSystemType() {
when(configUtil.getMonitorExternalType()).thenReturn(null);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</developers>

<properties>
<revision>2.4.0-SNAPSHOT</revision>
<revision>2.4.0</revision>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.7.18</spring-boot.version>
Expand Down