github.com/prysmaticlabs/prysm@v1.4.4/beacon-chain/blockchain/service_norace_test.go (about) 1 package blockchain 2 3 import ( 4 "context" 5 "io/ioutil" 6 "testing" 7 8 testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" 9 "github.com/prysmaticlabs/prysm/shared/testutil/require" 10 "github.com/sirupsen/logrus" 11 ) 12 13 func init() { 14 logrus.SetLevel(logrus.DebugLevel) 15 logrus.SetOutput(ioutil.Discard) 16 } 17 18 func TestChainService_SaveHead_DataRace(t *testing.T) { 19 beaconDB := testDB.SetupDB(t) 20 s := &Service{ 21 cfg: &Config{BeaconDB: beaconDB}, 22 } 23 go func() { 24 require.NoError(t, s.saveHead(context.Background(), [32]byte{})) 25 }() 26 require.NoError(t, s.saveHead(context.Background(), [32]byte{})) 27 }