mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-24 02:01:43 +00:00
rpc: Test Validator retrevial timeout
This commit is contained in:
39
rpc/core/status_test.go
Normal file
39
rpc/core/status_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
func TestGetValidatorsWithTimeout(t *testing.T) {
|
||||
height, vs := getValidatorsWithTimeout(
|
||||
testValidatorReceiver{},
|
||||
time.Millisecond,
|
||||
)
|
||||
|
||||
if height != -1 {
|
||||
t.Errorf("expected negative height")
|
||||
}
|
||||
|
||||
if len(vs) != 0 {
|
||||
t.Errorf("expected no validators")
|
||||
}
|
||||
}
|
||||
|
||||
type testValidatorReceiver struct{}
|
||||
|
||||
func (tr testValidatorReceiver) GetValidators() (int64, []*types.Validator) {
|
||||
vs := []*types.Validator{}
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
v, _ := types.RandValidator(true, 10)
|
||||
|
||||
vs = append(vs, v)
|
||||
}
|
||||
|
||||
time.Sleep(time.Millisecond)
|
||||
|
||||
return 10, vs
|
||||
}
|
Reference in New Issue
Block a user