2019-09-23 19:24:42 +00:00
|
|
|
package blockchain
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io/ioutil"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
|
2020-07-16 12:11:39 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
2019-09-23 19:24:42 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
|
|
logrus.SetOutput(ioutil.Discard)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestChainService_SaveHead_DataRace(t *testing.T) {
|
2020-12-18 19:12:30 +00:00
|
|
|
beaconDB := testDB.SetupDB(t)
|
2019-09-23 19:24:42 +00:00
|
|
|
s := &Service{
|
2021-03-17 18:36:56 +00:00
|
|
|
cfg: &Config{BeaconDB: beaconDB},
|
2019-09-23 19:24:42 +00:00
|
|
|
}
|
|
|
|
go func() {
|
2020-07-16 12:11:39 +00:00
|
|
|
require.NoError(t, s.saveHead(context.Background(), [32]byte{}))
|
2019-09-23 19:24:42 +00:00
|
|
|
}()
|
2020-07-16 12:11:39 +00:00
|
|
|
require.NoError(t, s.saveHead(context.Background(), [32]byte{}))
|
2019-09-23 19:24:42 +00:00
|
|
|
}
|