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

fix:修复路由规则针对老SDK的不兼容下发问题 #1362

Merged
merged 21 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d7b6525
docs:add error code desc
chuntaojun Sep 25, 2022
c3a525c
fix:调整license-checker的触发
chuntaojun Oct 19, 2022
4e51fb9
fix:调整license-checker的触发
chuntaojun Oct 19, 2022
9a87cc3
hotfix:修复鉴权interceptor遗漏请求来源
chuntaojun Jun 27, 2023
f764f02
feat:support nacos-address server endpoints
chuntaojun Jun 28, 2024
eee1a65
feat:support nacos-address server endpoints
chuntaojun Jun 28, 2024
c416eab
feat:support nacos-address server endpoints
chuntaojun Jun 29, 2024
408b88f
feat:support nacos-address server endpoints
chuntaojun Jun 29, 2024
cca9e55
feat:support nacos-address server endpoints
chuntaojun Jun 29, 2024
b61c89d
feat:support nacos-address server endpoints
chuntaojun Jun 29, 2024
8d9b417
feat:support nacos-address server endpoints
chuntaojun Jun 29, 2024
3ff7b93
feat:support nacos-address server endpoints
chuntaojun Jun 29, 2024
0565bfe
feat:support nacos-address server endpoints
chuntaojun Jun 30, 2024
587ba44
feat:support nacos-address server endpoints
chuntaojun Jun 30, 2024
4a6d793
feat:support nacos-address server endpoints
chuntaojun Jun 30, 2024
ceaf3c0
feat:support nacos-address server endpoints
chuntaojun Jun 30, 2024
df14a59
feat:support nacos-address server endpoints
chuntaojun Jun 30, 2024
6fbcd1f
feat:support nacos-address server endpoints
chuntaojun Jun 30, 2024
fc5468c
feat:support nacos-address server endpoints
chuntaojun Jul 1, 2024
0421a72
feat:support nacos-address server endpoints
chuntaojun Jul 1, 2024
7edb49e
feat:support nacos-address server endpoints
chuntaojun Jul 1, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ jobs:
bash test/codecov.sh

- name: Upload Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
34 changes: 32 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
password: ${{ secrets.POLARIS_DOCKER_PASSWORD }}

- name: Build Server
id: build-server
id: build-hub-server
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
Expand All @@ -63,7 +63,7 @@ jobs:
make build-docker IMAGE_TAG=${DOCKER_TAG}

- name: Build Prometheus
id: build-prom
id: build-hub-prom
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
Expand All @@ -72,3 +72,33 @@ jobs:
cd release/standalone/docker/prometheus
ls -lstrh
bash build_docker_prom.sh ${DOCKER_TAG}

- name: Log in to Tencent CCR
uses: docker/login-action@v1
with:
registry: ccr.ccs.tencentyun.com
username: ${{ secrets.TENCENT_DOCKER_NAME }}
password: ${{ secrets.TENCENT_DOCKER_PASSWORD }}

- name: Build Server
id: build-tencent-server
env:
DOCKER_REPOSITORY: ccr.ccs.tencentyun.com/polarismesh
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
DOCKER_TAG: ${{ steps.get_version.outputs.VERSION }}
run: |
ls -lstrh
make build-docker IMAGE_TAG=${DOCKER_TAG}

