Documentation ¶
Index ¶
- Constants
- type AppIdResult
- type CommonRateLimitSuite
- type IndexResult
- type LocalNormalTestingSuite
- func (rt *LocalNormalTestingSuite) GetName() string
- func (rt *LocalNormalTestingSuite) SetUpSuite(c *check.C)
- func (rt *LocalNormalTestingSuite) TearDownSuite(c *check.C)
- func (rt *LocalNormalTestingSuite) TestLocalRegexCombine(c *check.C)
- func (rt *LocalNormalTestingSuite) TestLocalRegexSpread(c *check.C)
- type MockRateLimitServer
- func (m *MockRateLimitServer) MarkOperation4XX(operation string)
- func (m *MockRateLimitServer) MarkOperationDelay(operation string)
- func (m *MockRateLimitServer) MarkOperationNoReturn(operation string)
- func (m *MockRateLimitServer) Reset()
- func (m *MockRateLimitServer) Service(stream ratelimiter.RateLimitGRPCV2_ServiceServer) error
- func (m *MockRateLimitServer) SetClientKey(uid string, key uint32)
- func (m *MockRateLimitServer) SetMockMaxAmount(v int64)
- func (m *MockRateLimitServer) TimeAdjust(ctx context.Context, adjustReq *ratelimiter.TimeAdjustRequest) (*ratelimiter.TimeAdjustResponse, error)
- type RemoteNormalTestingSuite
- func (rt *RemoteNormalTestingSuite) GetName() string
- func (rt *RemoteNormalTestingSuite) SetUpSuite(c *check.C)
- func (rt *RemoteNormalTestingSuite) TearDownSuite(c *check.C)
- func (rt *RemoteNormalTestingSuite) TestRemoteRegexCombineV2(c *check.C)
- func (rt *RemoteNormalTestingSuite) TestRemoteRegexV2(c *check.C)
- func (rt *RemoteNormalTestingSuite) TestRemoteShareEqually(c *check.C)
- func (rt *RemoteNormalTestingSuite) TestRemoteTwoDuration(c *check.C)
- type RuleChangeTestingSuite
- func (rt *RuleChangeTestingSuite) GetName() string
- func (rt *RuleChangeTestingSuite) SetUpSuite(c *check.C)
- func (rt *RuleChangeTestingSuite) TearDownSuite(c *check.C)
- func (rt *RuleChangeTestingSuite) TestAmountChangedV2(c *check.C)
- func (rt *RuleChangeTestingSuite) TestLabelsChanged(c *check.C)
- func (rt *RuleChangeTestingSuite) TestRuleDeleted(c *check.C)
- func (rt *RuleChangeTestingSuite) TestRuleDisabledV2(c *check.C)
- func (rt *RuleChangeTestingSuite) TestServiceDeleted(c *check.C)
- type WindowExpireTestingSuite
- func (rt *WindowExpireTestingSuite) GetName() string
- func (rt *WindowExpireTestingSuite) SetUpSuite(c *check.C)
- func (rt *WindowExpireTestingSuite) TearDownSuite(c *check.C)
- func (rt *WindowExpireTestingSuite) TestUinExpiredLocal(c *check.C)
- func (rt *WindowExpireTestingSuite) TestUinExpiredRemote(c *check.C)
Constants ¶
View Source
const ( NotExistsRateLimitName = "polaris.metric.test.not.exists" LocalTestSvcName = "LocalTestSvcV2" RemoteTestSvcName = "RemoteTestSvcV2" WindowExpireSvcName = "ExpireTestSvcV2" RuleChangeSvcName = "RuleChangeTestSvcV2" RuleDeletedSvcName = "RuleDeleteTestSvcV2" SvcDeletedSvcName = "ServiceDeleteTestSvcV2" NetworkFailSvcName = "NetworkFailTestSvcV2" )
View Source
const ( // 初始化 OperationInit = "init" // 上报 OperationReport = "report" )
View Source
const (
NotExistRateLimitPort = 10090
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonRateLimitSuite ¶
type CommonRateLimitSuite struct {
// contains filtered or unexported fields
}
限流通用的测试套
func (*CommonRateLimitSuite) SetUpSuite ¶
func (cr *CommonRateLimitSuite) SetUpSuite(c *check.C, startRemote bool)
SetUpSuite 启动测试套程序
func (*CommonRateLimitSuite) TearDownSuite ¶
func (cr *CommonRateLimitSuite) TearDownSuite(c *check.C, s util.NamingTestSuite)
SetUpSuite 结束测试套程序
type LocalNormalTestingSuite ¶
type LocalNormalTestingSuite struct {
CommonRateLimitSuite
}
直接拒绝正常用例测试
func (*LocalNormalTestingSuite) SetUpSuite ¶
func (rt *LocalNormalTestingSuite) SetUpSuite(c *check.C)
SetUpSuite 启动测试套程序
func (*LocalNormalTestingSuite) TearDownSuite ¶
func (rt *LocalNormalTestingSuite) TearDownSuite(c *check.C)
SetUpSuite 结束测试套程序
func (*LocalNormalTestingSuite) TestLocalRegexCombine ¶
func (rt *LocalNormalTestingSuite) TestLocalRegexCombine(c *check.C)
TestLocalRegexCombine 测试本地正则合并匹配限流
func (*LocalNormalTestingSuite) TestLocalRegexSpread ¶
func (rt *LocalNormalTestingSuite) TestLocalRegexSpread(c *check.C)
测试本地精准匹配限流
type MockRateLimitServer ¶
type MockRateLimitServer struct {
// contains filtered or unexported fields
}
只模拟server异常接口场景,不模拟正常场景
func (*MockRateLimitServer) MarkOperation4XX ¶
func (m *MockRateLimitServer) MarkOperation4XX(operation string)
标识某个接口固定返回4XX
func (*MockRateLimitServer) MarkOperationDelay ¶
func (m *MockRateLimitServer) MarkOperationDelay(operation string)
标识某个接口延迟一个周期
func (*MockRateLimitServer) MarkOperationNoReturn ¶
func (m *MockRateLimitServer) MarkOperationNoReturn(operation string)
标识某个接口不返回应答
func (*MockRateLimitServer) Service ¶
func (m *MockRateLimitServer) Service(stream ratelimiter.RateLimitGRPCV2_ServiceServer) error
消息处理接口
func (*MockRateLimitServer) SetClientKey ¶
func (m *MockRateLimitServer) SetClientKey(uid string, key uint32)
设置clientKey
func (*MockRateLimitServer) SetMockMaxAmount ¶
func (m *MockRateLimitServer) SetMockMaxAmount(v int64)
设置最大限流阈值
func (*MockRateLimitServer) TimeAdjust ¶
func (m *MockRateLimitServer) TimeAdjust(ctx context.Context, adjustReq *ratelimiter.TimeAdjustRequest) (*ratelimiter.TimeAdjustResponse, error)
时间对齐接口
type RemoteNormalTestingSuite ¶
type RemoteNormalTestingSuite struct {
CommonRateLimitSuite
}
远程正常用例测试
func (*RemoteNormalTestingSuite) GetName ¶
func (rt *RemoteNormalTestingSuite) GetName() string
用例名称
func (*RemoteNormalTestingSuite) SetUpSuite ¶
func (rt *RemoteNormalTestingSuite) SetUpSuite(c *check.C)
SetUpSuite 启动测试套程序
func (*RemoteNormalTestingSuite) TearDownSuite ¶
func (rt *RemoteNormalTestingSuite) TearDownSuite(c *check.C)
SetUpSuite 结束测试套程序
func (*RemoteNormalTestingSuite) TestRemoteRegexCombineV2 ¶
func (rt *RemoteNormalTestingSuite) TestRemoteRegexCombineV2(c *check.C)
测试正则表达式的uin限流
func (*RemoteNormalTestingSuite) TestRemoteRegexV2 ¶
func (rt *RemoteNormalTestingSuite) TestRemoteRegexV2(c *check.C)
测试正则表达式的uin限流
func (*RemoteNormalTestingSuite) TestRemoteShareEqually ¶
func (rt *RemoteNormalTestingSuite) TestRemoteShareEqually(c *check.C)
测试单机均摊模式限流
func (*RemoteNormalTestingSuite) TestRemoteTwoDuration ¶
func (rt *RemoteNormalTestingSuite) TestRemoteTwoDuration(c *check.C)
测试远程精准匹配限流
type RuleChangeTestingSuite ¶
type RuleChangeTestingSuite struct {
CommonRateLimitSuite
}
测试规则变更的测试套
func (*RuleChangeTestingSuite) SetUpSuite ¶
func (rt *RuleChangeTestingSuite) SetUpSuite(c *check.C)
SetUpSuite 启动测试套程序
func (*RuleChangeTestingSuite) TearDownSuite ¶
func (rt *RuleChangeTestingSuite) TearDownSuite(c *check.C)
SetUpSuite 结束测试套程序
func (*RuleChangeTestingSuite) TestAmountChangedV2 ¶
func (rt *RuleChangeTestingSuite) TestAmountChangedV2(c *check.C)
测试限流配额发生变更
func (*RuleChangeTestingSuite) TestLabelsChanged ¶
func (rt *RuleChangeTestingSuite) TestLabelsChanged(c *check.C)
测试限流标签发生变更
func (*RuleChangeTestingSuite) TestRuleDeleted ¶
func (rt *RuleChangeTestingSuite) TestRuleDeleted(c *check.C)
测试规则被删除
func (*RuleChangeTestingSuite) TestRuleDisabledV2 ¶
func (rt *RuleChangeTestingSuite) TestRuleDisabledV2(c *check.C)
测试规则被屏蔽
func (*RuleChangeTestingSuite) TestServiceDeleted ¶
func (rt *RuleChangeTestingSuite) TestServiceDeleted(c *check.C)
测试服务被删除
type WindowExpireTestingSuite ¶
type WindowExpireTestingSuite struct {
CommonRateLimitSuite
}
远程正常用例测试
func (*WindowExpireTestingSuite) GetName ¶
func (rt *WindowExpireTestingSuite) GetName() string
用例名称
func (*WindowExpireTestingSuite) SetUpSuite ¶
func (rt *WindowExpireTestingSuite) SetUpSuite(c *check.C)
SetUpSuite 启动测试套程序
func (*WindowExpireTestingSuite) TearDownSuite ¶
func (rt *WindowExpireTestingSuite) TearDownSuite(c *check.C)
SetUpSuite 结束测试套程序
func (*WindowExpireTestingSuite) TestUinExpiredLocal ¶
func (rt *WindowExpireTestingSuite) TestUinExpiredLocal(c *check.C)
测试UIN过期
func (*WindowExpireTestingSuite) TestUinExpiredRemote ¶
func (rt *WindowExpireTestingSuite) TestUinExpiredRemote(c *check.C)
测试UIN过期
Click to show internal directories.
Click to hide internal directories.