mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
b015dc793a
* HeadFetcher data race fix * bazel run //:gazelle -- fix * add the db teardown to test * add TestChainService_SaveHead_DataRace test * split race and norace tests * change testset name * test CI with 'spectest' tag instead of 'raceon' * one more test CI with 'spectest' tag instead of 'raceon' * bazel run //:gazelle -- fix * set test tag to 'race_on' * not clone the state
38 lines
705 B
Go
38 lines
705 B
Go
package blockchain
|
|
|
|
import (
|
|
"context"
|
|
"io/ioutil"
|
|
"testing"
|
|
|
|
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func init() {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
logrus.SetOutput(ioutil.Discard)
|
|
}
|
|
|
|
func TestChainService_SaveHead_DataRace(t *testing.T) {
|
|
db := testDB.SetupDB(t)
|
|
defer testDB.TeardownDB(t, db)
|
|
s := &Service{
|
|
beaconDB: db,
|
|
canonicalRoots: make(map[uint64][]byte),
|
|
}
|
|
go func() {
|
|
s.saveHead(
|
|
context.Background(),
|
|
ðpb.BeaconBlock{Slot: 777},
|
|
[32]byte{},
|
|
)
|
|
}()
|
|
s.saveHead(
|
|
context.Background(),
|
|
ðpb.BeaconBlock{Slot: 888},
|
|
[32]byte{},
|
|
)
|
|
}
|