-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 添加就近路由支持文档 * rebase upstream/master * feat:support new route label * feat:support new route label * feat:support new route label * feat:support new route label * feat:support new route label
- Loading branch information
1 parent
96891e4
commit 783ba15
Showing
12 changed files
with
274 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,7 @@ test/other/other_test_suit.go | |
|
||
/vendor/ | ||
|
||
.vscode/ | ||
.vscode/ | ||
|
||
style_tool/ | ||
goimports-reviser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* Tencent is pleased to support the open source community by making polaris-go available. | ||
* | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* Licensed under the BSD 3-Clause License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed | ||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package api | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/polarismesh/polaris-go/pkg/model" | ||
) | ||
|
||
func TestGetInstancesRequest_convert(t *testing.T) { | ||
type fields struct { | ||
GetInstancesRequest model.GetInstancesRequest | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
ret map[string]string | ||
}{ | ||
{ | ||
fields: fields{ | ||
GetInstancesRequest: model.GetInstancesRequest{ | ||
SourceService: &model.ServiceInfo{ | ||
Metadata: map[string]string{ | ||
"uid": "123", | ||
}, | ||
}, | ||
Arguments: []model.Argument{ | ||
model.BuildHeaderArgument("uid", "123"), | ||
}, | ||
}, | ||
}, | ||
ret: map[string]string{ | ||
"uid": "123", | ||
"$header.uid": "123", | ||
}, | ||
}, | ||
{ | ||
fields: fields{ | ||
GetInstancesRequest: model.GetInstancesRequest{ | ||
Arguments: []model.Argument{ | ||
model.BuildHeaderArgument("uid", "123"), | ||
}, | ||
}, | ||
}, | ||
ret: map[string]string{ | ||
"$header.uid": "123", | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
r := &GetInstancesRequest{ | ||
GetInstancesRequest: tt.fields.GetInstancesRequest, | ||
} | ||
r.convert() | ||
assert.Equal(t, tt.ret, r.SourceService.Metadata) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
# Tencent is pleased to support the open source community by making Polaris available. | ||
# | ||
# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
# | ||
# Licensed under the BSD 3-Clause License (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://opensource.org/licenses/BSD-3-Clause | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed | ||
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. | ||
|
||
|
||
# 格式化 go.mod | ||
go mod tidy -compat=1.17 | ||
|
||
|
||
# 处理 go imports 的格式化 | ||
rm -rf style_tool | ||
rm -rf goimports-reviser | ||
|
||
mkdir -p style_tool | ||
|
||
cd style_tool | ||
|
||
wget https://github.com/incu6us/goimports-reviser/releases/download/v3.1.1/goimports-reviser_3.1.1_linux_amd64.tar.gz | ||
tar -zxvf goimports-reviser_3.1.1_linux_amd64.tar.gz | ||
mv goimports-reviser ../ | ||
|
||
cd ../ | ||
|
||
ls -lstrh | ||
|
||
find . -name "*.go" -type f | grep -v .pb.go|grep -v test/tools/tools.go | grep -v ./pkg/plugin/register/plugins.go | xargs -I {} goimports-reviser -rm-unused -format {} -project-name github.com/polarismesh/polaris-go | ||
|
||
# 处理 go 代码格式化 | ||
go fmt ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.