Fix HTTP tests

This commit is contained in:
Ben Toogood
2020-04-09 10:28:38 +01:00
parent 8ff86ae08b
commit f102aba4c1
4 changed files with 36 additions and 14 deletions

View File

@@ -7,6 +7,8 @@ import (
"testing"
"github.com/micro/go-micro/v2/api/handler"
"github.com/micro/go-micro/v2/api/resolver"
res "github.com/micro/go-micro/v2/api/resolver/vpath"
"github.com/micro/go-micro/v2/api/router"
regRouter "github.com/micro/go-micro/v2/api/router/registry"
"github.com/micro/go-micro/v2/registry"
@@ -54,8 +56,10 @@ func testHttp(t *testing.T, path, service, ns string) {
// initialise the handler
rt := regRouter.NewRouter(
router.WithHandler("http"),
router.WithNamespace(ns),
router.WithRegistry(r),
router.WithResolver(res.NewResolver(
resolver.WithNamespace(ns),
)),
)
p := NewHandler(handler.WithRouter(rt))
@@ -116,6 +120,8 @@ func TestHttpHandler(t *testing.T) {
}
for _, d := range testData {
testHttp(t, d.path, d.service, d.namespace)
t.Run(d.service, func(t *testing.T) {
testHttp(t, d.path, d.service, d.namespace)
})
}
}