move test data
This commit is contained in:
parent
90d7a87914
commit
eeed493766
@ -7,13 +7,14 @@ import (
|
|||||||
|
|
||||||
proto "github.com/micro/go-micro/debug/proto"
|
proto "github.com/micro/go-micro/debug/proto"
|
||||||
"github.com/micro/go-micro/registry/memory"
|
"github.com/micro/go-micro/registry/memory"
|
||||||
|
"github.com/micro/go-micro/util/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFunction(t *testing.T) {
|
func TestFunction(t *testing.T) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
r := memory.NewRegistry(memory.Services(testData))
|
r := memory.NewRegistry(memory.Services(test.Data))
|
||||||
|
|
||||||
// create service
|
// create service
|
||||||
fn := NewFunction(
|
fn := NewFunction(
|
||||||
|
@ -14,8 +14,8 @@ import (
|
|||||||
"github.com/micro/go-micro/debug/profile/pprof"
|
"github.com/micro/go-micro/debug/profile/pprof"
|
||||||
"github.com/micro/go-micro/plugin"
|
"github.com/micro/go-micro/plugin"
|
||||||
"github.com/micro/go-micro/server"
|
"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/log"
|
||||||
|
"github.com/micro/go-micro/util/wrapper"
|
||||||
)
|
)
|
||||||
|
|
||||||
type service struct {
|
type service struct {
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
proto "github.com/micro/go-micro/debug/proto"
|
proto "github.com/micro/go-micro/debug/proto"
|
||||||
"github.com/micro/go-micro/registry/memory"
|
"github.com/micro/go-micro/registry/memory"
|
||||||
"github.com/micro/go-micro/util/log"
|
"github.com/micro/go-micro/util/log"
|
||||||
|
"github.com/micro/go-micro/util/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testShutdown(wg *sync.WaitGroup, cancel func()) {
|
func testShutdown(wg *sync.WaitGroup, cancel func()) {
|
||||||
@ -29,7 +30,7 @@ func testService(ctx context.Context, wg *sync.WaitGroup, name string) Service {
|
|||||||
// add self
|
// add self
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
r := memory.NewRegistry(memory.Services(testData))
|
r := memory.NewRegistry(memory.Services(test.Data))
|
||||||
|
|
||||||
// create service
|
// create service
|
||||||
return NewService(
|
return NewService(
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package micro
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/micro/go-micro/registry"
|
"github.com/micro/go-micro/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// mock data
|
// mock registry data
|
||||||
testData = map[string][]*registry.Service{
|
Data = map[string][]*registry.Service{
|
||||||
"foo": {
|
"foo": {
|
||||||
{
|
{
|
||||||
Name: "foo",
|
Name: "foo",
|
Loading…
Reference in New Issue
Block a user