servicecomb-service-center
servicecomb-service-center copied to clipboard
[feat] Added whitelist function in synchronization
【背景】完成指定不同步的功能即增加白名单
【修改内容】
1.在sync目录中的config定义service、account和role的结构体,然后新建whitelist目录新建相关service、account和role的允许同步func,并新增相关测试用例覆盖率为100%;
2.修改server/service/disco的相关接口中,新增服务白名单判断 IsInWhiteList
,这个逻辑先判断服务是否存在,然后再去判断是否符合白名单规则要求;
涉及的接口:
microService接口: RegisterService, UnregisterService, PutServiceProperties instance接口: RegisterInstance, UnregisterInstance, SendHeartbeat, FindInstances(订阅), PutInstanceStatus, PutInstanceProperties schema接口: DeleteSchema, PutSchemas, PutSchema tag接口: PutManyTags, PutTag, DeleteManyTags
并在disco中编写相关的sync测试用例,将原先在etcd中的部分同步测试用例删除
【修改原因】新增功能
【测试用例】见修改中的内容
【遗留问题】
1.未完成account和role的白名单过滤,不过已经实现了相关方法
【测试验证】白名单中过滤规则:以 sync*
开头的服务
microService接口:
1.注册服务
-
更新服务Properties
-
注销服务
instance接口
-
注册实例
-
发送心跳 SendHeartbeat
-
更新实例状态PutInstanceStatus
-
更新实例的配置PutInstanceProperties
-
查找实例(订阅) FindInstances
-
注销实例 UnregisterInstance
schema接口
-
更新PutSchemas
2.删除schema DeleteSchema


3.更新schema


tag接口
-
新增tags PutManyTags
-
更新tag PutTag
-
删除tags DeleteManyTags