Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
2398dafb
M
milvus
项目概览
milvus
/
milvus
接近 1 年 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2398dafb
编写于
9月 15, 2021
作者:
G
groot
提交者:
GitHub
9月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add unittest for distributed proxy (#7976)
Signed-off-by:
N
yhmo
<
yihua.mo@zilliz.com
>
上级
900f2d73
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
88 addition
and
1 deletion
+88
-1
internal/distributed/proxy/client/client_test.go
internal/distributed/proxy/client/client_test.go
+38
-0
internal/distributed/proxy/client/paramtable_test.go
internal/distributed/proxy/client/paramtable_test.go
+10
-0
internal/distributed/proxy/paramtable_test.go
internal/distributed/proxy/paramtable_test.go
+14
-0
internal/distributed/proxy/service_test.go
internal/distributed/proxy/service_test.go
+25
-0
internal/util/funcutil/random_test.go
internal/util/funcutil/random_test.go
+1
-1
未找到文件。
internal/distributed/proxy/client/client_test.go
0 → 100644
浏览文件 @
2398dafb
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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
grpcproxyclient
import
(
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func
Test_NewClient
(
t
*
testing
.
T
)
{
client
,
err
:=
NewClient
(
context
.
Background
(),
""
)
assert
.
Nil
(
t
,
client
)
assert
.
Error
(
t
,
err
)
client
,
err
=
NewClient
(
context
.
Background
(),
"localhost"
)
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
client
)
err
=
client
.
Start
()
assert
.
Nil
(
t
,
err
)
err
=
client
.
Stop
()
assert
.
Nil
(
t
,
err
)
err
=
client
.
Register
()
assert
.
Nil
(
t
,
err
)
}
internal/distributed/proxy/client/paramtable_test.go
浏览文件 @
2398dafb
...
...
@@ -14,7 +14,9 @@ package grpcproxyclient
import
(
"testing"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
"github.com/milvus-io/milvus/internal/log"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
)
...
...
@@ -23,4 +25,12 @@ func TestParamTable(t *testing.T) {
log
.
Info
(
"TestParamTable"
,
zap
.
Int
(
"ClientMaxSendSize"
,
Params
.
ClientMaxSendSize
))
log
.
Info
(
"TestParamTable"
,
zap
.
Int
(
"ClientMaxRecvSize"
,
Params
.
ClientMaxRecvSize
))
Params
.
Remove
(
"proxy.grpc.clientMaxSendSize"
)
Params
.
initClientMaxSendSize
()
assert
.
Equal
(
t
,
Params
.
ClientMaxSendSize
,
grpcconfigs
.
DefaultClientMaxSendSize
)
Params
.
Remove
(
"proxy.grpc.clientMaxRecvSize"
)
Params
.
initClientMaxRecvSize
()
assert
.
Equal
(
t
,
Params
.
ClientMaxRecvSize
,
grpcconfigs
.
DefaultClientMaxRecvSize
)
}
internal/distributed/proxy/paramtable_test.go
浏览文件 @
2398dafb
...
...
@@ -14,7 +14,10 @@ package grpcproxy
import
(
"testing"
"github.com/milvus-io/milvus/internal/distributed/grpcconfigs"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/util/funcutil"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
)
...
...
@@ -23,4 +26,15 @@ func TestParamTable(t *testing.T) {
log
.
Info
(
"TestParamTable"
,
zap
.
Int
(
"ServerMaxSendSize"
,
Params
.
ServerMaxSendSize
))
log
.
Info
(
"TestParamTable"
,
zap
.
Int
(
"ServerMaxRecvSize"
,
Params
.
ServerMaxRecvSize
))
Params
.
Remove
(
"proxy.grpc.serverMaxSendSize"
)
Params
.
initServerMaxSendSize
()
assert
.
Equal
(
t
,
Params
.
ServerMaxSendSize
,
grpcconfigs
.
DefaultServerMaxSendSize
)
Params
.
Remove
(
"proxy.grpc.serverMaxRecvSize"
)
Params
.
initServerMaxRecvSize
()
assert
.
Equal
(
t
,
Params
.
ServerMaxRecvSize
,
grpcconfigs
.
DefaultServerMaxRecvSize
)
Params
.
LoadFromEnv
()
assert
.
Equal
(
t
,
Params
.
IP
,
funcutil
.
GetLocalIP
())
}
internal/distributed/proxy/service_test.go
0 → 100644
浏览文件 @
2398dafb
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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
grpcproxy
import
(
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func
Test_NewServer
(
t
*
testing
.
T
)
{
server
,
err
:=
NewServer
(
context
.
Background
(),
nil
)
assert
.
NotNil
(
t
,
server
)
assert
.
Nil
(
t
,
err
)
}
internal/util/funcutil/random_test.go
浏览文件 @
2398dafb
...
...
@@ -23,6 +23,6 @@ func Test_RandomString(t *testing.T) {
assert
.
Equal
(
t
,
len
(
str
),
length
)
}
func
TestGenRandomStr
(
t
*
testing
.
T
)
{
func
Test
_
GenRandomStr
(
t
*
testing
.
T
)
{
assert
.
True
(
t
,
len
(
GenRandomStr
())
>=
1
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录