mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
d2f4a8cc7c
* Replace ioutil with io and os * Fix build errors
33 lines
847 B
Go
33 lines
847 B
Go
package blockchain
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"testing"
|
|
|
|
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
|
|
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
"github.com/prysmaticlabs/prysm/testing/util"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func init() {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
logrus.SetOutput(io.Discard)
|
|
}
|
|
|
|
func TestChainService_SaveHead_DataRace(t *testing.T) {
|
|
beaconDB := testDB.SetupDB(t)
|
|
s := &Service{
|
|
cfg: &config{BeaconDB: beaconDB},
|
|
}
|
|
b, err := wrapper.WrappedSignedBeaconBlock(util.NewBeaconBlock())
|
|
st, _ := util.DeterministicGenesisState(t, 1)
|
|
require.NoError(t, err)
|
|
go func() {
|
|
require.NoError(t, s.saveHead(context.Background(), [32]byte{}, b, st))
|
|
}()
|
|
require.NoError(t, s.saveHead(context.Background(), [32]byte{}, b, st))
|
|
}
|