mirror of
https://github.com/go-micro/go-micro.git
synced 2025-01-17 17:44:30 +02:00
parent
a8224e1c67
commit
28f36e8fd6
@ -5,6 +5,7 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"go-micro.dev/v4/debug/handler"
|
||||
proto "go-micro.dev/v4/debug/proto"
|
||||
"go-micro.dev/v4/registry"
|
||||
"go-micro.dev/v4/util/test"
|
||||
@ -26,6 +27,8 @@ func TestFunction(t *testing.T) {
|
||||
}),
|
||||
)
|
||||
|
||||
fn.Handle(handler.NewHandler(nil))
|
||||
|
||||
// we can't test fn.Init as it parses the command line
|
||||
// fn.Init()
|
||||
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"sync"
|
||||
|
||||
"go-micro.dev/v4/client"
|
||||
"go-micro.dev/v4/debug/handler"
|
||||
"go-micro.dev/v4/logger"
|
||||
plugin "go-micro.dev/v4/plugins"
|
||||
"go-micro.dev/v4/server"
|
||||
@ -153,14 +152,6 @@ func (s *service) Run() (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
// register the debug handler
|
||||
s.opts.Server.Handle(
|
||||
s.opts.Server.NewHandler(
|
||||
handler.NewHandler(s.opts.Client),
|
||||
server.InternalHandler(true),
|
||||
),
|
||||
)
|
||||
|
||||
// start the profiler
|
||||
if s.opts.Profile != nil {
|
||||
// to view mutex contention
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"go-micro.dev/v4/client"
|
||||
"go-micro.dev/v4/debug/handler"
|
||||
proto "go-micro.dev/v4/debug/proto"
|
||||
"go-micro.dev/v4/registry"
|
||||
"go-micro.dev/v4/util/test"
|
||||
@ -28,7 +29,7 @@ func testService(ctx context.Context, wg *sync.WaitGroup, name string) Service {
|
||||
r := registry.NewMemoryRegistry(registry.Services(test.Data))
|
||||
|
||||
// create service
|
||||
return NewService(
|
||||
srv := NewService(
|
||||
Name(name),
|
||||
Context(ctx),
|
||||
Registry(r),
|
||||
@ -41,6 +42,10 @@ func testService(ctx context.Context, wg *sync.WaitGroup, name string) Service {
|
||||
return nil
|
||||
}),
|
||||
)
|
||||
|
||||
RegisterHandler(srv.Server(), handler.NewHandler(srv.Client()))
|
||||
|
||||
return srv
|
||||
}
|
||||
|
||||
func testRequest(ctx context.Context, c client.Client, name string) error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user