Skip to content

Commit

Permalink
fix: CPIInstances test error
Browse files Browse the repository at this point in the history
  • Loading branch information
fuhouyu committed Nov 30, 2024
1 parent aa8e847 commit 6f5ca1c
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
import com.alibaba.nacos.api.naming.pojo.Instance;
import com.alibaba.nacos.api.naming.pojo.ListView;
import com.alibaba.nacos.common.utils.JacksonUtils;
import com.alibaba.nacos.core.service.NamespaceOperationService;
import com.alibaba.nacos.test.base.Params;
import com.fasterxml.jackson.databind.JsonNode;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.HttpMethod;
Expand All @@ -55,6 +57,9 @@ class CPInstancesAPI_ITCase extends NamingBase {

private NamingService naming2;

@Autowired
private NamespaceOperationService namespaceOperationService;

@LocalServerPort
private int port;

Expand All @@ -75,10 +80,16 @@ void setUp() throws Exception {
properties.put(PropertyKeyConst.SERVER_ADDR, "127.0.0.1" + ":" + port);
naming2 = NamingFactory.createNamingService(properties);
isNamingServerReady();

// creat namespace
this.namespaceOperationService.createNamespace(TEST_NAMESPACE_1, TEST_NAMESPACE_1, TEST_NAMESPACE_1);
this.namespaceOperationService.createNamespace(TEST_NAMESPACE_2, TEST_NAMESPACE_2, TEST_NAMESPACE_2);
}

@AfterEach
void cleanup() throws Exception {
this.namespaceOperationService.removeNamespace(TEST_NAMESPACE_1);
this.namespaceOperationService.removeNamespace(TEST_NAMESPACE_2);
}

/**
Expand Down

0 comments on commit 6f5ca1c

Please sign in to comment.