mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 10:41:19 +00:00
9bf80219c9
* slasher/beaconclient tests * slasher/db/kv tests * Merge branch 'master' into apply-testutils-assertions-to-slasher * fix build * slasher/detection tests * rest of the tests * misc tests * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Update slasher/db/kv/spanner_test.go Co-authored-by: Shay Zluf <thezluf@gmail.com> * Update slasher/node/node_test.go Co-authored-by: Shay Zluf <thezluf@gmail.com> * Merge refs/heads/master into apply-testutils-assertions-to-slasher * Update slasher/db/kv/spanner_test.go * Merge refs/heads/master into apply-testutils-assertions-to-slasher
53 lines
1.0 KiB
Go
53 lines
1.0 KiB
Go
package kv
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"testing"
|
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func TestChainHead(t *testing.T) {
|
|
app := &cli.App{}
|
|
set := flag.NewFlagSet("test", 0)
|
|
db := setupDB(t, cli.NewContext(app, set, nil))
|
|
ctx := context.Background()
|
|
|
|
tests := []struct {
|
|
head *ethpb.ChainHead
|
|
}{
|
|
{
|
|
head: ðpb.ChainHead{
|
|
HeadSlot: 20,
|
|
HeadEpoch: 20,
|
|
FinalizedSlot: 10,
|
|
FinalizedEpoch: 10,
|
|
JustifiedSlot: 10,
|
|
JustifiedEpoch: 10,
|
|
},
|
|
},
|
|
{
|
|
head: ðpb.ChainHead{
|
|
HeadSlot: 1,
|
|
},
|
|
},
|
|
{
|
|
head: ðpb.ChainHead{
|
|
HeadBlockRoot: make([]byte, 32),
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
require.NoError(t, db.SaveChainHead(ctx, tt.head))
|
|
head, err := db.ChainHead(ctx)
|
|
require.NoError(t, err, "Failed to get block")
|
|
assert.NotNil(t, head)
|
|
assert.DeepEqual(t, tt.head, head)
|
|
}
|
|
}
|