Skip to content
Snippets Groups Projects
Commit ed294ed3 authored by Xin.Zh's avatar Xin.Zh Committed by GitHub
Browse files

Merge pull request #625 from zhangymPerson/master

alter filter/*_test.go Rename testFuncName to match the regular expre…
parents 61a6c8e6 f714de93
No related branches found
No related tags found
No related merge requests found
Showing
with 38 additions and 38 deletions
......@@ -53,7 +53,7 @@ func TestAccessLogFilter_Invoke_Not_Config(t *testing.T) {
assert.Nil(t, result.Error())
}
func TestAccessLogFilter_Invoke_Default_Config(t *testing.T) {
func TestAccessLogFilterInvokeDefaultConfig(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
url, _ := common.NewURL(
......@@ -74,7 +74,7 @@ func TestAccessLogFilter_Invoke_Default_Config(t *testing.T) {
assert.Nil(t, result.Error())
}
func TestAccessLogFilter_OnResponse(t *testing.T) {
func TestAccessLogFilterOnResponse(t *testing.T) {
result := &protocol.RPCResult{}
accessLogFilter := GetAccessLogFilter()
response := accessLogFilter.OnResponse(nil, result, nil, nil)
......
......@@ -36,7 +36,7 @@ import (
"github.com/apache/dubbo-go/protocol/mock"
)
func TestActiveFilter_Invoke(t *testing.T) {
func TestActiveFilterInvoke(t *testing.T) {
invoc := invocation.NewRPCInvocation("test", []interface{}{"OK"}, make(map[string]string, 0))
url, _ := common.NewURL("dubbo://192.168.10.10:20000/com.ikurento.user.UserProvider")
filter := ActiveFilter{}
......@@ -50,7 +50,7 @@ func TestActiveFilter_Invoke(t *testing.T) {
}
func TestActiveFilter_OnResponse(t *testing.T) {
func TestActiveFilterOnResponse(t *testing.T) {
c := protocol.CurrentTimeMillis()
elapsed := 100
invoc := invocation.NewRPCInvocation("test", []interface{}{"OK"}, map[string]string{
......
......@@ -32,7 +32,7 @@ import (
"github.com/apache/dubbo-go/protocol/invocation"
)
func TestEchoFilter_Invoke(t *testing.T) {
func TestEchoFilterInvoke(t *testing.T) {
filter := GetFilter()
result := filter.Invoke(context.Background(), protocol.NewBaseInvoker(common.URL{}), invocation.NewRPCInvocation("$echo", []interface{}{"OK"}, nil))
assert.Equal(t, "OK", result.Result())
......
......@@ -34,7 +34,7 @@ import (
"github.com/apache/dubbo-go/protocol/invocation"
)
func TestExecuteLimitFilter_Invoke_Ignored(t *testing.T) {
func TestExecuteLimitFilterInvokeIgnored(t *testing.T) {
methodName := "hello"
invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]string, 0))
......@@ -49,7 +49,7 @@ func TestExecuteLimitFilter_Invoke_Ignored(t *testing.T) {
assert.Nil(t, result.Error())
}
func TestExecuteLimitFilter_Invoke_Configure_Error(t *testing.T) {
func TestExecuteLimitFilterInvokeConfigureError(t *testing.T) {
methodName := "hello1"
invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]string, 0))
......@@ -66,7 +66,7 @@ func TestExecuteLimitFilter_Invoke_Configure_Error(t *testing.T) {
assert.Nil(t, result.Error())
}
func TestExecuteLimitFilter_Invoke(t *testing.T) {
func TestExecuteLimitFilterInvoke(t *testing.T) {
methodName := "hello1"
invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]string, 0))
......
......@@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/assert"
)
func Test_struct2MapAll(t *testing.T) {
func TestStruct2MapAll(t *testing.T) {
var testData struct {
AaAa string `m:"aaAa"`
BaBa string
......@@ -64,7 +64,7 @@ type testStruct struct {
} `m:"xxYy"`
}
func Test_struct2MapAll_Slice(t *testing.T) {
func TestStruct2MapAllSlice(t *testing.T) {
var testData struct {
AaAa string `m:"aaAa"`
BaBa string
......@@ -89,7 +89,7 @@ func Test_struct2MapAll_Slice(t *testing.T) {
assert.Equal(t, reflect.Map, reflect.TypeOf(m["caCa"].([]interface{})[0].(map[string]interface{})["xxYy"]).Kind())
}
func Test_struct2MapAll_Map(t *testing.T) {
func TestStruct2MapAllMap(t *testing.T) {
var testData struct {
AaAa string
Baba map[string]interface{}
......
......@@ -77,7 +77,7 @@ func (*TestService) Reference() string {
return "com.test.Path"
}
func TestGenericServiceFilter_Invoke(t *testing.T) {
func TestGenericServiceFilterInvoke(t *testing.T) {
hessian.RegisterPOJO(&TestStruct{})
methodName := "$invoke"
m := make(map[string]interface{})
......@@ -105,7 +105,7 @@ func TestGenericServiceFilter_Invoke(t *testing.T) {
assert.Nil(t, result.Error())
}
func TestGenericServiceFilter_ResponseTestStruct(t *testing.T) {
func TestGenericServiceFilterResponseTestStruct(t *testing.T) {
ts := &TestStruct{
AaAa: "aaa",
BaBa: "bbb",
......@@ -130,7 +130,7 @@ func TestGenericServiceFilter_ResponseTestStruct(t *testing.T) {
assert.Equal(t, reflect.ValueOf(r.Result()).Kind(), reflect.Map)
}
func TestGenericServiceFilter_ResponseString(t *testing.T) {
func TestGenericServiceFilterResponseString(t *testing.T) {
str := "111"
result := &protocol.RPCResult{
Rest: str,
......
......@@ -38,7 +38,7 @@ import (
"github.com/apache/dubbo-go/protocol/invocation"
)
func TestGenericFilter_Invoke(t *testing.T) {
func TestGenericFilterInvoke(t *testing.T) {
invoc := invocation.NewRPCInvocation("GetUser", []interface{}{"OK"}, make(map[string]string, 0))
invokeUrl := common.NewURLWithOptions(
......
......@@ -90,7 +90,7 @@ func TestGetHystrixFilter(t *testing.T) {
assert.NotNil(t, filterGot)
}
func TestGetConfig_1(t *testing.T) {
func TestGetConfig1(t *testing.T) {
mockInitHystrixConfig()
configGot := getConfig("com.ikurento.user.UserProvider", "GetUser", true)
assert.NotNil(t, configGot)
......@@ -101,7 +101,7 @@ func TestGetConfig_1(t *testing.T) {
assert.Equal(t, 5, configGot.RequestVolumeThreshold)
}
func TestGetConfig_2(t *testing.T) {
func TestGetConfig2(t *testing.T) {
mockInitHystrixConfig()
configGot := getConfig("com.ikurento.user.UserProvider", "GetUser0", true)
assert.NotNil(t, configGot)
......@@ -112,7 +112,7 @@ func TestGetConfig_2(t *testing.T) {
assert.Equal(t, 15, configGot.RequestVolumeThreshold)
}
func TestGetConfig_3(t *testing.T) {
func TestGetConfig3(t *testing.T) {
mockInitHystrixConfig()
//This should use default
configGot := getConfig("Mock.Service", "GetMock", true)
......@@ -145,7 +145,7 @@ func (iv *testMockFailInvoker) Invoke(_ context.Context, _ protocol.Invocation)
}
}
func TestHystrixFilter_Invoke_Success(t *testing.T) {
func TestHystrixFilterInvokeSuccess(t *testing.T) {
hf := &HystrixFilter{}
result := hf.Invoke(context.Background(), &testMockSuccessInvoker{}, &invocation.RPCInvocation{})
assert.NotNil(t, result)
......@@ -153,14 +153,14 @@ func TestHystrixFilter_Invoke_Success(t *testing.T) {
assert.NotNil(t, result.Result())
}
func TestHystrixFilter_Invoke_Fail(t *testing.T) {
func TestHystrixFilterInvokeFail(t *testing.T) {
hf := &HystrixFilter{}
result := hf.Invoke(context.Background(), &testMockFailInvoker{}, &invocation.RPCInvocation{})
assert.NotNil(t, result)
assert.Error(t, result.Error())
}
func TestHystricFilter_Invoke_CircuitBreak(t *testing.T) {
func TestHystricFilterInvokeCircuitBreak(t *testing.T) {
mockInitHystrixConfig()
hystrix.Flush()
hf := &HystrixFilter{COrP: true}
......@@ -183,7 +183,7 @@ func TestHystricFilter_Invoke_CircuitBreak(t *testing.T) {
}
func TestHystricFilter_Invoke_CircuitBreak_Omit_Exception(t *testing.T) {
func TestHystricFilterInvokeCircuitBreakOmitException(t *testing.T) {
mockInitHystrixConfig()
hystrix.Flush()
reg, _ := regexp.Compile(".*exception.*")
......
......@@ -38,7 +38,7 @@ import (
"github.com/apache/dubbo-go/protocol/invocation"
)
func TestMetricsFilter_Invoke(t *testing.T) {
func TestMetricsFilterInvoke(t *testing.T) {
// prepare the mock reporter
config.GetMetricConfig().Reporters = []string{"mock"}
......
......@@ -34,7 +34,7 @@ import (
"github.com/apache/dubbo-go/protocol/invocation"
)
func TestTokenFilter_Invoke(t *testing.T) {
func TestTokenFilterInvoke(t *testing.T) {
filter := GetTokenFilter()
url := common.NewURLWithOptions(
......@@ -50,7 +50,7 @@ func TestTokenFilter_Invoke(t *testing.T) {
assert.Nil(t, result.Result())
}
func TestTokenFilter_InvokeEmptyToken(t *testing.T) {
func TestTokenFilterInvokeEmptyToken(t *testing.T) {
filter := GetTokenFilter()
url := common.URL{}
......@@ -61,7 +61,7 @@ func TestTokenFilter_InvokeEmptyToken(t *testing.T) {
assert.Nil(t, result.Result())
}
func TestTokenFilter_InvokeEmptyAttach(t *testing.T) {
func TestTokenFilterInvokeEmptyAttach(t *testing.T) {
filter := GetTokenFilter()
url := common.NewURLWithOptions(
......@@ -72,7 +72,7 @@ func TestTokenFilter_InvokeEmptyAttach(t *testing.T) {
assert.NotNil(t, result.Error())
}
func TestTokenFilter_InvokeNotEqual(t *testing.T) {
func TestTokenFilterInvokeNotEqual(t *testing.T) {
filter := GetTokenFilter()
url := common.NewURLWithOptions(
......
......@@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/assert"
)
func TestFixedWindowTpsLimitStrategyImpl_IsAllowable(t *testing.T) {
func TestFixedWindowTpsLimitStrategyImplIsAllowable(t *testing.T) {
creator := &fixedWindowStrategyCreator{}
strategy := creator.Create(2, 60000)
assert.True(t, strategy.IsAllowable())
......
......@@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/assert"
)
func TestSlidingWindowTpsLimitStrategyImpl_IsAllowable(t *testing.T) {
func TestSlidingWindowTpsLimitStrategyImplIsAllowable(t *testing.T) {
creator := &slidingWindowStrategyCreator{}
strategy := creator.Create(2, 60000)
assert.True(t, strategy.IsAllowable())
......
......@@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/assert"
)
func TestThreadSafeFixedWindowTpsLimitStrategyImpl_IsAllowable(t *testing.T) {
func TestThreadSafeFixedWindowTpsLimitStrategyImplIsAllowable(t *testing.T) {
creator := &threadSafeFixedWindowStrategyCreator{}
strategy := creator.Create(2, 60000)
assert.True(t, strategy.IsAllowable())
......
......@@ -34,7 +34,7 @@ import (
"github.com/apache/dubbo-go/protocol/invocation"
)
func TestMethodServiceTpsLimiterImpl_IsAllowable_Only_Service_Level(t *testing.T) {
func TestMethodServiceTpsLimiterImplIsAllowableOnlyServiceLevel(t *testing.T) {
methodName := "hello"
invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]string, 0))
......@@ -61,7 +61,7 @@ func TestMethodServiceTpsLimiterImpl_IsAllowable_Only_Service_Level(t *testing.T
assert.True(t, result)
}
func TestMethodServiceTpsLimiterImpl_IsAllowable_No_Config(t *testing.T) {
func TestMethodServiceTpsLimiterImplIsAllowableNoConfig(t *testing.T) {
methodName := "hello1"
invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]string, 0))
// ctrl := gomock.NewController(t)
......@@ -77,7 +77,7 @@ func TestMethodServiceTpsLimiterImpl_IsAllowable_No_Config(t *testing.T) {
assert.True(t, result)
}
func TestMethodServiceTpsLimiterImpl_IsAllowable_Method_Level_Override(t *testing.T) {
func TestMethodServiceTpsLimiterImplIsAllowableMethodLevelOverride(t *testing.T) {
methodName := "hello2"
methodConfigPrefix := "methods." + methodName + "."
invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]string, 0))
......@@ -110,7 +110,7 @@ func TestMethodServiceTpsLimiterImpl_IsAllowable_Method_Level_Override(t *testin
assert.True(t, result)
}
func TestMethodServiceTpsLimiterImpl_IsAllowable_Both_Method_And_Service(t *testing.T) {
func TestMethodServiceTpsLimiterImplIsAllowableBothMethodAndService(t *testing.T) {
methodName := "hello3"
methodConfigPrefix := "methods." + methodName + "."
invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]string, 0))
......
......@@ -39,7 +39,7 @@ import (
"github.com/apache/dubbo-go/protocol/invocation"
)
func TestTpsLimitFilter_Invoke_With_No_TpsLimiter(t *testing.T) {
func TestTpsLimitFilterInvokeWithNoTpsLimiter(t *testing.T) {
tpsFilter := GetTpsLimitFilter()
invokeUrl := common.NewURLWithOptions(
common.WithParams(url.Values{}),
......@@ -55,7 +55,7 @@ func TestTpsLimitFilter_Invoke_With_No_TpsLimiter(t *testing.T) {
}
func TestGenericFilter_Invoke_With_Default_TpsLimiter(t *testing.T) {
func TestGenericFilterInvokeWithDefaultTpsLimiter(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockLimiter := tps.NewMockTpsLimiter(ctrl)
......@@ -78,7 +78,7 @@ func TestGenericFilter_Invoke_With_Default_TpsLimiter(t *testing.T) {
assert.Nil(t, result.Result())
}
func TestGenericFilter_Invoke_With_Default_TpsLimiter_Not_Allow(t *testing.T) {
func TestGenericFilterInvokeWithDefaultTpsLimiterNotAllow(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockLimiter := tps.NewMockTpsLimiter(ctrl)
......
......@@ -36,7 +36,7 @@ import (
"github.com/apache/dubbo-go/protocol/invocation"
)
func TestTracingFilter_Invoke(t *testing.T) {
func TestTracingFilterInvoke(t *testing.T) {
url, _ := common.NewURL(
"dubbo://:20000/UserProvider?app.version=0.0.1&application=BDTService&bean.name=UserProvider" +
"&cluster=failover&environment=dev&group=&interface=com.ikurento.user.UserProvider&loadbalance=random&methods.GetUser." +
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment