From 456d5d2db5579cb2ef5e41441207094932b0cd9d Mon Sep 17 00:00:00 2001 From: relaxedCat <470109166@qq.com> Date: Tue, 23 Jun 2020 19:56:21 +0800 Subject: [PATCH] fix issue #616 fix gitee sonar code check --- common/config/environment.go | 2 +- common/config/environment_test.go | 6 +-- common/extension/health_checker.go | 2 +- common/extension/health_checker_test.go | 2 +- common/extension/metrics_test.go | 1 + common/extension/registry.go | 2 +- common/extension/rest_client.go | 2 +- common/extension/service_discovery.go | 2 +- common/proxy/proxy_factory/default.go | 2 +- common/proxy/proxy_factory/default_test.go | 6 +-- common/proxy/proxy_test.go | 4 +- common/rpc_service.go | 1 - common/rpc_service_test.go | 54 +++++++++++++--------- common/url.go | 7 +-- common/url_test.go | 52 ++++++++++++--------- common/yaml/yaml_test.go | 2 +- 16 files changed, 81 insertions(+), 66 deletions(-) diff --git a/common/config/environment.go b/common/config/environment.go index 446c46aa1e..44cdd1fca1 100644 --- a/common/config/environment.go +++ b/common/config/environment.go @@ -131,7 +131,7 @@ func (conf *InmemoryConfiguration) GetSubProperty(subKey string) map[string]stru } properties := make(map[string]struct{}) - conf.store.Range(func(key, value interface{}) bool { + conf.store.Range(func(key, _ interface{}) bool { if idx := strings.Index(key.(string), subKey); idx >= 0 { after := key.(string)[idx+len(subKey):] if i := strings.Index(after, "."); i >= 0 { diff --git a/common/config/environment_test.go b/common/config/environment_test.go index 2d84dc4ae3..183071b0ef 100644 --- a/common/config/environment_test.go +++ b/common/config/environment_test.go @@ -29,14 +29,14 @@ func TestGetEnvInstance(t *testing.T) { assert.NotNil(t, instance) } -func TestEnvironment_UpdateExternalConfigMap(t *testing.T) { +func TestEnvironmentUpdateExternalConfigMap(t *testing.T) { GetEnvInstance().UpdateExternalConfigMap(map[string]string{"1": "2"}) v, ok := GetEnvInstance().externalConfigMap.Load("1") assert.True(t, ok) assert.Equal(t, "2", v) } -func TestEnvironment_ConfigurationAndGetProperty(t *testing.T) { +func TestEnvironmentConfigurationAndGetProperty(t *testing.T) { GetEnvInstance().UpdateExternalConfigMap(map[string]string{"1": "2"}) list := GetEnvInstance().Configuration() ok, v := list.Back().Value.(*InmemoryConfiguration).GetProperty("1") @@ -44,7 +44,7 @@ func TestEnvironment_ConfigurationAndGetProperty(t *testing.T) { assert.Equal(t, "2", v) } -func TestInmemoryConfiguration_GetSubProperty(t *testing.T) { +func TestInmemoryConfigurationGetSubProperty(t *testing.T) { GetEnvInstance().UpdateExternalConfigMap(map[string]string{"123": "2"}) list := GetEnvInstance().Configuration() m := list.Front().Value.(*InmemoryConfiguration).GetSubProperty("1") diff --git a/common/extension/health_checker.go b/common/extension/health_checker.go index 548d4dc761..8def727614 100644 --- a/common/extension/health_checker.go +++ b/common/extension/health_checker.go @@ -27,7 +27,7 @@ var ( ) // SethealthChecker sets the HealthChecker with @name -func SethealthChecker(name string, fcn func(url *common.URL) router.HealthChecker) { +func SethealthChecker(name string, fcn func(_ *common.URL) router.HealthChecker) { healthCheckers[name] = fcn } diff --git a/common/extension/health_checker_test.go b/common/extension/health_checker_test.go index ec934e6e9c..4e83a6f6e1 100644 --- a/common/extension/health_checker_test.go +++ b/common/extension/health_checker_test.go @@ -44,6 +44,6 @@ func (m mockHealthChecker) IsHealthy(invoker protocol.Invoker) bool { return true } -func newMockhealthCheck(url *common.URL) router.HealthChecker { +func newMockhealthCheck(_ *common.URL) router.HealthChecker { return &mockHealthChecker{} } diff --git a/common/extension/metrics_test.go b/common/extension/metrics_test.go index 6a8a3fe538..2aaae75f0c 100644 --- a/common/extension/metrics_test.go +++ b/common/extension/metrics_test.go @@ -45,5 +45,6 @@ func TestGetMetricReporter(t *testing.T) { type mockReporter struct { } +// Report method for feature expansion func (m mockReporter) Report(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation, cost time.Duration, res protocol.Result) { } diff --git a/common/extension/registry.go b/common/extension/registry.go index 542a2206c0..187c8fecf4 100644 --- a/common/extension/registry.go +++ b/common/extension/registry.go @@ -27,7 +27,7 @@ var ( ) // SetRegistry sets the registry extension with @name -func SetRegistry(name string, v func(config *common.URL) (registry.Registry, error)) { +func SetRegistry(name string, v func(_ *common.URL) (registry.Registry, error)) { registrys[name] = v } diff --git a/common/extension/rest_client.go b/common/extension/rest_client.go index 9caf8c67df..0c2f4ddf95 100644 --- a/common/extension/rest_client.go +++ b/common/extension/rest_client.go @@ -26,7 +26,7 @@ var ( ) // SetRestClient sets the RestClient with @name -func SetRestClient(name string, fun func(restOptions *client.RestOptions) client.RestClient) { +func SetRestClient(name string, fun func(_ *client.RestOptions) client.RestClient) { restClients[name] = fun } diff --git a/common/extension/service_discovery.go b/common/extension/service_discovery.go index d70b032306..1d891c2189 100644 --- a/common/extension/service_discovery.go +++ b/common/extension/service_discovery.go @@ -30,7 +30,7 @@ var ( ) // SetServiceDiscovery will store the @creator and @name -func SetServiceDiscovery(name string, creator func(url *common.URL) (registry.ServiceDiscovery, error)) { +func SetServiceDiscovery(name string, creator func(_ *common.URL) (registry.ServiceDiscovery, error)) { discoveryCreatorMap[name] = creator } diff --git a/common/proxy/proxy_factory/default.go b/common/proxy/proxy_factory/default.go index 1bb1e29c5c..1b8ca22201 100644 --- a/common/proxy/proxy_factory/default.go +++ b/common/proxy/proxy_factory/default.go @@ -54,7 +54,7 @@ type DefaultProxyFactory struct { //} // NewDefaultProxyFactory returns a proxy factory instance -func NewDefaultProxyFactory(options ...proxy.Option) proxy.ProxyFactory { +func NewDefaultProxyFactory(_ ...proxy.Option) proxy.ProxyFactory { return &DefaultProxyFactory{} } diff --git a/common/proxy/proxy_factory/default_test.go b/common/proxy/proxy_factory/default_test.go index 7159b4b00e..99d5c020f4 100644 --- a/common/proxy/proxy_factory/default_test.go +++ b/common/proxy/proxy_factory/default_test.go @@ -31,7 +31,7 @@ import ( "github.com/apache/dubbo-go/protocol" ) -func Test_GetProxy(t *testing.T) { +func TestGetProxy(t *testing.T) { proxyFactory := NewDefaultProxyFactory() url := common.NewURLWithOptions() proxy := proxyFactory.GetProxy(protocol.NewBaseInvoker(*url), url) @@ -45,7 +45,7 @@ func (u *TestAsync) CallBack(res common.CallbackResponse) { fmt.Println("CallBack res:", res) } -func Test_GetAsyncProxy(t *testing.T) { +func TestGetAsyncProxy(t *testing.T) { proxyFactory := NewDefaultProxyFactory() url := common.NewURLWithOptions() async := &TestAsync{} @@ -53,7 +53,7 @@ func Test_GetAsyncProxy(t *testing.T) { assert.NotNil(t, proxy) } -func Test_GetInvoker(t *testing.T) { +func TestGetInvoker(t *testing.T) { proxyFactory := NewDefaultProxyFactory() url := common.NewURLWithOptions() invoker := proxyFactory.GetInvoker(*url) diff --git a/common/proxy/proxy_test.go b/common/proxy/proxy_test.go index 8c1c0295d0..14b2befbc4 100644 --- a/common/proxy/proxy_test.go +++ b/common/proxy/proxy_test.go @@ -53,7 +53,7 @@ func (s *TestServiceInt) Reference() string { return "com.test.TestServiceInt" } -func TestProxy_Implement(t *testing.T) { +func TestProxyImplement(t *testing.T) { invoker := protocol.NewBaseInvoker(common.URL{}) p := NewProxy(invoker, nil, map[string]string{constant.ASYNC_KEY: "false"}) @@ -84,7 +84,7 @@ func TestProxy_Implement(t *testing.T) { TestService methodOne func(context.Context, interface{}, *struct{}) error } - s1 := &S1{TestService: *s, methodOne: func(i context.Context, i2 interface{}, i3 *struct{}) error { + s1 := &S1{TestService: *s, methodOne: func(_ context.Context, _ interface{}, _ *struct{}) error { return perrors.New("errors") }} p.Implement(s1) diff --git a/common/rpc_service.go b/common/rpc_service.go index 211e4eae9c..05ca3721d9 100644 --- a/common/rpc_service.go +++ b/common/rpc_service.go @@ -68,7 +68,6 @@ var ( typeOfError = reflect.TypeOf((*error)(nil)).Elem() // ServiceMap store description of service. - // todo: lowerecas? ServiceMap = &serviceMap{ serviceMap: make(map[string]map[string]*Service), interfaceMap: make(map[string][]*Service), diff --git a/common/rpc_service_test.go b/common/rpc_service_test.go index 2311205d0e..7c4eb421d7 100644 --- a/common/rpc_service_test.go +++ b/common/rpc_service_test.go @@ -27,6 +27,14 @@ import ( "github.com/stretchr/testify/assert" ) +const ( + referenceTestPath = "com.test.Path" + referenceTestPathDistinct = "com.test.Path1" + testInterfaceName = "testService" + testProtocol = "testprotocol" + testSuiteMethodExpectedString = "interface {}" +) + type TestService struct { } @@ -40,7 +48,7 @@ func (s *TestService) MethodThree() error { return nil } func (s *TestService) Reference() string { - return "com.test.Path" + return referenceTestPath } func (s *TestService) MethodMapper() map[string]string { return map[string]string{ @@ -63,36 +71,36 @@ func (s *testService) Method4(ctx context.Context, args []interface{}, rsp *stru return nil } func (s *testService) Reference() string { - return "com.test.Path" + return referenceTestPath } type TestService1 struct { } func (s *TestService1) Reference() string { - return "com.test.Path1" + return referenceTestPathDistinct } -func TestServiceMap_Register(t *testing.T) { +func TestServiceMapRegister(t *testing.T) { // lowercase s0 := &testService{} // methods, err := ServiceMap.Register("testporotocol", s0) - _, err := ServiceMap.Register("testService", "testporotocol", s0) + _, err := ServiceMap.Register(testInterfaceName, "testporotocol", s0) assert.EqualError(t, err, "type testService is not exported") // succ s := &TestService{} - methods, err := ServiceMap.Register("testService", "testporotocol", s) + methods, err := ServiceMap.Register(testInterfaceName, "testporotocol", s) assert.NoError(t, err) assert.Equal(t, "MethodOne,MethodThree,methodTwo", methods) // repeat - _, err = ServiceMap.Register("testService", "testporotocol", s) + _, err = ServiceMap.Register(testInterfaceName, "testporotocol", s) assert.EqualError(t, err, "service already defined: com.test.Path") // no method s1 := &TestService1{} - _, err = ServiceMap.Register("testService", "testporotocol", s1) + _, err = ServiceMap.Register(testInterfaceName, "testporotocol", s1) assert.EqualError(t, err, "type com.test.Path1 has no exported methods of suitable type") ServiceMap = &serviceMap{ @@ -101,28 +109,28 @@ func TestServiceMap_Register(t *testing.T) { } } -func TestServiceMap_UnRegister(t *testing.T) { +func TestServiceMapUnRegister(t *testing.T) { s := &TestService{} - _, err := ServiceMap.Register("TestService", "testprotocol", s) + _, err := ServiceMap.Register("TestService", testProtocol, s) assert.NoError(t, err) - assert.NotNil(t, ServiceMap.GetService("testprotocol", "com.test.Path")) + assert.NotNil(t, ServiceMap.GetService(testProtocol, referenceTestPath)) assert.Equal(t, 1, len(ServiceMap.GetInterface("TestService"))) - err = ServiceMap.UnRegister("", "", "com.test.Path") + err = ServiceMap.UnRegister("", "", referenceTestPath) assert.EqualError(t, err, "protocol or serviceName is nil") - err = ServiceMap.UnRegister("", "protocol", "com.test.Path") + err = ServiceMap.UnRegister("", "protocol", referenceTestPath) assert.EqualError(t, err, "no services for protocol") - err = ServiceMap.UnRegister("", "testprotocol", "com.test.Path1") + err = ServiceMap.UnRegister("", testProtocol, referenceTestPathDistinct) assert.EqualError(t, err, "no service for com.test.Path1") // succ - err = ServiceMap.UnRegister("TestService", "testprotocol", "com.test.Path") + err = ServiceMap.UnRegister("TestService", testProtocol, referenceTestPath) assert.NoError(t, err) } -func TestMethodType_SuiteContext(t *testing.T) { +func TestMethodTypeSuiteContext(t *testing.T) { mt := &MethodType{ctxType: reflect.TypeOf(context.TODO())} ctx := context.WithValue(context.Background(), "key", "value") assert.Equal(t, reflect.ValueOf(ctx), mt.SuiteContext(ctx)) @@ -139,9 +147,9 @@ func TestSuiteMethod(t *testing.T) { method = methodType.Method() assert.Equal(t, "func(*common.TestService, context.Context, interface {}, interface {}, interface {}) error", method.Type.String()) at := methodType.ArgsType() - assert.Equal(t, "interface {}", at[0].String()) - assert.Equal(t, "interface {}", at[1].String()) - assert.Equal(t, "interface {}", at[2].String()) + assert.Equal(t, testSuiteMethodExpectedString, at[0].String()) + assert.Equal(t, testSuiteMethodExpectedString, at[1].String()) + assert.Equal(t, testSuiteMethodExpectedString, at[2].String()) ct := methodType.CtxType() assert.Equal(t, "context.Context", ct.String()) rt := methodType.ReplyType() @@ -153,12 +161,12 @@ func TestSuiteMethod(t *testing.T) { method = methodType.Method() assert.Equal(t, "func(*common.TestService, interface {}, interface {}, interface {}) (interface {}, error)", method.Type.String()) at = methodType.ArgsType() - assert.Equal(t, "interface {}", at[0].String()) - assert.Equal(t, "interface {}", at[1].String()) - assert.Equal(t, "interface {}", at[2].String()) + assert.Equal(t, testSuiteMethodExpectedString, at[0].String()) + assert.Equal(t, testSuiteMethodExpectedString, at[1].String()) + assert.Equal(t, testSuiteMethodExpectedString, at[2].String()) assert.Nil(t, methodType.CtxType()) rt = methodType.ReplyType() - assert.Equal(t, "interface {}", rt.String()) + assert.Equal(t, testSuiteMethodExpectedString, rt.String()) method, ok = reflect.TypeOf(s).MethodByName("MethodThree") assert.True(t, ok) diff --git a/common/url.go b/common/url.go index 1cfa47ae28..983d1d798d 100644 --- a/common/url.go +++ b/common/url.go @@ -52,6 +52,7 @@ const ( ROUTER // PROVIDER is provider role PROVIDER + PROTOCOL = "protocol" ) var ( @@ -431,7 +432,7 @@ func (c URL) GetParamAndDecoded(key string) (string, error) { // GetRawParam gets raw param func (c URL) GetRawParam(key string) string { switch key { - case "protocol": + case PROTOCOL: return c.Protocol case "username": return c.Username @@ -519,7 +520,7 @@ func (c URL) ToMap() map[string]string { }) if c.Protocol != "" { - paramsMap["protocol"] = c.Protocol + paramsMap[PROTOCOL] = c.Protocol } if c.Username != "" { paramsMap["username"] = c.Username @@ -538,7 +539,7 @@ func (c URL) ToMap() map[string]string { paramsMap["port"] = port } if c.Protocol != "" { - paramsMap["protocol"] = c.Protocol + paramsMap[PROTOCOL] = c.Protocol } if c.Path != "" { paramsMap["path"] = c.Path diff --git a/common/url_test.go b/common/url_test.go index 4d9dff9f37..6845190a73 100644 --- a/common/url_test.go +++ b/common/url_test.go @@ -31,24 +31,30 @@ import ( "github.com/apache/dubbo-go/common/constant" ) +const ( + userName = "username" + password = "password" + loopbackAddress = "127.0.0.1" +) + func TestNewURLWithOptions(t *testing.T) { methods := []string{"Methodone,methodtwo"} params := url.Values{} params.Set("key", "value") u := NewURLWithOptions(WithPath("com.test.Service"), - WithUsername("username"), - WithPassword("password"), + WithUsername(userName), + WithPassword(password), WithProtocol("testprotocol"), - WithIp("127.0.0.1"), + WithIp(loopbackAddress), WithPort("8080"), WithMethods(methods), WithParams(params), WithParamsValue("key2", "value2")) assert.Equal(t, "/com.test.Service", u.Path) - assert.Equal(t, "username", u.Username) - assert.Equal(t, "password", u.Password) + assert.Equal(t, userName, u.Username) + assert.Equal(t, password, u.Password) assert.Equal(t, "testprotocol", u.Protocol) - assert.Equal(t, "127.0.0.1", u.Ip) + assert.Equal(t, loopbackAddress, u.Ip) assert.Equal(t, "8080", u.Port) assert.Equal(t, methods, u.Methods) assert.Equal(t, params, u.params) @@ -65,7 +71,7 @@ func TestURL(t *testing.T) { assert.Equal(t, "/com.ikurento.user.UserProvider", u.Path) assert.Equal(t, "127.0.0.1:20000", u.Location) assert.Equal(t, "dubbo", u.Protocol) - assert.Equal(t, "127.0.0.1", u.Ip) + assert.Equal(t, loopbackAddress, u.Ip) assert.Equal(t, "20000", u.Port) assert.Equal(t, URL{}.Methods, u.Methods) assert.Equal(t, "", u.Username) @@ -92,7 +98,7 @@ func TestURLWithoutSchema(t *testing.T) { assert.Equal(t, "/com.ikurento.user.UserProvider", u.Path) assert.Equal(t, "127.0.0.1:20000", u.Location) assert.Equal(t, "dubbo", u.Protocol) - assert.Equal(t, "127.0.0.1", u.Ip) + assert.Equal(t, loopbackAddress, u.Ip) assert.Equal(t, "20000", u.Port) assert.Equal(t, URL{}.Methods, u.Methods) assert.Equal(t, "", u.Username) @@ -108,7 +114,7 @@ func TestURLWithoutSchema(t *testing.T) { "ZX&pid=1447&revision=0.0.1&side=provider&timeout=3000×tamp=1556509797245", u.String()) } -func TestURL_URLEqual(t *testing.T) { +func TestURLEqual(t *testing.T) { u1, err := NewURL("dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider?interface=com.ikurento.user.UserProvider&group=&version=2.6.0") assert.NoError(t, err) u2, err := NewURL("dubbo://127.0.0.2:20001/com.ikurento.user.UserProvider?interface=com.ikurento.user.UserProvider&group=&version=2.6.0") @@ -147,7 +153,7 @@ func TestURL_URLEqual(t *testing.T) { assert.True(t, categoryAny.URLEqual(u3)) } -func TestURL_GetParam(t *testing.T) { +func TestURLGetParam(t *testing.T) { params := url.Values{} params.Set("key", "value") u := URL{baseUrl: baseUrl{params: params}} @@ -159,7 +165,7 @@ func TestURL_GetParam(t *testing.T) { assert.Equal(t, "default", v) } -func TestURL_GetParamInt(t *testing.T) { +func TestURLGetParamInt(t *testing.T) { params := url.Values{} params.Set("key", "3") u := URL{baseUrl: baseUrl{params: params}} @@ -171,7 +177,7 @@ func TestURL_GetParamInt(t *testing.T) { assert.Equal(t, int64(1), v) } -func TestURL_GetParamBool(t *testing.T) { +func TestURLGetParamBool(t *testing.T) { params := url.Values{} params.Set("force", "true") u := URL{baseUrl: baseUrl{params: params}} @@ -183,7 +189,7 @@ func TestURL_GetParamBool(t *testing.T) { assert.Equal(t, false, v) } -func TestURL_GetParamAndDecoded(t *testing.T) { +func TestURLGetParamAndDecoded(t *testing.T) { rule := "host = 2.2.2.2,1.1.1.1,3.3.3.3 & host !=1.1.1.1 => host = 1.2.3.4" params := url.Values{} params.Set("rule", base64.URLEncoding.EncodeToString([]byte(rule))) @@ -192,20 +198,20 @@ func TestURL_GetParamAndDecoded(t *testing.T) { assert.Equal(t, rule, v) } -func TestURL_GetRawParam(t *testing.T) { +func TestURLGetRawParam(t *testing.T) { u, _ := NewURL("condition://0.0.0.0:8080/com.foo.BarService?serialization=fastjson") u.Username = "test" u.Password = "test" assert.Equal(t, "condition", u.GetRawParam("protocol")) assert.Equal(t, "0.0.0.0", u.GetRawParam("host")) assert.Equal(t, "8080", u.GetRawParam("port")) - assert.Equal(t, "test", u.GetRawParam("username")) - assert.Equal(t, "test", u.GetRawParam("password")) + assert.Equal(t, "test", u.GetRawParam(userName)) + assert.Equal(t, "test", u.GetRawParam(password)) assert.Equal(t, "/com.foo.BarService", u.GetRawParam("path")) assert.Equal(t, "fastjson", u.GetRawParam("serialization")) } -func TestURL_ToMap(t *testing.T) { +func TestURLToMap(t *testing.T) { u, _ := NewURL("condition://0.0.0.0:8080/com.foo.BarService?serialization=fastjson") u.Username = "test" u.Password = "test" @@ -215,13 +221,13 @@ func TestURL_ToMap(t *testing.T) { assert.Equal(t, "condition", m["protocol"]) assert.Equal(t, "0.0.0.0", m["host"]) assert.Equal(t, "8080", m["port"]) - assert.Equal(t, "test", m["username"]) - assert.Equal(t, "test", m["password"]) + assert.Equal(t, "test", m[userName]) + assert.Equal(t, "test", m[password]) assert.Equal(t, "/com.foo.BarService", m["path"]) assert.Equal(t, "fastjson", m["serialization"]) } -func TestURL_GetMethodParamInt(t *testing.T) { +func TestURLGetMethodParamInt(t *testing.T) { params := url.Values{} params.Set("methods.GetValue.timeout", "3") u := URL{baseUrl: baseUrl{params: params}} @@ -233,7 +239,7 @@ func TestURL_GetMethodParamInt(t *testing.T) { assert.Equal(t, int64(1), v) } -func TestURL_GetMethodParam(t *testing.T) { +func TestURLGetMethodParam(t *testing.T) { params := url.Values{} params.Set("methods.GetValue.timeout", "3s") u := URL{baseUrl: baseUrl{params: params}} @@ -245,7 +251,7 @@ func TestURL_GetMethodParam(t *testing.T) { assert.Equal(t, "1s", v) } -func TestURL_GetMethodParamBool(t *testing.T) { +func TestURLGetMethodParamBool(t *testing.T) { params := url.Values{} params.Set("methods.GetValue.async", "true") u := URL{baseUrl: baseUrl{params: params}} @@ -279,7 +285,7 @@ func TestMergeUrl(t *testing.T) { assert.Equal(t, "2", mergedUrl.GetParam(constant.METHOD_KEYS+".testMethod."+constant.RETRIES_KEY, "")) } -func TestURL_SetParams(t *testing.T) { +func TestURLSetParams(t *testing.T) { u1, err := NewURL("dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider?interface=com.ikurento.user.UserProvider&group=&version=2.6.0&configVersion=1.0") assert.NoError(t, err) params := url.Values{} diff --git a/common/yaml/yaml_test.go b/common/yaml/yaml_test.go index c8b8258a68..5a271a2582 100644 --- a/common/yaml/yaml_test.go +++ b/common/yaml/yaml_test.go @@ -38,7 +38,7 @@ func TestUnmarshalYMLConfig(t *testing.T) { assert.Equal(t, "childStrTest", c.ChildConfig.StrTest) } -func TestUnmarshalYMLConfig_Error(t *testing.T) { +func TestUnmarshalYMLConfigError(t *testing.T) { c := &Config{} _, err := UnmarshalYMLConfig("./testdata/config", c) assert.Error(t, err)