serviceroute

package
v1.6.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DstMetaTestingSuite

type DstMetaTestingSuite struct {
	// contains filtered or unexported fields
}

元数据过滤路由插件测试用例

func (*DstMetaTestingSuite) GetName

func (t *DstMetaTestingSuite) GetName() string

套件名字

func (*DstMetaTestingSuite) SetUpSuite

func (t *DstMetaTestingSuite) SetUpSuite(c *check.C)

SetUpSuite 启动测试套程序

func (*DstMetaTestingSuite) TearDownSuite

func (t *DstMetaTestingSuite) TearDownSuite(c *check.C)

SetUpSuite 结束测试套程序

func (*DstMetaTestingSuite) TestFailOverDefaultMetaNormalWithCustomMeta

func (t *DstMetaTestingSuite) TestFailOverDefaultMetaNormalWithCustomMeta(c *check.C)

测试元数据路由兜底策略:自定义meta

func (*DstMetaTestingSuite) TestFailOverDefaultMetaNormalWithGetOneHealth

func (t *DstMetaTestingSuite) TestFailOverDefaultMetaNormalWithGetOneHealth(c *check.C)

测试元数据路由兜底策略:通配所有可用ip实例

func (*DstMetaTestingSuite) TestFailOverDefaultMetaNormalWithNotContainMeta

func (t *DstMetaTestingSuite) TestFailOverDefaultMetaNormalWithNotContainMeta(c *check.C)

测试元数据路由兜底策略:匹配不带 metaData key路由

func (*DstMetaTestingSuite) TestFailOverDefaultMetaWrongWithCustomMeta01

func (t *DstMetaTestingSuite) TestFailOverDefaultMetaWrongWithCustomMeta01(c *check.C)

测试元数据路由兜底策略:自定义meta

func (*DstMetaTestingSuite) TestFailOverDefaultMetaWrongWithCustomMeta02

func (t *DstMetaTestingSuite) TestFailOverDefaultMetaWrongWithCustomMeta02(c *check.C)

测试元数据路由兜底策略:自定义meta

func (*DstMetaTestingSuite) TestFailOverDefaultMetaWrongWithType

func (t *DstMetaTestingSuite) TestFailOverDefaultMetaWrongWithType(c *check.C)

测试元数据路由兜底策略正确设置类型

func (*DstMetaTestingSuite) TestGetMetaNormal

func (t *DstMetaTestingSuite) TestGetMetaNormal(c *check.C)

测试正常获取元数据实例

type InstanceMetadataAndNum

type InstanceMetadataAndNum struct {
	// contains filtered or unexported fields
}

InstanceMetadataAndNum 测试实例的 metadata 和 num

type NearbyTestingSuite

type NearbyTestingSuite struct {
	// contains filtered or unexported fields
}

NearbyTestingSuite 路由API测试套

func (*NearbyTestingSuite) GetName

func (t *NearbyTestingSuite) GetName() string

套件名字

func (*NearbyTestingSuite) SetUpSuite

func (t *NearbyTestingSuite) SetUpSuite(c *check.C)

设置模拟桩服务器

func (*NearbyTestingSuite) TearDownSuite

func (t *NearbyTestingSuite) TearDownSuite(c *check.C)

SetUpSuite 结束测试套程序

func (*NearbyTestingSuite) TestCase10

func (t *NearbyTestingSuite) TestCase10(c *check.C)

func (*NearbyTestingSuite) TestCase11

func (t *NearbyTestingSuite) TestCase11(c *check.C)

func (*NearbyTestingSuite) TestCase2

func (t *NearbyTestingSuite) TestCase2(c *check.C)

recover percent: 0.2,开启降级,降级percent:100,matchLevel:zone,lowestMatchLevel:"" A-a-0实例:3个健康,1个不健康 A-b-1实例:3个健康 B-b-2实例:10个健康A-b-1实例 期望:返回3个健康A-a-0实例(不降级,健康实例比例为0.75)

func (*NearbyTestingSuite) TestCase3

func (t *NearbyTestingSuite) TestCase3(c *check.C)

recover percent: 0.2,开启降级,降级percent:100,matchLevel:zone,lowestMatchLevel:"" A-a-0实例:4个不健康 A-b-1实例:4个不健康 B-b-2实例:4个健康 期望:返回4个健康B-b-2实例(降级到"",健康实例比例为0.333)

func (*NearbyTestingSuite) TestCase4

func (t *NearbyTestingSuite) TestCase4(c *check.C)

recover percent: 0.2,开启降级,降级percent:100,matchLevel:zone,lowestMatchLevel:"" A-a-0实例:4个不健康 A-b-1实例:4个不健康 B-b-2实例:4个不健康 期望:返回4个不健康A-a-0实例(不降级,触发全死全活)

func (*NearbyTestingSuite) TestCase5

func (t *NearbyTestingSuite) TestCase5(c *check.C)

recover percent: 0.2,开启降级,降级percent:100,matchLevel:zone,lowestMatchLevel:"" A-a-0实例:0个 A-b-1实例:4个不健康 B-b-2实例:4个不健康 期望:返回4个健康B-b-2实例(降级到region,触发全死全活)

func (*NearbyTestingSuite) TestCase6

func (t *NearbyTestingSuite) TestCase6(c *check.C)

recover percent: 0.2,开启降级,降级percent:100,matchLevel:campus,lowestMatchLevel:zone A-a-0实例:0个 A-b-1实例:4个不健康 B-b-2实例:4个不健康 期望:返回错误,在zone和campus两个级别之间没有足够的实例

func (*NearbyTestingSuite) TestCase7

func (t *NearbyTestingSuite) TestCase7(c *check.C)

recover percent: 0.2,不开启降级,matchLevel:zone A-a-0实例:4个不健康 A-b-1实例:4个健康 B-b-2实例:4个健康 期望:开启全死全活,返回4个不健康A-a-0实例(不降级,触发全死全活);关闭全死全活,不返回实例

func (*NearbyTestingSuite) TestCase8

func (t *NearbyTestingSuite) TestCase8(c *check.C)

recover percent: 0.2,开启降级,降级percent:50,matchLevel:zone,lowestMatchLevel:"" A-a-0实例:2个健康,2个不健康 A-b-1实例:2个健康 B-b-2实例:4个健康 期望:返回2个健康A-a-0实例和2个健康A-b-1实例(降级到region,不触发全死全活)

func (*NearbyTestingSuite) TestCase9

func (t *NearbyTestingSuite) TestCase9(c *check.C)

func (*NearbyTestingSuite) TestCaseNB1

func (t *NearbyTestingSuite) TestCaseNB1(c *check.C)

recover percent: 0.2,开启降级,降级percent:100,matchLevel:zone,lowestMatchLevel:"" A-a-0实例:3个不健康 A-b-1实例:3个健康,6个不健康 B-b-2实例:10个健康A-b-1实例 期望:返回3个健康A-b-1实例(降级到region,健康实例比例为3/(3+3+6)=0.25)

func (*NearbyTestingSuite) TestEnabledNearbyWithIDC

func (t *NearbyTestingSuite) TestEnabledNearbyWithIDC(c *check.C)

进行就近路由时,匹配到idc级别

func (*NearbyTestingSuite) TestEnabledNearbyWithoutIDC

func (t *NearbyTestingSuite) TestEnabledNearbyWithoutIDC(c *check.C)

进行就近路由匹配,以城市为最小级别

func (*NearbyTestingSuite) TestMetadataNearby

func (t *NearbyTestingSuite) TestMetadataNearby(c *check.C)

测试由metadata控制就近路由的开启

func (*NearbyTestingSuite) TestStrictNearby

func (t *NearbyTestingSuite) TestStrictNearby(c *check.C)

