diff --git a/function_test.go b/function_test.go index 44177cb9..c53e9cdc 100644 --- a/function_test.go +++ b/function_test.go @@ -7,13 +7,14 @@ import ( proto "github.com/micro/go-micro/debug/proto" "github.com/micro/go-micro/registry/memory" + "github.com/micro/go-micro/util/test" ) func TestFunction(t *testing.T) { var wg sync.WaitGroup wg.Add(1) - r := memory.NewRegistry(memory.Services(testData)) + r := memory.NewRegistry(memory.Services(test.Data)) // create service fn := NewFunction( diff --git a/service.go b/service.go index 95477231..3058a3b2 100644 --- a/service.go +++ b/service.go @@ -14,8 +14,8 @@ import ( "github.com/micro/go-micro/debug/profile/pprof" "github.com/micro/go-micro/plugin" "github.com/micro/go-micro/server" - "github.com/micro/go-micro/util/wrapper" "github.com/micro/go-micro/util/log" + "github.com/micro/go-micro/util/wrapper" ) type service struct { diff --git a/service_test.go b/service_test.go index 3a6c3082..f7abb15f 100644 --- a/service_test.go +++ b/service_test.go @@ -11,6 +11,7 @@ import ( proto "github.com/micro/go-micro/debug/proto" "github.com/micro/go-micro/registry/memory" "github.com/micro/go-micro/util/log" + "github.com/micro/go-micro/util/test" ) func testShutdown(wg *sync.WaitGroup, cancel func()) { @@ -29,7 +30,7 @@ func testService(ctx context.Context, wg *sync.WaitGroup, name string) Service { // add self wg.Add(1) - r := memory.NewRegistry(memory.Services(testData)) + r := memory.NewRegistry(memory.Services(test.Data)) // create service return NewService( diff --git a/common_test.go b/util/test/test.go similarity index 89% rename from common_test.go rename to util/test/test.go index 6a1ed2d8..100c8e79 100644 --- a/common_test.go +++ b/util/test/test.go @@ -1,12 +1,12 @@ -package micro +package test import ( "github.com/micro/go-micro/registry" ) var ( - // mock data - testData = map[string][]*registry.Service{ + // mock registry data + Data = map[string][]*registry.Service{ "foo": { { Name: "foo", diff --git a/util/wrapper/wrapper.go b/util/wrapper/wrapper.go index f80d34fb..cf198435 100644 --- a/util/wrapper/wrapper.go +++ b/util/wrapper/wrapper.go @@ -49,9 +49,9 @@ func (c *clientWrapper) Publish(ctx context.Context, p client.Message, opts ...c // FromService wraps a client to inject From-Service header into metadata func FromService(name string, c client.Client) client.Client { return &clientWrapper{ - c, - metadata.Metadata{ - HeaderPrefix + "From-Service": name, - }, - } + c, + metadata.Metadata{ + HeaderPrefix + "From-Service": name, + }, + } }