Documentation ¶
Index ¶
Constants ¶
View Source
const ( IsolatedStatus = iota UnhealthyStatus )
Variables ¶
View Source
var (
VS = `` /* 629-byte string literal not displayed */
)
Functions ¶
func CompositeComputeRevision ¶ added in v1.5.0
CompositeComputeRevision 将多个 revision 合并计算为一个
Types ¶
type NamingServer ¶
type NamingServer interface { service_manage.PolarisGRPCServer // MakeOperationTimeout 设置模拟某个方法进行超时 MakeOperationTimeout(operation OperationType, enable bool) // MakeForceOperationTimeout 设置强制模拟方法超时 MakeForceOperationTimeout(operation OperationType, enable bool) // SetMethodInterval 设置方法超时时间 SetMethodInterval(interval time.Duration) // SetPrintDiscoverReturn 设置打印返回的服务列表信息 SetPrintDiscoverReturn(v bool) // SetReturnException 设置mockserver是否返回异常 SetReturnException(e bool) // SetNotRegisterAssistant 设置是否自动注册网格的辅助服务 SetNotRegisterAssistant(e bool) // RegisterService 注册服务 RegisterService(svc *service_manage.Service) string // DeregisterService 反注册服务 DeregisterService(namespace, service string) *service_manage.Service // RegisterRateLimitRule 注册限流规则 RegisterRateLimitRule(svc *service_manage.Service, rateLimit *traffic_manage.RateLimit) error // DeRegisterRateLimitRule 注销限流规则 DeRegisterRateLimitRule(svc *service_manage.Service) // RegisterRouteRule 注册路由规则 RegisterRouteRule(svc *service_manage.Service, routing *traffic_manage.Routing) error // DeregisterRouteRule 反注册路由规则 DeregisterRouteRule(svc *service_manage.Service) // RegisterNamespace 注册命名空间 RegisterNamespace(namespace *apimodel.Namespace) // DeregisterNamespace 反注册命名空间 DeregisterNamespace(name string) // BuildRouteRule 构建系统服务的路由规则 BuildRouteRule(namespace string, name string) *traffic_manage.Routing // RegisterServerInstance 注册服务实例 RegisterServerInstance(host string, port int, name string, token string, health bool) *service_manage.Instance // RegisterServerInstanceReturnId . RegisterServerInstanceReturnId(host string, port int, name string, token string, health bool) string // RegisterServiceInstances 批量注册服务实例 RegisterServiceInstances(svc *service_manage.Service, instances []*service_manage.Instance) // GetServiceInstances 直接获取服务实例 GetServiceInstances(key *model.ServiceKey) []*service_manage.Instance // RegisterServerService 注册系统服务,返回服务token RegisterServerService(name string) string // RegisterServerServices 注册所有系统服务以及对应的服务实例 RegisterServerServices(host string, port int) // ClearServiceInstances 清空某个测试服务的实例 ClearServiceInstances(svc *service_manage.Service) // SetServiceMetadata 设置服务的元数据信息 SetServiceMetadata(token string, key string, value string) // GenTestInstances 为服务生成N个随机服务实例 GenTestInstances(svc *service_manage.Service, num int) []*service_manage.Instance // DeleteServerInstance 删除测试实例 DeleteServerInstance(namespace string, service string, id string) // UpdateServerInstanceWeight 修改系统服务实例权重 UpdateServerInstanceWeight(namespace string, service string, id string, weight uint32) // UpdateServerInstanceHealthy 修改系统服务实例健康状态 UpdateServerInstanceHealthy(namespace string, service string, id string, healthy bool) // UpdateServerInstanceIsolate 修改系统服务实例隔离状态 UpdateServerInstanceIsolate(namespace string, service string, id string, isolate bool) // GenTestInstancesWithHostPort 产生测试用实例,带上地址端口号,权重随机生成 GenTestInstancesWithHostPort(svc *service_manage.Service, num int, host string, startPort int) []*service_manage.Instance // GenTestInstancesWithHostPortAndMeta . GenTestInstancesWithHostPortAndMeta( svc *service_manage.Service, num int, host string, startPort int, metadata map[string]string) []*service_manage.Instance // GenTestInstancesWithMeta 产生测试用实例,带上元数据,权重随机生成 GenTestInstancesWithMeta(svc *service_manage.Service, num int, metadata map[string]string) []*service_manage.Instance // GenInstancesWithStatus 产生测试用实例,带上状态信息,权重随机生成 GenInstancesWithStatus(svc *service_manage.Service, num int, st int, startPort int) []*service_manage.Instance // SetLocation 设置地域信息 SetLocation(region, zone, campus string) // SetServiceInstances 设置某个服务的实例 SetServiceInstances(key *model.ServiceKey, insts []*service_manage.Instance) // GetLocation 获取地域信息 GetLocation() (region, zone, campus string) // GetServiceRequests 获取服务请求 GetServiceRequests(key *model.ServiceKey) int // ClearServiceRequests 清空服务请求 ClearServiceRequests(key *model.ServiceKey) // GetServiceToken 获取服务token GetServiceToken(key *model.ServiceKey) string // SetServiceRevision 设置服务版本号 SetServiceRevision(token string, revision string, k model.ServiceEventKey) // InsertRouting 插入一个路由信息 InsertRouting(svcKey model.ServiceKey, routing *traffic_manage.Routing) // SetInstanceStatus 设置某个服务的某个实例的状态(健康、隔离、权重) SetInstanceStatus(svcKey model.ServiceKey, idx int, healthy bool, isolate bool, weight uint32) error // SetFirstNoReturn 设置首次不返回某个请求 SetFirstNoReturn(svcKey model.ServiceEventKey) // UnsetFirstNoReturn 反设置首次不返回某个请求 UnsetFirstNoReturn(svcKey model.ServiceEventKey) }
NamingServer 测试桩相关接口
type OperationType ¶
type OperationType string
操作类型
const ( // OperationDiscoverInstance 服务发现实例接口操作 OperationDiscoverInstance OperationType = "discoverInstance" // OperationDiscoverRouting 服务发现路由接口操作 OperationDiscoverRouting OperationType = "discoverRouting" // OperationRegistry 服务注册接口 OperationRegistry OperationType = "registry" // OperationDeRegistry 服务反注册接口 OperationDeRegistry OperationType = "deregistry" // OperationHeartbeat 健康检查接口 OperationHeartbeat OperationType = "heartbeat" )
Click to show internal directories.
Click to hide internal directories.