prysm-pulse/validator/client/service_test.go
Preston Van Loon 0becb6dc01 Simplified validator workflow - first pass (#1362)
* Add attestation p2p messages

* first pass refactor

* lint

* viz fix

* comment unused const for now

* Add opentracing spans

* PR feedback
2019-01-23 10:52:39 +08:00

30 lines
480 B
Go

package client
import (
"context"
"testing"
"time"
"github.com/prysmaticlabs/prysm/shared"
)
var _ = shared.Service(&ValidatorService{})
func TestStop_cancelsContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
vs := &ValidatorService{
ctx: ctx,
cancel: cancel,
}
if err := vs.Stop(); err != nil {
t.Error(err)
}
select {
case <-time.After(1 * time.Second):
t.Error("ctx not cancelled within 1s")
case <-vs.ctx.Done():
}
}