prysm-pulse/beacon-chain/core/state/metrics_test.go
Raul Jordan e19920aec1
Miscellaneous Runtime Fixes & Improvements - Raul (#1674)
* fatal if impossible to receive chainstart

* fix tests

* fix

* custom delay

* completed custom delay

* errors

* better logs, nothing at genesis

* use demo in val

* add gazelle

* log

* starting to log stuff

* pass in ops

* avoid printing the large #s for debug, still working on tests..

* all around better logging

* fixed build error in epoch process

* fixed state transiton tests

* fixed block tests

* lint

* verify sigs in randao

* ready for inclusion falg

* only print waiting when slot is not valid

* fix build

* mod config

* fixed last justified slot issue

* fix inclusion

* fixed attestation issue

* using zero hash from params instead

* fix tests

* update balance

* removed swp

* more `- genesis_slot` for logs

* rem unused log

* fix broken tests

* account for skip slots in state root computation

* fixes done

* validator guide bug fixes - 671

* epoch boundary at the last slot of the epoch

* fix epoch issue

* more balance cal logs for debugging

* greater balance

* attestaton fixes

* fixes

* addressed testrun

* fixed ejection balance

* fix tests with far future epoch

* revert sync change

* revert initial sync change

* fix changes

* off by one att fix

* revert the att fix

* address comments

* format

* fix build

* rem file
2019-02-24 20:09:45 -06:00

34 lines
880 B
Go

package state
import (
"strings"
"testing"
"github.com/prometheus/client_golang/prometheus/testutil"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
)
func TestReportEpochTransitionMetrics_validatorBalances(t *testing.T) {
state := &pb.BeaconState{
ValidatorBalances: []uint64{1, 15},
ValidatorRegistry: []*pb.Validator{
{Pubkey: []byte{1}},
{Pubkey: []byte{2}},
},
}
reportEpochTransitionMetrics(state)
expectedMetadata := `
# HELP state_validator_balances Balances of validators, updated on epoch transition
# TYPE state_validator_balances gauge
`
expectedValues := `
state_validator_balances{validator="0x01"} 1
state_validator_balances{validator="0x02"} 15
`
expected := expectedMetadata + expectedValues
if err := testutil.CollectAndCompare(validatorBalancesGauge, strings.NewReader(expected)); err != nil {
t.Error(err)
}
}