2019-10-21 16:37:50 +00:00
|
|
|
package operations
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2019-11-27 05:08:18 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
2019-10-21 16:37:50 +00:00
|
|
|
dbutil "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
|
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestIncomingExits_Ok(t *testing.T) {
|
|
|
|
hook := logTest.NewGlobal()
|
|
|
|
beaconDB := dbutil.SetupDB(t)
|
|
|
|
defer dbutil.TeardownDB(t, beaconDB)
|
|
|
|
service := NewService(context.Background(), &Config{BeaconDB: beaconDB})
|
|
|
|
|
|
|
|
exit := ðpb.VoluntaryExit{Epoch: 100}
|
|
|
|
if err := service.HandleValidatorExits(context.Background(), exit); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
want := "Exit request saved in DB"
|
|
|
|
testutil.AssertLogsContain(t, hook, want)
|
|
|
|
}
|