mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 20:07:17 +00:00
0becb6dc01
* Add attestation p2p messages * first pass refactor * lint * viz fix * comment unused const for now * Add opentracing spans * PR feedback
30 lines
480 B
Go
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():
|
|
}
|
|
}
|