Skip to content

Commit

Permalink
Reduce test-integration time
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Sep 25, 2024
1 parent d5feb36 commit 396c06d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
26 changes: 10 additions & 16 deletions tests/bor/bor_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ import (
)

var (
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addrr = crypto.PubkeyToAddress(key1.PublicKey)
stack, _ = node.New(&node.DefaultConfig)
backend, _ = eth.New(stack, &ethconfig.Defaults)
db = backend.ChainDb()
hash1 = common.BytesToHash([]byte("topic1"))
hash2 = common.BytesToHash([]byte("topic2"))
hash3 = common.BytesToHash([]byte("topic3"))
hash4 = common.BytesToHash([]byte("topic4"))
hash5 = common.BytesToHash([]byte("topic5"))
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addrr = crypto.PubkeyToAddress(key1.PublicKey)
hash1 = common.BytesToHash([]byte("topic1"))
hash2 = common.BytesToHash([]byte("topic2"))
hash3 = common.BytesToHash([]byte("topic3"))
hash4 = common.BytesToHash([]byte("topic4"))
hash5 = common.BytesToHash([]byte("topic5"))
)

func duplicateInArray(arr []common.Hash) bool {
Expand Down Expand Up @@ -139,12 +136,9 @@ func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPool
// This Testcase tests functions for RPC API calls.
// NOTE : Changes to this function might affect the child testcases.
func TestAPIs(t *testing.T) {

defer func() {
if err := stack.Close(); err != nil {
t.Error(err)
}
}()
stack, _ := node.New(&node.DefaultConfig)
backend, _ := eth.New(stack, &ethconfig.Defaults)
db := backend.ChainDb()

genesis := core.GenesisBlockForTesting(db, addrr, big.NewInt(1000000))
testBorConfig := params.TestChainConfig.Bor
Expand Down
24 changes: 16 additions & 8 deletions tests/bor/bor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ func TestForkWithBlockTime(t *testing.T) {
{
name: "No fork after 2 sprints with producer delay = max block time",
sprint: map[string]uint64{
"0": 128,
"0": 16,
},
blockTime: map[string]uint64{
"0": 5,
"128": 2,
"256": 8,
"0": 5,
"16": 2,
"32": 8,
},
change: 2,
producerDelay: map[string]uint64{
Expand All @@ -243,11 +243,11 @@ func TestForkWithBlockTime(t *testing.T) {
{
name: "No Fork after 1 sprint producer delay = max block time",
sprint: map[string]uint64{
"0": 64,
"0": 16,
},
blockTime: map[string]uint64{
"0": 5,
"64": 2,
"16": 2,
},
change: 1,
producerDelay: map[string]uint64{
Expand Down Expand Up @@ -281,11 +281,11 @@ func TestForkWithBlockTime(t *testing.T) {
for i := 0; i < len(faucets); i++ {
faucets[i], _ = crypto.GenerateKey()
}
genesis := InitGenesis(t, faucets, "./testdata/genesis_2val.json", 8)

for _, test := range cases {
t.Run(test.name, func(t *testing.T) {

t.Parallel()
genesis := InitGenesis(t, faucets, "./testdata/genesis_2val.json", 8)
genesis.Config.Bor.Sprint = test.sprint
genesis.Config.Bor.Period = test.blockTime
genesis.Config.Bor.BackupMultiplier = test.blockTime
Expand Down Expand Up @@ -371,6 +371,7 @@ func TestForkWithBlockTime(t *testing.T) {
}

func TestInsertingSpanSizeBlocks(t *testing.T) {
t.Parallel()
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
fdlimit.Raise(2048)

Expand Down Expand Up @@ -437,6 +438,7 @@ func TestInsertingSpanSizeBlocks(t *testing.T) {
}

func TestFetchStateSyncEvents(t *testing.T) {
t.Parallel()
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
fdlimit.Raise(2048)

Expand Down Expand Up @@ -515,6 +517,7 @@ func validateStateSyncEvents(t *testing.T, expected []*clerk.EventRecordWithTime
}

func TestFetchStateSyncEvents_2(t *testing.T) {
t.Parallel()
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
fdlimit.Raise(2048)

Expand Down Expand Up @@ -620,6 +623,7 @@ func TestFetchStateSyncEvents_2(t *testing.T) {
}

func TestOutOfTurnSigning(t *testing.T) {
t.Parallel()
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
fdlimit.Raise(2048)

Expand Down Expand Up @@ -717,6 +721,7 @@ func TestOutOfTurnSigning(t *testing.T) {
}

func TestSignerNotFound(t *testing.T) {
t.Parallel()
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
fdlimit.Raise(2048)
init := buildEthereumInstance(t, rawdb.NewMemoryDatabase())
Expand Down Expand Up @@ -989,6 +994,7 @@ func TestEIP1559Transition(t *testing.T) {
}

func TestBurnContract(t *testing.T) {
t.Parallel()
var (
aa = common.HexToAddress("0x000000000000000000000000000000000000aaaa")

Expand Down Expand Up @@ -1203,6 +1209,7 @@ func TestBurnContract(t *testing.T) {
}

func TestBurnContractContractFetch(t *testing.T) {
t.Parallel()
config := params.BorUnittestChainConfig
config.Bor.BurntContract = map[string]string{
"10": "0x000000000000000000000000000000000000aaab",
Expand Down Expand Up @@ -1432,6 +1439,7 @@ func TestTransitionWithoutEIP155(t *testing.T) {
}

func TestJaipurFork(t *testing.T) {
t.Parallel()
init := buildEthereumInstance(t, rawdb.NewMemoryDatabase())
chain := init.ethereum.BlockChain()
engine := init.ethereum.Engine()
Expand Down

0 comments on commit 396c06d

Please sign in to comment.