2020-07-27 15:22:00 +03:00
|
|
|
package registry
|
2019-11-05 20:44:24 +03:00
|
|
|
|
|
|
|
import (
|
2020-04-09 14:05:46 +03:00
|
|
|
"os"
|
2019-11-05 20:44:24 +03:00
|
|
|
"testing"
|
|
|
|
|
2020-07-27 15:22:00 +03:00
|
|
|
"github.com/micro/go-micro/v3/registry/memory"
|
|
|
|
"github.com/micro/go-micro/v3/router"
|
2019-11-05 20:44:24 +03:00
|
|
|
)
|
|
|
|
|
2020-07-27 15:22:00 +03:00
|
|
|
func routerTestSetup() router.Router {
|
2019-11-05 20:44:24 +03:00
|
|
|
r := memory.NewRegistry()
|
2020-07-27 15:22:00 +03:00
|
|
|
return NewRouter(router.Registry(r))
|
2019-11-05 20:44:24 +03:00
|
|
|
}
|
|
|
|
|
2020-06-24 13:09:16 +03:00
|
|
|
func TestRouterClose(t *testing.T) {
|
2019-11-05 20:44:24 +03:00
|
|
|
r := routerTestSetup()
|
|
|
|
|
2020-06-24 13:09:16 +03:00
|
|
|
if err := r.Close(); err != nil {
|
2019-11-05 20:44:24 +03:00
|
|
|
t.Errorf("failed to stop router: %v", err)
|
|
|
|
}
|
2020-04-09 14:05:46 +03:00
|
|
|
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
|
|
|
t.Logf("TestRouterStartStop STOPPED")
|
|
|
|
}
|
2019-11-05 20:44:24 +03:00
|
|
|
}
|