- name: Build Prometheus
id: build-tencent-prom
env:
DOCKER_REPOSITORY: ccr.ccs.tencentyun.com/polarismesh
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
DOCKER_TAG: ${{ steps.get_version.outputs.VERSION }}
run: |
cd release/standalone/docker/prometheus
ls -lstrh
bash build_docker_prom.sh ${DOCKER_TAG}
23 changes: 11 additions & 12 deletions apiserver/eurekaserver/access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func TestCreateInstance(t *testing.T) {
time.Sleep(5 * time.Second)
instanceId := fmt.Sprintf("%s_%s_%d", appId, host, startPort)
code := eurekaSrv.deregisterInstance(context.Background(), namespace, appId, instanceId, false)
assert.Equal(t, api.ExecuteSuccess, code)
assert.Equal(t, api.ExecuteSuccess, code, fmt.Sprintf("%d", code))
time.Sleep(20 * time.Second)

deltaReq := restful.NewRequest(httpRequest)
Expand Down Expand Up @@ -244,18 +244,17 @@ func Test_EurekaWrite(t *testing.T) {
injectRestfulReqPathParameters(t, restfulReq, map[string]string{
ParamAppId: mockIns.AppName,
})
// 这里是异步注册
eurekaSrv.RegisterApplication(restfulReq, restful.NewResponse(mockRsp))
assert.Equal(t, http.StatusNoContent, mockRsp.statusCode)
assert.Equal(t, restfulReq.Attribute(statusCodeHeader), uint32(apimodel.Code_ExecuteSuccess))

time.Sleep(5 * time.Second)
saveIns, err := eurekaSrv.originDiscoverSvr.Cache().GetStore().GetInstance(mockIns.InstanceId)
_ = discoverSuit.CacheMgr().TestUpdate()
saveIns, err := discoverSuit.Storage.GetInstance(mockIns.InstanceId)
assert.NoError(t, err)
assert.NotNil(t, saveIns)

t.Run("UpdateStatus", func(t *testing.T) {
t.Run("StatusUnknown", func(t *testing.T) {
t.Run("01_StatusUnknown", func(t *testing.T) {
mockReq := httptest.NewRequest("", fmt.Sprintf("http://127.0.0.1:8761/eureka/v2/apps/%s/%s/status",
mockIns.AppName, mockIns.InstanceId), nil)
mockReq.PostForm = url.Values{}
Expand All @@ -278,7 +277,7 @@ func Test_EurekaWrite(t *testing.T) {
assert.False(t, saveIns.Isolate())
})

t.Run("StatusDown", func(t *testing.T) {
t.Run("02_StatusDown", func(t *testing.T) {
mockReq := httptest.NewRequest("", fmt.Sprintf("http://127.0.0.1:8761/eureka/v2/apps/%s/%s/status",
mockIns.AppName, mockIns.InstanceId), nil)
mockReq.PostForm = url.Values{}
Expand All @@ -301,7 +300,7 @@ func Test_EurekaWrite(t *testing.T) {
assert.Equal(t, StatusDown, saveIns.Proto.Metadata[InternalMetadataStatus])
})

t.Run("StatusUp", func(t *testing.T) {
t.Run("03_StatusUp", func(t *testing.T) {
mockReq := httptest.NewRequest("", fmt.Sprintf("http://127.0.0.1:8761/eureka/v2/apps/%s/%s/status",
mockIns.AppName, mockIns.InstanceId), nil)
mockReq.PostForm = url.Values{}
Expand All @@ -324,17 +323,17 @@ func Test_EurekaWrite(t *testing.T) {
assert.Equal(t, StatusUp, saveIns.Proto.Metadata[InternalMetadataStatus])
})

t.Run("Polaris_UpdateInstances", func(t *testing.T) {
t.Run("04_Polaris_UpdateInstances", func(t *testing.T) {
defer func() {
rsp := discoverSuit.OriginDiscoverServer().UpdateInstances(discoverSuit.DefaultCtx, []*service_manage.Instance{
rsp := discoverSuit.DiscoverServer().UpdateInstances(discoverSuit.DefaultCtx, []*service_manage.Instance{
{
Id: wrapperspb.String(mockIns.InstanceId),
Isolate: wrapperspb.Bool(false),
},
})
assert.Equal(t, apimodel.Code_ExecuteSuccess, apimodel.Code(rsp.GetCode().GetValue()))
}()
rsp := discoverSuit.OriginDiscoverServer().UpdateInstances(discoverSuit.DefaultCtx, []*service_manage.Instance{
rsp := discoverSuit.DiscoverServer().UpdateInstances(discoverSuit.DefaultCtx, []*service_manage.Instance{
{
Id: wrapperspb.String(mockIns.InstanceId),
Isolate: wrapperspb.Bool(true),
Expand All @@ -349,8 +348,8 @@ func Test_EurekaWrite(t *testing.T) {
assert.Equal(t, StatusOutOfService, saveIns.Proto.Metadata[InternalMetadataStatus])
})

t.Run("Polaris_UpdateInstancesIsolate", func(t *testing.T) {
rsp := discoverSuit.OriginDiscoverServer().UpdateInstances(discoverSuit.DefaultCtx, []*service_manage.Instance{
t.Run("05_Polaris_UpdateInstancesIsolate", func(t *testing.T) {
rsp := discoverSuit.DiscoverServer().UpdateInstances(discoverSuit.DefaultCtx, []*service_manage.Instance{
{
Id: wrapperspb.String(mockIns.InstanceId),
Isolate: wrapperspb.Bool(true),
Expand Down
2 changes: 1 addition & 1 deletion apiserver/eurekaserver/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type (
func (h *EurekaServer) registerInstanceChain() {
svr := h.originDiscoverSvr.(*service.Server)
svr.AddInstanceChain(&EurekaInstanceChain{
s: h.namingServer.Cache().GetStore(),
s: svr.Store(),
})
}

Expand Down
4 changes: 3 additions & 1 deletion apiserver/eurekaserver/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/polarismesh/polaris/common/model"
commonstore "github.com/polarismesh/polaris/common/store"
"github.com/polarismesh/polaris/common/utils"
"github.com/polarismesh/polaris/service"
)

func checkOrBuildNewInstanceId(appId string, instId string, generateUniqueInstId bool) string {
Expand Down Expand Up @@ -256,7 +257,8 @@ func (h *EurekaServer) updateStatus(
})
instanceId = checkOrBuildNewInstanceIdByNamespace(namespace, h.namespace, appId, instanceId, h.generateUniqueInstId)

saveIns, err := h.originDiscoverSvr.Cache().GetStore().GetInstance(instanceId)
svr := h.originDiscoverSvr.(*service.Server)
saveIns, err := svr.Store().GetInstance(instanceId)
if err != nil {
eurekalog.Error("[EUREKA-SERVER] get instance from store when update status", zap.Error(err))
return uint32(commonstore.StoreCode2APICode(err))
Expand Down
10 changes: 5 additions & 5 deletions apiserver/nacosserver/core/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"golang.org/x/sync/singleflight"

nacosmodel "github.com/polarismesh/polaris/apiserver/nacosserver/model"
"github.com/polarismesh/polaris/cache"
cachetypes "github.com/polarismesh/polaris/cache/api"
"github.com/polarismesh/polaris/common/eventhub"
"github.com/polarismesh/polaris/common/model"
commontime "github.com/polarismesh/polaris/common/time"
Expand All @@ -50,7 +50,7 @@
ins []*nacosmodel.Instance, healthyCount int32) *nacosmodel.ServiceInfo
)

func NewNacosDataStorage(cacheMgr *cache.CacheManager) *NacosDataStorage {
func NewNacosDataStorage(cacheMgr cachetypes.CacheManager) *NacosDataStorage {

Check warning on line 53 in apiserver/nacosserver/core/storage.go

View check run for this annotation

Codecov / codecov/patch

apiserver/nacosserver/core/storage.go#L53

Added line #L53 was not covered by tests
ctx, cancel := context.WithCancel(context.Background())
notifier, notifierFinish := context.WithCancel(context.Background())
store := &NacosDataStorage{
Expand All @@ -67,7 +67,7 @@

// NacosDataStorage .
type NacosDataStorage struct {
cacheMgr *cache.CacheManager
cacheMgr cachetypes.CacheManager
ctx context.Context
cancel context.CancelFunc

Expand All @@ -82,7 +82,7 @@
revisions map[string]string
}

func (n *NacosDataStorage) Cache() *cache.CacheManager {
func (n *NacosDataStorage) Cache() cachetypes.CacheManager {

Check warning on line 85 in apiserver/nacosserver/core/storage.go

View check run for this annotation

Codecov / codecov/patch

apiserver/nacosserver/core/storage.go#L85

Added line #L85 was not covered by tests
return n.cacheMgr
}

Expand Down Expand Up @@ -343,7 +343,7 @@
return result
}

func ToNacosService(cacheMgr *cache.CacheManager, namespace, service, group string) *nacosmodel.ServiceMetadata {
func ToNacosService(cacheMgr cachetypes.CacheManager, namespace, service, group string) *nacosmodel.ServiceMetadata {

Check warning on line 346 in apiserver/nacosserver/core/storage.go

View check run for this annotation

Codecov / codecov/patch

apiserver/nacosserver/core/storage.go#L346

Added line #L346 was not covered by tests
ret := &nacosmodel.ServiceMetadata{
ServiceKey: nacosmodel.ServiceKey{
Namespace: namespace,
Expand Down
4 changes: 2 additions & 2 deletions apiserver/nacosserver/v1/config/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/polarismesh/polaris/apiserver/nacosserver/core"
"github.com/polarismesh/polaris/apiserver/nacosserver/v2/remote"
"github.com/polarismesh/polaris/auth"
"github.com/polarismesh/polaris/cache"
cachetypes "github.com/polarismesh/polaris/cache/api"
"github.com/polarismesh/polaris/config"
"github.com/polarismesh/polaris/namespace"
)
Expand All @@ -45,7 +45,7 @@ type ConfigServer struct {
namespaceSvr namespace.NamespaceOperateServer
configSvr config.ConfigCenterServer
originConfigSvr config.ConfigCenterServer
cacheSvr *cache.CacheManager
cacheSvr cachetypes.CacheManager
}

func (h *ConfigServer) Initialize(opt *ServerOption) error {
Expand Down
4 changes: 3 additions & 1 deletion apiserver/nacosserver/v1/discover/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"github.com/polarismesh/polaris/apiserver/nacosserver/model"
commonmodel "github.com/polarismesh/polaris/common/model"
"github.com/polarismesh/polaris/common/utils"
"github.com/polarismesh/polaris/service"
)

func (n *DiscoverServer) handleRegister(ctx context.Context, namespace, serviceName string, ins *model.Instance) error {
Expand All @@ -57,7 +58,8 @@
}
specIns.Id = wrapperspb.String(insId)
}
saveIns, err := n.discoverSvr.Cache().GetStore().GetInstance(specIns.GetId().GetValue())
svr := n.discoverSvr.(*service.Server)
saveIns, err := svr.Store().GetInstance(specIns.GetId().GetValue())
if err != nil {
return &model.NacosError{
ErrCode: int32(model.ExceptionCode_ServerError),
Expand All @@ -75,7 +77,7 @@
return nil
}

func (n *DiscoverServer) handleDeregister(ctx context.Context, namespace, service string, ins *model.Instance) error {

Check warning on line 80 in apiserver/nacosserver/v1/discover/instance.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.21.5)

import-shadowing: The name 'service' shadows an import name (revive)
specIns := model.PrepareSpecInstance(namespace, service, ins)
resp := n.discoverSvr.DeregisterInstance(ctx, specIns)
if apimodel.Code(resp.GetCode().GetValue()) != apimodel.Code_ExecuteSuccess {
Expand All @@ -88,7 +90,7 @@
}

// handleBeat com.alibaba.nacos.naming.core.InstanceOperatorClientImpl#handleBeat
func (n *DiscoverServer) handleBeat(ctx context.Context, namespace, service string,

Check warning on line 93 in apiserver/nacosserver/v1/discover/instance.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.21.5)

import-shadowing: The name 'service' shadows an import name (revive)
clientBeat *model.ClientBeat) (map[string]interface{}, error) {
service = model.ReplaceNacosService(service)
svc := n.discoverSvr.Cache().Service().GetServiceByName(service, namespace)
Expand Down Expand Up @@ -134,7 +136,7 @@
func (n *DiscoverServer) handleQueryInstances(ctx context.Context, params map[string]string) (interface{}, error) {
namespace := params[model.ParamNamespaceID]
group := model.GetGroupName(params[model.ParamServiceName])
service := model.GetServiceName(params[model.ParamServiceName])

Check warning on line 139 in apiserver/nacosserver/v1/discover/instance.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.21.5)

import-shadowing: The name 'service' shadows an import name (revive)
clusters := params["clusters"]
clientIP := params["clientIP"]
udpPort, _ := strconv.ParseInt(params["udpPort"], 10, 32)
Expand Down
4 changes: 2 additions & 2 deletions apiserver/nacosserver/v2/config/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
nacospb "github.com/polarismesh/polaris/apiserver/nacosserver/v2/pb"
"github.com/polarismesh/polaris/apiserver/nacosserver/v2/remote"
"github.com/polarismesh/polaris/auth"
"github.com/polarismesh/polaris/cache"
cachetypes "github.com/polarismesh/polaris/cache/api"
"github.com/polarismesh/polaris/config"
"github.com/polarismesh/polaris/namespace"
)
Expand All @@ -49,7 +49,7 @@ type ConfigServer struct {
namespaceSvr namespace.NamespaceOperateServer
configSvr config.ConfigCenterServer
originConfigSvr config.ConfigCenterServer
cacheSvr *cache.CacheManager
cacheSvr cachetypes.CacheManager
handleRegistry map[string]*remote.RequestHandlerWarrper
}

Expand Down
10 changes: 6 additions & 4 deletions apiserver/nacosserver/v2/discover/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

nacosmodel "github.com/polarismesh/polaris/apiserver/nacosserver/model"
"github.com/polarismesh/polaris/apiserver/nacosserver/v2/remote"
"github.com/polarismesh/polaris/cache"
cachetypes "github.com/polarismesh/polaris/cache/api"
"github.com/polarismesh/polaris/common/eventhub"
"github.com/polarismesh/polaris/common/model"
"github.com/polarismesh/polaris/common/utils"
Expand All @@ -44,7 +44,7 @@ type Checker struct {
discoverSvr service.DiscoverServer
healthSvr *healthcheck.Server

cacheMgr *cache.CacheManager
cacheMgr cachetypes.CacheManager
connMgr *remote.ConnectionManager
clientMgr *ConnectionClientManager

Expand Down Expand Up @@ -192,6 +192,8 @@ func (c *Checker) runCheck(ctx context.Context) {
// BUT: 一个实例 T1 时刻对应长连接为 Conn-1,T2 时刻对应的长连接为 Conn-2,但是在 T1 ~ T2 之间的某个时刻检测发现长连接不存在
// 此时发起一个反注册请求,该请求在 T3 时刻发起,是否会影响 T2 时刻注册上来的实例?
func (c *Checker) realCheck() {
svr := c.discoverSvr.(*service.Server)

defer func() {
if err := recover(); err != nil {
var buf [4086]byte
Expand Down Expand Up @@ -267,7 +269,7 @@ func (c *Checker) realCheck() {
}
nacoslog.Info("[NACOS-V2][Checker] batch set instance health_status to unhealthy",
zap.Any("instance-ids", ids))
if err := c.discoverSvr.Cache().GetStore().
if err := svr.Store().
BatchSetInstanceHealthStatus(ids, model.StatusBoolToInt(false), utils.NewUUID()); err != nil {
nacoslog.Error("[NACOS-V2][Checker] batch set instance health_status to unhealthy",
zap.Any("instance-ids", ids), zap.Error(err))
Expand All @@ -281,7 +283,7 @@ func (c *Checker) realCheck() {
}
nacoslog.Info("[NACOS-V2][Checker] batch set instance health_status to healty",
zap.Any("instance-ids", ids))
if err := c.discoverSvr.Cache().GetStore().
if err := svr.Store().
BatchSetInstanceHealthStatus(ids, model.StatusBoolToInt(true), utils.NewUUID()); err != nil {
nacoslog.Error("[NACOS-V2][Checker] batch set instance health_status to healty",
zap.Any("instance-ids", ids), zap.Error(err))
Expand Down
6 changes: 3 additions & 3 deletions auth/user/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (svr *Server) UpdateGroup(ctx context.Context, req *apisecurity.ModifyUserG
return errResp
}

modifyReq, needUpdate := updateGroupAttribute(ctx, data.UserGroup, req)
modifyReq, needUpdate := UpdateGroupAttribute(ctx, data.UserGroup, req)
if !needUpdate {
log.Info("update group data no change, no need update",
utils.RequestID(ctx), zap.String("group", req.String()))
Expand Down Expand Up @@ -385,8 +385,8 @@ func (svr *Server) checkUpdateGroup(ctx context.Context, req *apisecurity.Modify
return nil
}

// updateGroupAttribute 更新计算用户组更新时的结构体数据,并判断是否需要执行更新操作
func updateGroupAttribute(ctx context.Context, old *model.UserGroup, newUser *apisecurity.ModifyUserGroup) (
// UpdateGroupAttribute 更新计算用户组更新时的结构体数据,并判断是否需要执行更新操作
func UpdateGroupAttribute(ctx context.Context, old *model.UserGroup, newUser *apisecurity.ModifyUserGroup) (
*model.ModifyUserGroup, bool) {
var (
needUpdate bool
Expand Down
27 changes: 27 additions & 0 deletions auth/user/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"github.com/golang/mock/gomock"
"github.com/golang/protobuf/ptypes/wrappers"
apimodel "github.com/polarismesh/specification/source/go/api/v1/model"
apisecurity "github.com/polarismesh/specification/source/go/api/v1/security"
"github.com/stretchr/testify/assert"

Expand Down Expand Up @@ -318,6 +319,32 @@ func Test_server_CreateUsers(t *testing.T) {
})
}

func Test_server_Login(t *testing.T) {

userTest := newUserTest(t)
defer userTest.Clean()

t.Run("正常登陆", func(t *testing.T) {
rsp := userTest.svr.Login(&apisecurity.LoginRequest{
Name: &wrappers.StringValue{Value: userTest.users[0].Name},
Password: &wrappers.StringValue{Value: "polaris"},
})

assert.True(t, api.IsSuccess(rsp), rsp.GetInfo().GetValue())
})

t.Run("错误的密码", func(t *testing.T) {
rsp := userTest.svr.Login(&apisecurity.LoginRequest{
Name: &wrappers.StringValue{Value: userTest.users[0].Name},
Password: &wrappers.StringValue{Value: "polaris_123"},
})

assert.False(t, api.IsSuccess(rsp), rsp.GetInfo().GetValue())
assert.Equal(t, uint32(apimodel.Code_NotAllowedAccess), rsp.GetCode().GetValue())
assert.Contains(t, rsp.GetInfo().GetValue(), model.ErrorWrongUsernameOrPassword.Error())
})
}

func Test_server_UpdateUser(t *testing.T) {

userTest := newUserTest(t)
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ func polarisServiceRegister(polarisService *boot_config.PolarisService, apiServe
// selfRegister 服务自注册
func selfRegister(
host string, port uint32, protocol string, isolated bool, polarisService *boot_config.Service, hbInterval int) error {
server, err := service.GetOriginServer()
server, err := service.GetServer()
if err != nil {
return err
}
Expand Down Expand Up @@ -609,7 +609,7 @@ func selfRegister(
Metadata: metadata,
}

resp := server.CreateInstance(genContext(), req)
resp := server.RegisterInstance(genContext(), req)
if api.CalcCode(resp) != 200 {
// 如果self之前注册过,那么可以忽略
if resp.GetCode().GetValue() != api.ExistedResource {
Expand Down
Loading
Loading