Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
47cda334
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
47cda334
编写于
9月 20, 2019
作者:
fengqikai1414
提交者:
fengqikai1414
9月 20, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cyber: fix service discovery manager tests fail
上级
70c49b5a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
22 addition
and
22 deletion
+22
-22
cyber/service_discovery/specific_manager/channel_manager_test.cc
...ervice_discovery/specific_manager/channel_manager_test.cc
+7
-7
cyber/service_discovery/specific_manager/node_manager_test.cc
...r/service_discovery/specific_manager/node_manager_test.cc
+7
-7
cyber/service_discovery/specific_manager/service_manager_test.cc
...ervice_discovery/specific_manager/service_manager_test.cc
+8
-8
未找到文件。
cyber/service_discovery/specific_manager/channel_manager_test.cc
浏览文件 @
47cda334
...
...
@@ -111,12 +111,12 @@ TEST_F(ChannelManagerTest, get_proto_desc) {
transport
::
Identity
id_0
;
role_attr
.
set_id
(
id_0
.
HashValue
());
role_attr
.
set_proto_desc
(
""
);
EXPECT_
TRU
E
(
channel_manager_
.
Join
(
role_attr
,
RoleType
::
ROLE_WRITER
));
EXPECT_
FALS
E
(
channel_manager_
.
Join
(
role_attr
,
RoleType
::
ROLE_WRITER
));
channel_manager_
.
GetProtoDesc
(
"wasd"
,
&
proto_desc
);
EXPECT_EQ
(
proto_desc
,
""
);
EXPECT_
TRU
E
(
channel_manager_
.
Leave
(
role_attr
,
RoleType
::
ROLE_WRITER
));
EXPECT_
FALS
E
(
channel_manager_
.
Leave
(
role_attr
,
RoleType
::
ROLE_WRITER
));
// add a writer with real proto desc
role_attr
.
set_node_name
(
"proto"
);
...
...
@@ -131,14 +131,14 @@ TEST_F(ChannelManagerTest, get_proto_desc) {
message
::
GetDescriptorString
<
proto
::
Chatter
>
(
message
::
MessageType
<
proto
::
Chatter
>
(),
&
tmp
);
role_attr
.
set_proto_desc
(
tmp
);
EXPECT_
TRU
E
(
channel_manager_
.
Join
(
role_attr
,
RoleType
::
ROLE_WRITER
));
EXPECT_
FALS
E
(
channel_manager_
.
Join
(
role_attr
,
RoleType
::
ROLE_WRITER
));
proto_desc
=
guard
;
EXPECT_TRUE
(
channel_manager_
.
HasWriter
(
"jkl"
));
channel_manager_
.
GetProtoDesc
(
"jkl"
,
&
proto_desc
);
EXPECT_NE
(
proto_desc
,
guard
);
EXPECT_
TRU
E
(
channel_manager_
.
Leave
(
role_attr
,
RoleType
::
ROLE_WRITER
));
EXPECT_
FALS
E
(
channel_manager_
.
Leave
(
role_attr
,
RoleType
::
ROLE_WRITER
));
}
TEST_F
(
ChannelManagerTest
,
has_writer
)
{
...
...
@@ -216,13 +216,13 @@ TEST_F(ChannelManagerTest, get_readers_attr) {
EXPECT_EQ
(
readers
.
size
(),
1
);
RoleAttributes
role_attr
(
readers
[
0
]);
EXPECT_
TRU
E
(
channel_manager_
.
Leave
(
role_attr
,
RoleType
::
ROLE_READER
));
EXPECT_
FALS
E
(
channel_manager_
.
Leave
(
role_attr
,
RoleType
::
ROLE_READER
));
readers
.
clear
();
channel_manager_
.
GetReadersOfChannel
(
"channel_0"
,
&
readers
);
EXPECT_EQ
(
readers
.
size
(),
0
);
EXPECT_
TRU
E
(
channel_manager_
.
Join
(
role_attr
,
RoleType
::
ROLE_READER
));
EXPECT_
FALS
E
(
channel_manager_
.
Join
(
role_attr
,
RoleType
::
ROLE_READER
));
readers
.
clear
();
channel_manager_
.
GetReadersOfChannel
(
"channel_0"
,
&
readers
);
EXPECT_EQ
(
readers
.
size
(),
1
);
...
...
@@ -266,7 +266,7 @@ TEST_F(ChannelManagerTest, change) {
transport
::
Identity
id
;
role_attr
.
set_id
(
id
.
HashValue
());
EXPECT_
TRU
E
(
channel_manager_
.
Join
(
role_attr
,
RoleType
::
ROLE_WRITER
));
EXPECT_
FALS
E
(
channel_manager_
.
Join
(
role_attr
,
RoleType
::
ROLE_WRITER
));
EXPECT_TRUE
(
channel_manager_
.
HasWriter
(
"channel_0"
));
}
...
...
cyber/service_discovery/specific_manager/node_manager_test.cc
浏览文件 @
47cda334
...
...
@@ -54,13 +54,13 @@ TEST_F(NodeManagerTest, node_change) {
role_attr
.
set_node_id
(
node_id
);
EXPECT_FALSE
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_WRITER
));
EXPECT_
TRU
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_
FALS
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_TRUE
(
node_manager_
->
HasNode
(
"node"
));
// node leave
EXPECT_FALSE
(
node_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_WRITER
));
EXPECT_
TRU
E
(
node_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_
FALS
E
(
node_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_FALSE
(
node_manager_
->
HasNode
(
"node"
));
}
...
...
@@ -73,7 +73,7 @@ TEST_F(NodeManagerTest, topo_module_leave) {
uint64_t
node_id
=
common
::
GlobalData
::
RegisterNode
(
"node"
);
role_attr
.
set_node_id
(
node_id
);
EXPECT_
TRU
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_
FALS
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_TRUE
(
node_manager_
->
HasNode
(
"node"
));
}
...
...
@@ -89,13 +89,13 @@ TEST_F(NodeManagerTest, add_and_remove_change_listener) {
uint64_t
node_id
=
common
::
GlobalData
::
RegisterNode
(
"node"
);
role_attr
.
set_node_id
(
node_id
);
EXPECT_
TRU
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_
FALS
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_TRUE
(
recv_flag
);
node_manager_
->
RemoveChangeListener
(
conn
);
recv_flag
=
false
;
EXPECT_
TRU
E
(
node_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_
FALS
E
(
node_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_FALSE
(
recv_flag
);
}
...
...
@@ -107,7 +107,7 @@ TEST_F(NodeManagerTest, has_node) {
uint64_t
node_id
=
common
::
GlobalData
::
RegisterNode
(
"node"
);
role_attr
.
set_node_id
(
node_id
);
EXPECT_
TRU
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_
FALS
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_TRUE
(
node_manager_
->
HasNode
(
"node"
));
EXPECT_FALSE
(
node_manager_
->
HasNode
(
"node11"
));
...
...
@@ -121,7 +121,7 @@ TEST_F(NodeManagerTest, get_nodes) {
uint64_t
node_id
=
common
::
GlobalData
::
RegisterNode
(
"node_1"
);
role_attr
.
set_node_id
(
node_id
);
EXPECT_
TRU
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_
FALS
E
(
node_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
std
::
vector
<
RoleAttributes
>
attr_nodes
;
node_manager_
->
GetNodes
(
&
attr_nodes
);
...
...
cyber/service_discovery/specific_manager/service_manager_test.cc
浏览文件 @
47cda334
...
...
@@ -55,12 +55,12 @@ TEST_F(ServiceManagerTest, server_operation) {
role_attr
.
set_service_name
(
"service"
);
uint64_t
service_id
=
common
::
GlobalData
::
RegisterService
(
"service"
);
role_attr
.
set_service_id
(
service_id
);
EXPECT_
TRU
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_SERVER
));
EXPECT_
FALS
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_SERVER
));
EXPECT_FALSE
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_NODE
));
EXPECT_TRUE
(
service_manager_
->
HasService
(
"service"
));
EXPECT_FALSE
(
service_manager_
->
HasService
(
"client"
));
// repeated call
EXPECT_
TRU
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_SERVER
));
EXPECT_
FALS
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_SERVER
));
// get servers
std
::
vector
<
RoleAttributes
>
servers
;
...
...
@@ -69,7 +69,7 @@ TEST_F(ServiceManagerTest, server_operation) {
EXPECT_EQ
(
servers
.
size
(),
1
);
// leave
EXPECT_
TRU
E
(
service_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_SERVER
));
EXPECT_
FALS
E
(
service_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_SERVER
));
EXPECT_FALSE
(
service_manager_
->
HasService
(
"service"
));
servers
.
clear
();
...
...
@@ -89,9 +89,9 @@ TEST_F(ServiceManagerTest, client_operation) {
role_attr
.
set_service_name
(
"service"
);
uint64_t
service_id
=
common
::
GlobalData
::
RegisterService
(
"service"
);
role_attr
.
set_service_id
(
service_id
);
EXPECT_
TRU
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_CLIENT
));
EXPECT_
FALS
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_CLIENT
));
// repeated call
EXPECT_
TRU
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_CLIENT
));
EXPECT_
FALS
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_CLIENT
));
// get clients
std
::
vector
<
RoleAttributes
>
clients
;
...
...
@@ -100,7 +100,7 @@ TEST_F(ServiceManagerTest, client_operation) {
EXPECT_EQ
(
clients
.
size
(),
2
);
// leave
EXPECT_
TRU
E
(
service_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_CLIENT
));
EXPECT_
FALS
E
(
service_manager_
->
Leave
(
role_attr
,
RoleType
::
ROLE_CLIENT
));
clients
.
clear
();
EXPECT_TRUE
(
clients
.
empty
());
...
...
@@ -118,8 +118,8 @@ TEST_F(ServiceManagerTest, topo_module_leave) {
role_attr
.
set_service_name
(
"service"
);
uint64_t
service_id
=
common
::
GlobalData
::
RegisterService
(
"service"
);
role_attr
.
set_service_id
(
service_id
);
EXPECT_
TRU
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_SERVER
));
EXPECT_
TRU
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_CLIENT
));
EXPECT_
FALS
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_SERVER
));
EXPECT_
FALS
E
(
service_manager_
->
Join
(
role_attr
,
RoleType
::
ROLE_CLIENT
));
EXPECT_TRUE
(
service_manager_
->
HasService
(
"service"
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录