Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/client/besu.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,8 @@ func (s *besuSpec) RPCRollbackSpec() *RPCRollbackSpec {
func (s *besuSpec) DefaultConfigFiles() map[string]string {
return nil
}

// SnapshotPrepareArgs returns nil; Besu needs no snapshot-only args.
func (s *besuSpec) SnapshotPrepareArgs() []string {
return nil
}
3 changes: 3 additions & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ type Spec interface {
// Keys are target paths inside the container, values are file contents.
// Returns nil if no config files are needed.
DefaultConfigFiles() map[string]string

// SnapshotPrepareArgs returns args for the ZFS snapshot-prep container only (not per-test measurement); nil if none.
SnapshotPrepareArgs() []string
}

// Registry manages client specifications.
Expand Down
5 changes: 5 additions & 0 deletions pkg/client/erigon.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,8 @@ func (s *erigonSpec) RPCRollbackSpec() *RPCRollbackSpec {
func (s *erigonSpec) DefaultConfigFiles() map[string]string {
return nil
}

// SnapshotPrepareArgs returns nil; Erigon needs no snapshot-only args.
func (s *erigonSpec) SnapshotPrepareArgs() []string {
return nil
}
5 changes: 5 additions & 0 deletions pkg/client/ethrex.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,8 @@ func (s *ethrexSpec) RPCRollbackSpec() *RPCRollbackSpec {
func (s *ethrexSpec) DefaultConfigFiles() map[string]string {
return nil
}

// SnapshotPrepareArgs returns nil; Ethrex needs no snapshot-only args.
func (s *ethrexSpec) SnapshotPrepareArgs() []string {
return nil
}
5 changes: 5 additions & 0 deletions pkg/client/geth.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,8 @@ IdleTimeout = 120000000000 # 120s
`,
}
}

// SnapshotPrepareArgs returns nil; Geth needs no snapshot-only args.
func (s *gethSpec) SnapshotPrepareArgs() []string {
return nil
}
5 changes: 5 additions & 0 deletions pkg/client/nethermind.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ func (s *nethermindSpec) RPCRollbackSpec() *RPCRollbackSpec {
func (s *nethermindSpec) DefaultConfigFiles() map[string]string {
return nil
}

// SnapshotPrepareArgs returns nil; Nethermind needs no snapshot-only args.
func (s *nethermindSpec) SnapshotPrepareArgs() []string {
return nil
}
5 changes: 5 additions & 0 deletions pkg/client/nimbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,8 @@ func (s *nimbusSpec) RPCRollbackSpec() *RPCRollbackSpec {
func (s *nimbusSpec) DefaultConfigFiles() map[string]string {
return nil
}

// SnapshotPrepareArgs returns nil; Nimbus needs no snapshot-only args.
func (s *nimbusSpec) SnapshotPrepareArgs() []string {
return nil
}
8 changes: 8 additions & 0 deletions pkg/client/reth.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,11 @@ func (s *rethSpec) RPCRollbackSpec() *RPCRollbackSpec {
func (s *rethSpec) DefaultConfigFiles() map[string]string {
return nil
}

// SnapshotPrepareArgs makes reth persist every block during snapshot prep so the pre-run head reaches disk (else the snapshot lags a block and tests hang SYNCING).
func (s *rethSpec) SnapshotPrepareArgs() []string {
return []string{
"--engine.persistence-threshold=0",
"--engine.memory-block-buffer-target=0",
}
}
19 changes: 18 additions & 1 deletion pkg/runner/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,25 @@ func (r *runner) runContainerLifecycle(
params.DataDirCfg = datadirCfg
params.UseDataDir = useDataDir

// Apply client-specific snapshot-prepare args to the initial (pre-run/snapshot) container only, scoped to ZFS container-recreate; per-test containers clone params.ContainerSpec and keep the base command.
createSpec := containerSpec

if prepareArgs := spec.SnapshotPrepareArgs(); len(prepareArgs) > 0 &&
r.cfg.FullConfig != nil &&
r.cfg.FullConfig.GetRollbackStrategy(instance) ==
config.RollbackStrategyContainerRecreate &&
datadirCfg != nil && datadirCfg.Method == "zfs" {
prepareSpec := *containerSpec
prepareSpec.Command = append(append([]string{}, cmd...), prepareArgs...)
createSpec = &prepareSpec

log.WithField("args", prepareArgs).Info(
"Applying snapshot-prepare args to initial (pre-run) container",
)
}

// Create container.
containerID, err := r.containerMgr.CreateContainer(ctx, containerSpec)
containerID, err := r.containerMgr.CreateContainer(ctx, createSpec)
if err != nil {
return fmt.Errorf("creating container: %w", err)
}
Expand Down
Loading