mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 21:57:16 +00:00
991ee7e81b
* 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
34 lines
659 B
Go
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")
|
|
}
|
|
}
|