2020-07-27 13:22:00 +01:00
|
|
|
package registry
|
2019-11-05 17:44:24 +00:00
|
|
|
|
|
|
|
import (
|
2020-04-09 14:05:46 +03:00
|
|
|
"os"
|
2019-11-05 17:44:24 +00:00
|
|
|
"testing"
|
|
|
|
|
2020-08-19 17:47:17 +03:00
|
|
|
"github.com/unistack-org/micro/v3/registry/memory"
|
|
|
|
"github.com/unistack-org/micro/v3/router"
|
2019-11-05 17:44:24 +00:00
|
|
|
)
|
|
|
|
|
2020-07-27 13:22:00 +01:00
|
|
|
func routerTestSetup() router.Router {
|
2019-11-05 17:44:24 +00:00
|
|
|
r := memory.NewRegistry()
|
2020-07-27 13:22:00 +01:00
|
|
|
return NewRouter(router.Registry(r))
|
2019-11-05 17:44:24 +00:00
|
|
|
}
|
|
|
|
|
2020-06-24 11:09:16 +01:00
|
|
|
func TestRouterClose(t *testing.T) {
|
2019-11-05 17:44:24 +00:00
|
|
|
r := routerTestSetup()
|
|
|
|
|
2020-06-24 11:09:16 +01:00
|
|
|
if err := r.Close(); err != nil {
|
2019-11-05 17:44:24 +00: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 17:44:24 +00:00
|
|
|
}
|