More Precise Metrics E2E (#9331)

* metrics test copute slots since genesis

* gazelle

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Raul Jordan 2021-08-05 15:44:56 -05:00 committed by GitHub
parent 57fac9b74f
commit 4f0b00894b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,7 @@ go_library(
"//shared/p2putils:go_default_library",
"//shared/params:go_default_library",
"//shared/sliceutil:go_default_library",
"//shared/slotutil:go_default_library",
"//shared/testutil:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",

View File

@ -17,6 +17,7 @@ import (
"github.com/prysmaticlabs/prysm/endtoend/types"
eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/p2putils"
"github.com/prysmaticlabs/prysm/shared/slotutil"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)
@ -109,14 +110,17 @@ func metricsTest(conns ...*grpc.ClientConn) error {
}
time.Sleep(connTimeDelay)
chainHead, err := eth.NewBeaconChainClient(conns[i]).GetChainHead(context.Background(), &emptypb.Empty{})
beaconClient := eth.NewBeaconChainClient(conns[i])
nodeClient := eth.NewNodeClient(conns[i])
chainHead, err := beaconClient.GetChainHead(context.Background(), &emptypb.Empty{})
if err != nil {
return err
}
timeSlot, err := valueOfTopic(pageContent, "beacon_clock_time_slot")
genesisResp, err := nodeClient.GetGenesis(context.Background(), &emptypb.Empty{})
if err != nil {
return err
}
timeSlot := slotutil.SlotsSinceGenesis(genesisResp.GenesisTime.AsTime())
if uint64(chainHead.HeadSlot) != uint64(timeSlot) {
return fmt.Errorf("expected metrics slot to equal chain head slot, expected %d, received %d", chainHead.HeadSlot, timeSlot)
}