prysm-pulse/shared/p2p/service_norace_test.go
Preston Van Loon 991ee7e81b "Super sync" and naive p2p reputation (#2550)
* checkpoint on super sync with reputation

* ensure handling only expected peers msg

* exclusive of finalized block

* skip block saved already

* clean up struct

* remove 2 more fields

* _

* everything builds, but doesnt test yet

* lint

* fix p2p tests

* space

* space

* space

* fmt

* fmt
2019-05-09 16:02:24 -05:00

34 lines
659 B
Go

package p2p
import (
"testing"
"github.com/prysmaticlabs/prysm/shared/testutil"
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()
want := "Starting service"
testutil.AssertLogsContain(t, hook, want)
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 canceled.
if s.ctx.Err() == nil {
t.Error("Context was not cancelled")
}
}