mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 18:21:20 +00:00
36 lines
849 B
Go
36 lines
849 B
Go
package attestation
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/internal"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/types"
|
|
"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 <- types.NewAttestation(nil)
|
|
service.cancel()
|
|
exitRoutine <- true
|
|
|
|
testutil.AssertLogsContain(t, hook, "Forwarding aggregated attestation")
|
|
}
|