prysm-pulse/beacon-chain/powchain/block_cache_test.go

106 lines
2.8 KiB
Go
Raw Normal View History

package powchain
import (
"math/big"
"testing"
"github.com/ethereum/go-ethereum/common"
gethTypes "github.com/ethereum/go-ethereum/core/types"
"github.com/prysmaticlabs/prysm/beacon-chain/powchain/types"
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestHashKeyFn_OK(t *testing.T) {
hInfo := &types.HeaderInfo{
Hash: common.HexToHash("0x0123456"),
}
key, err := hashKeyFn(hInfo)
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
assert.Equal(t, hInfo.Hash.Hex(), key)
}
func TestHashKeyFn_InvalidObj(t *testing.T) {
_, err := hashKeyFn("bad")
assert.Equal(t, ErrNotAHeaderInfo, err)
}
func TestHeightKeyFn_OK(t *testing.T) {
hInfo := &types.HeaderInfo{
Number: big.NewInt(555),
}
key, err := heightKeyFn(hInfo)
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
assert.Equal(t, hInfo.Number.String(), key)
}
func TestHeightKeyFn_InvalidObj(t *testing.T) {
_, err := heightKeyFn("bad")
assert.Equal(t, ErrNotAHeaderInfo, err)
}
func TestBlockCache_byHash(t *testing.T) {
cache := newHeaderCache()
header := &gethTypes.Header{
ParentHash: common.HexToHash("0x12345"),
Number: big.NewInt(55),
}
exists, _, err := cache.HeaderInfoByHash(header.Hash())
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
assert.Equal(t, false, exists, "Expected block info not to exist in empty cache")
err = cache.AddHeader(header)
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
exists, fetchedInfo, err := cache.HeaderInfoByHash(header.Hash())
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
assert.Equal(t, true, exists, "Expected headerInfo to exist")
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
assert.Equal(t, 0, fetchedInfo.Number.Cmp(header.Number), "Expected fetched info number to be equal")
assert.Equal(t, header.Hash(), fetchedInfo.Hash, "Expected hash to be equal")
}
func TestBlockCache_byHeight(t *testing.T) {
cache := newHeaderCache()
header := &gethTypes.Header{
ParentHash: common.HexToHash("0x12345"),
Number: big.NewInt(55),
}
exists, _, err := cache.HeaderInfoByHeight(header.Number)
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
assert.Equal(t, false, exists, "Expected block info not to exist in empty cache")
err = cache.AddHeader(header)
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
exists, fetchedInfo, err := cache.HeaderInfoByHeight(header.Number)
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
assert.Equal(t, true, exists, "Expected headerInfo to exist")
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
assert.Equal(t, 0, fetchedInfo.Number.Cmp(header.Number), "Expected fetched info number to be equal")
assert.Equal(t, header.Hash(), fetchedInfo.Hash, "Expected hash to be equal")
}
func TestBlockCache_maxSize(t *testing.T) {
cache := newHeaderCache()
for i := int64(0); i < int64(maxCacheSize+10); i++ {
header := &gethTypes.Header{
Number: big.NewInt(i),
}
err := cache.AddHeader(header)
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
require.NoError(t, err)
}
Applies Assertion And Require Test Functions to Powchain (#6652) * change all tests * save * fix tests * Update deposit_test.go * Update deposit_test.go * Update log_processing_test.go * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * fix failing test * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert * Merge refs/heads/master into powchainAssert
2020-07-25 06:20:21 +00:00
assert.Equal(t, int(maxCacheSize), len(cache.hashCache.ListKeys()))
assert.Equal(t, int(maxCacheSize), len(cache.heightCache.ListKeys()))
}