mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
e1137e5801
* start sequence for node to connect to bootstrap nodes * lint * maybe warning is more appropiate? * fix gazelle * preston's feedback * add go-ipfs-addr to workspace * move flag to shared * removed routed host
36 lines
666 B
Go
36 lines
666 B
Go
package p2p
|
|
|
|
import (
|
|
"testing"
|
|
|
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
|
)
|
|
|
|
func TestLifecycle(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
|
|
s, err := NewServer("")
|
|
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")
|
|
}
|
|
}
|