prysm-pulse/shared/p2p/service_norace_test.go
Preston Van Loon 0559d01261
Add support for connecting via relay nodes (#827)
* Preliminary support for relay nodes

* lint

* Add comment, remove TODO

* work on relay address factory

* dial relay node, if available

* forgot new files

* fix service registry breakage

* added logging

* Added a peer count with prometheus

* always start mDNS

* fix lint
2018-11-25 11:55:02 -05:00

36 lines
679 B
Go

package p2p
import (
"testing"
logTest "github.com/sirupsen/logrus/hooks/test"
)
func TestLifecycle(t *testing.T) {
hook := logTest.NewGlobal()
s, err := NewServer(&ServerConfig{})
if err != nil {
t.Fatalf("Could not start a new server: %v", err)
}
s.Start()
msg := hook.Entries[0].Message
want := "Starting service"
if msg != want {
t.Errorf("incorrect log. wanted: %s. got: %v", want, msg)
}
s.Stop()
msg = hook.LastEntry().Message
want = "Stopping service"
if msg != want {
t.Errorf("incorrect log. wanted: %s. got: %v", want, msg)
}
// The context should have been cancelled.
if s.ctx.Err() == nil {
t.Error("Context was not cancelled")
}
}