mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
clean up test (#2309)
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/libp2p/go-libp2p-peer"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/db"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/internal"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
|
||||
@@ -21,19 +21,24 @@ var validatorKey *keystore.Key
|
||||
var keyMap map[string]*keystore.Key
|
||||
var keyMapThreeValidators map[string]*keystore.Key
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
func keySetup() {
|
||||
keyMap = make(map[string]*keystore.Key)
|
||||
keyMapThreeValidators = make(map[string]*keystore.Key)
|
||||
|
||||
validatorKey, _ = keystore.NewKey(rand.Reader)
|
||||
keyMap[hex.EncodeToString(validatorKey.PublicKey.Marshal())] = validatorKey
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
vKey, _ := keystore.NewKey(rand.Reader)
|
||||
keyMapThreeValidators[hex.EncodeToString(vKey.PublicKey.Marshal())] = vKey
|
||||
}
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
dir := testutil.TempDir() + "/keystore1"
|
||||
defer os.RemoveAll(dir)
|
||||
accounts.NewValidatorAccount(dir, "1234")
|
||||
validatorKey, _ = keystore.NewKey(rand.Reader)
|
||||
keyMap[hex.EncodeToString(validatorKey.PublicKey.Marshal())] = validatorKey
|
||||
keyMapThreeValidators[hex.EncodeToString(validatorKey.PublicKey.Marshal())] = validatorKey
|
||||
validatorKey2, _ := keystore.NewKey(rand.Reader)
|
||||
keyMapThreeValidators[hex.EncodeToString(validatorKey.PublicKey.Marshal())] = validatorKey2
|
||||
validatorKey3, _ := keystore.NewKey(rand.Reader)
|
||||
keyMapThreeValidators[hex.EncodeToString(validatorKey.PublicKey.Marshal())] = validatorKey3
|
||||
keySetup()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
|
||||
@@ -318,12 +318,12 @@ func TestWaitMultipleActivation_LogsActivationEpochOK(t *testing.T) {
|
||||
client.EXPECT().WaitForActivation(
|
||||
gomock.Any(),
|
||||
&pb.ValidatorActivationRequest{
|
||||
PublicKeys: publicKeys(v.keys),
|
||||
PublicKeys: v.pubkeys,
|
||||
},
|
||||
).Return(clientStream, nil)
|
||||
clientStream.EXPECT().Recv().Return(
|
||||
&pb.ValidatorActivationResponse{
|
||||
ActivatedPublicKeys: publicKeys(v.keys),
|
||||
ActivatedPublicKeys: v.pubkeys,
|
||||
},
|
||||
nil,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user