测试strictnearby的效果

type RuleRoutingTestingSuite

type RuleRoutingTestingSuite struct {
	// contains filtered or unexported fields
}

RuleRoutingTestingSuite 规则路由API测试套

func (*RuleRoutingTestingSuite) GetName

func (t *RuleRoutingTestingSuite) GetName() string

GetName 套件名字

func (*RuleRoutingTestingSuite) RegisterInstancesWithMetadataAndNum

func (t *RuleRoutingTestingSuite) RegisterInstancesWithMetadataAndNum(svc *service_manage.Service, metadatas []*InstanceMetadataAndNum)

RegisterInstancesWithMetadataAndNum 测试实例的 metadata 和 num

func (*RuleRoutingTestingSuite) SetUpSuite

func (t *RuleRoutingTestingSuite) SetUpSuite(c *check.C)

SetUpSuite 设置模拟桩服务器

func (*RuleRoutingTestingSuite) TearDownSuite

func (t *RuleRoutingTestingSuite) TearDownSuite(c *check.C)

TearDownSuite 结束测试套程序

func (*RuleRoutingTestingSuite) TestBadVariable

func (t *RuleRoutingTestingSuite) TestBadVariable(c *check.C)

TestBadVariable test bad variable

func (*RuleRoutingTestingSuite) TestDestPriority

func (t *RuleRoutingTestingSuite) TestDestPriority(c *check.C)

TestDestPriority 测试目标规则的优先级

func (*RuleRoutingTestingSuite) TestDestWeight

func (t *RuleRoutingTestingSuite) TestDestWeight(c *check.C)

TestDestWeight 测试目标规则的weight(包括0权重)

func (*RuleRoutingTestingSuite) TestHasInvalidRules

func (t *RuleRoutingTestingSuite) TestHasInvalidRules(c *check.C)

TestHasInvalidRules test has invalid rules

func (*RuleRoutingTestingSuite) TestHasNoRules

func (t *RuleRoutingTestingSuite) TestHasNoRules(c *check.C)

TestHasNoRules test has no rules

func (*RuleRoutingTestingSuite) TestInboundAddAndDelete

func (t *RuleRoutingTestingSuite) TestInboundAddAndDelete(c *check.C)

TestInboundAddAndDelete 测试inbound add and delete

func (*RuleRoutingTestingSuite) TestInboundNoSourceService

func (t *RuleRoutingTestingSuite) TestInboundNoSourceService(c *check.C)

TestInboundNoSourceService 测试只有入流量规则的前提下,不传入sourceService能否成功路由

func (*RuleRoutingTestingSuite) TestInboundNoSources

func (t *RuleRoutingTestingSuite) TestInboundNoSources(c *check.C)

TestInboundNoSources 测试inbound no sources

func (*RuleRoutingTestingSuite) TestInboundRuleRegex

func (t *RuleRoutingTestingSuite) TestInboundRuleRegex(c *check.C)

TestInboundRuleRegex 测试正则匹配inbound rules

func (*RuleRoutingTestingSuite) TestInboundRules

func (t *RuleRoutingTestingSuite) TestInboundRules(c *check.C)

TestInboundRules inbound rules

func (*RuleRoutingTestingSuite) TestMatchInboundAndOutboundRules

func (t *RuleRoutingTestingSuite) TestMatchInboundAndOutboundRules(c *check.C)

TestMatchInboundAndOutboundRules match inbound & outbound rules

func (*RuleRoutingTestingSuite) TestMatchMissingRouteRule

func (t *RuleRoutingTestingSuite) TestMatchMissingRouteRule(c *check.C)

TestMatchMissingRouteRule 测试匹配残缺的路由规则

func (*RuleRoutingTestingSuite) TestMultiBaseEnvWithVariable

func (t *RuleRoutingTestingSuite) TestMultiBaseEnvWithVariable(c *check.C)

