Update system testing
This commit is contained in:
parent
041f862c11
commit
ac1e3075e2
@ -82,7 +82,7 @@ func processMsg[P ProcessedEvents](msg []byte, processCh chan<- P, errorCh chan<
|
||||
return
|
||||
}
|
||||
processCh <- msgMarshaled
|
||||
log.Info("Done sending")
|
||||
log.Debug("Done sending")
|
||||
}
|
||||
|
||||
// Capture all of the event topics.
|
||||
|
@ -156,10 +156,6 @@ func processFullSlot(ctx context.Context, db sql.Database, serverAddress string,
|
||||
|
||||
if err := g.Wait(); err != nil {
|
||||
// Make sure channel is empty.
|
||||
select {
|
||||
case <-vUnmarshalerCh:
|
||||
default:
|
||||
}
|
||||
return err, "processSlot"
|
||||
}
|
||||
|
||||
@ -296,14 +292,20 @@ func (ps *ProcessSlot) getSignedBeaconBlock(serverAddress string, vmCh <-chan *d
|
||||
|
||||
// Update the SszBeaconState and FullBeaconState object with their respective values.
|
||||
func (ps *ProcessSlot) getBeaconState(serverEndpoint string, vmCh chan<- *dt.VersionedUnmarshaler) error {
|
||||
var stateIdentifier string // Used to query the state
|
||||
var (
|
||||
stateIdentifier string // Used to query the state
|
||||
err error
|
||||
)
|
||||
if ps.StateRoot != "" {
|
||||
stateIdentifier = ps.StateRoot
|
||||
} else {
|
||||
stateIdentifier = strconv.Itoa(ps.Slot)
|
||||
}
|
||||
stateEndpoint := serverEndpoint + BcStateQueryEndpoint + stateIdentifier
|
||||
ps.SszBeaconState, _, _ = querySsz(stateEndpoint, strconv.Itoa(ps.Slot))
|
||||
ps.SszBeaconState, _, err = querySsz(stateEndpoint, strconv.Itoa(ps.Slot))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to querrySSZ")
|
||||
}
|
||||
|
||||
versionedUnmarshaler, err := dt.FromState(*ps.SszBeaconState)
|
||||
if err != nil {
|
||||
|
@ -3,11 +3,11 @@ package beaconclient_test
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
|
||||
//. "github.com/onsi/gomega"
|
||||
"github.com/vulcanize/ipld-eth-beacon-indexer/pkg/beaconclient"
|
||||
)
|
||||
@ -65,12 +65,23 @@ func getEnvInt(envVar string) int {
|
||||
|
||||
// Start head tracking and wait for the expected results.
|
||||
func processProdHeadBlocks(bc *beaconclient.BeaconClient, expectedInserts, expectedReorgs, expectedKnownGaps, expectedKnownGapsReprocessError uint64) {
|
||||
startGoRoutines := runtime.NumGoroutine()
|
||||
//startGoRoutines := runtime.NumGoroutine()
|
||||
//pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
go bc.CaptureHead(ctx, 2, false)
|
||||
time.Sleep(1 * time.Second)
|
||||
time.Sleep(5 * time.Second)
|
||||
validateMetrics(bc, expectedInserts, expectedReorgs, expectedKnownGaps, expectedKnownGapsReprocessError)
|
||||
|
||||
cancel()
|
||||
testStopHeadTracking(ctx, bc, startGoRoutines)
|
||||
time.Sleep(4)
|
||||
testStopSystemHeadTracking(ctx, bc)
|
||||
}
|
||||
|
||||
// Custom stop for system testing
|
||||
func testStopSystemHeadTracking(ctx context.Context, bc *beaconclient.BeaconClient) {
|
||||
bc.StopHeadTracking(ctx, false)
|
||||
|
||||
time.Sleep(3 * time.Second)
|
||||
//pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
|
||||
//Expect(endNum <= startGoRoutines).To(BeTrue())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user