1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-17 17:44:30 +02:00

strip debug handler (#2532)

* strip debug handler

* fix tests
This commit is contained in:
Asim Aslam 2022-07-22 20:03:27 +01:00 committed by GitHub
parent a8224e1c67
commit 28f36e8fd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

View File

@ -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()

View File

@ -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

View File

@ -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 {