TestMultiBaseEnvWithVariable 服务实例:2个基线环境b,2个特性环境f case1:metadata带上特性环境名f,variable设置为基线环境名b,访问到特性环境f case2: metadata不带上环境名,variable设置为基线环境名b,访问到基线环境b case3:metadata不带上环境名,variable设置为不存在的基线环境名b1,返回错误

func (*RuleRoutingTestingSuite) TestMultiVariables

func (t *RuleRoutingTestingSuite) TestMultiVariables(c *check.C)

TestMultiVariables 服务实例:2个基线环境b,2个特性环境f

func (*RuleRoutingTestingSuite) TestMultipleParameters

func (t *RuleRoutingTestingSuite) TestMultipleParameters(c *check.C)

TestMultipleParameters 服务实例:2个基线环境b,2个特性环境f

func (*RuleRoutingTestingSuite) TestOneBaseEnvWithParameter

func (t *RuleRoutingTestingSuite) TestOneBaseEnvWithParameter(c *check.C)

TestOneBaseEnvWithParameter 使用parameter路由,进行基线特性环境匹配

func (*RuleRoutingTestingSuite) TestOutboundRules

func (t *RuleRoutingTestingSuite) TestOutboundRules(c *check.C)

TestOutboundRules inbound rules

func (*RuleRoutingTestingSuite) TestParameterRegex

func (t *RuleRoutingTestingSuite) TestParameterRegex(c *check.C)

TestParameterRegex test parameter regex

func (*RuleRoutingTestingSuite) TestReturnDefault

func (t *RuleRoutingTestingSuite) TestReturnDefault(c *check.C)

TestReturnDefault return default(兜底)

func (*RuleRoutingTestingSuite) TestVariableRegex

func (t *RuleRoutingTestingSuite) TestVariableRegex(c *check.C)

TestVariableRegex test variable regex

type SetDivisionTestingSuite

type SetDivisionTestingSuite struct {
	// contains filtered or unexported fields
}

SetDivisionTestingSuite set分组API测试套

func (*SetDivisionTestingSuite) GetName

func (t *SetDivisionTestingSuite) GetName() string

GetName 套件名字

func (*SetDivisionTestingSuite) SetUpSuite

func (t *SetDivisionTestingSuite) SetUpSuite(c *check.C)

SetUpSuite 设置模拟桩

func (*SetDivisionTestingSuite) TearDownSuite

func (t *SetDivisionTestingSuite) TearDownSuite(c *check.C)

TearDownSuite 结束测试套程序

func (*SetDivisionTestingSuite) TestAllGroup

func (t *SetDivisionTestingSuite) TestAllGroup(c *check.C)

TestAllGroup 测试主调的 set分组为*的情况

func (*SetDivisionTestingSuite) TestDestinationSet

func (t *SetDivisionTestingSuite) TestDestinationSet(c *check.C)

TestDestinationSet 测试使用了destination set的情况

func (*SetDivisionTestingSuite) TestDstNotSet

func (t *SetDivisionTestingSuite) TestDstNotSet(c *check.C)

TestDstNotSet 测试被调没启用set的情况

func (*SetDivisionTestingSuite) TestNoSet

func (t *SetDivisionTestingSuite) TestNoSet(c *check.C)

TestNoSet 测试主调没启用set的情况

func (*SetDivisionTestingSuite) TestSameGroup

func (t *SetDivisionTestingSuite) TestSameGroup(c *check.C)

TestSameGroup 测试没有本分组,匹配最后的情况

func (*SetDivisionTestingSuite) TestSetExcatMatch

func (t *SetDivisionTestingSuite) TestSetExcatMatch(c *check.C)

TestSetExcatMatch 测试set刚好匹配的情况

func (*SetDivisionTestingSuite) TestSetNotMatch

func (t *SetDivisionTestingSuite) TestSetNotMatch(c *check.C)

TestSetNotMatch 启用set了,但set不匹配,返回空

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL