mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 21:57:16 +00:00
38 lines
878 B
Go
38 lines
878 B
Go
package attestation
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/internal"
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
"github.com/sirupsen/logrus"
|
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
|
)
|
|
|
|
func init() {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
}
|
|
|
|
func TestIncomingAttestations(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
beaconDB := internal.SetupDB(t)
|
|
defer internal.TeardownDB(t, beaconDB)
|
|
service := NewAttestationService(context.Background(), &Config{BeaconDB: beaconDB})
|
|
|
|
exitRoutine := make(chan bool)
|
|
go func() {
|
|
service.aggregateAttestations()
|
|
<-exitRoutine
|
|
}()
|
|
|
|
service.incomingChan <- &pb.Attestation{
|
|
Data: &pb.AttestationData{},
|
|
}
|
|
service.cancel()
|
|
exitRoutine <- true
|
|
|
|
testutil.AssertLogsContain(t, hook, "Forwarding aggregated attestation")
|
|
}
|