mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
31 lines
778 B
Go
31 lines
778 B
Go
package attestation
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
btestutil "github.com/prysmaticlabs/prysm/beacon-chain/testutil"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/types"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
|
)
|
|
|
|
func TestIncomingAttestations(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
beaconDB := btestutil.SetupDB(t)
|
|
defer btestutil.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")
|
|
}
|