mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 05:38:55 +00:00
b5c4dc2a75
* init-sync updates * slasher/db/kv tests * beacon-chain/rpc/beacon tests * update kv_test * beacon-chain/rpc-validator tests updated * slasher/db/kv - remove teardown method * beacon-chain/sync tests updated * beacon-chain/db/kv tests updated * beacon-chain/blockchain tests updated * beacon-chain/state/stategen tests updated * beacon-chain/powchain updates * updates rest of slasher tests * validator/db tests * rest of the tests * minor comments update * gazelle * Merge refs/heads/master into teardowndb-to-cleanup
34 lines
896 B
Go
34 lines
896 B
Go
package beacon
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"reflect"
|
|
"testing"
|
|
|
|
ptypes "github.com/gogo/protobuf/types"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
)
|
|
|
|
func TestServer_GetBeaconConfig(t *testing.T) {
|
|
ctx := context.Background()
|
|
bs := &Server{}
|
|
res, err := bs.GetBeaconConfig(ctx, &ptypes.Empty{})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
conf := params.BeaconConfig()
|
|
numFields := reflect.TypeOf(conf).Elem().NumField()
|
|
|
|
// Check if the result has the same number of items as our config struct.
|
|
if len(res.Config) != numFields {
|
|
t.Errorf("Expected %d items in config result, got %d", numFields, len(res.Config))
|
|
}
|
|
want := fmt.Sprintf("%d", conf.Eth1FollowDistance)
|
|
|
|
// Check that an element is properly populated from the config.
|
|
if res.Config["Eth1FollowDistance"] != want {
|
|
t.Errorf("Wanted %s for eth1 follow distance, received %s", want, res.Config["Eth1FollowDistance"])
|
|
}
|
|
}
|