executor

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2026 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeSuiteHash

func ComputeSuiteHash(prepared *PreparedSource) (string, error)

ComputeSuiteHash computes a hash of all test file contents.

func CreateSuiteOutput

func CreateSuiteOutput(
	resultsDir, hash string,
	info *SuiteInfo,
	prepared *PreparedSource,
	owner *fsutil.OwnerConfig,
) error

CreateSuiteOutput creates the suite directory structure with copied files and summary.

func GenerateAllSuiteStats

func GenerateAllSuiteStats(resultsDir string) (map[string]*SuiteStats, error)

GenerateAllSuiteStats scans the results directory and generates stats for all suites.

func GenerateAllSuiteStatsFromS3

func GenerateAllSuiteStatsFromS3(
	ctx context.Context,
	log logrus.FieldLogger,
	reader IndexObjectReader,
	runsPrefix string,
) (map[string]*SuiteStats, error)

GenerateAllSuiteStatsFromS3 builds suite stats by reading config.json and result.json from each run stored under runsPrefix in remote storage.

func GenerateJWTToken

func GenerateJWTToken(secret string) (string, error)

GenerateJWTToken generates a JWT token for Engine API authentication. The secret should be a hex-encoded string.

func GenerateRunMarkdown

func GenerateRunMarkdown(
	runDir, runID string,
	maxChars int,
) (string, error)

GenerateRunMarkdown generates a markdown summary for a single benchmark run directory. The output is capped at maxChars characters.

func GetGitCommitSHA

func GetGitCommitSHA(repoPath string) (string, error)

GetGitCommitSHA retrieves the current commit SHA from a git repository.

func WriteBlockLogsResult

func WriteBlockLogsResult(
	resultsDir string,
	blockLogs map[string]json.RawMessage,
	owner *fsutil.OwnerConfig,
) error

WriteBlockLogsResult writes captured block logs to result.block-logs.json. If blockLogs is empty, no file is written. If the file already exists, new block logs are merged with existing ones.

func WriteIndex

func WriteIndex(resultsDir string, index *Index, owner *fsutil.OwnerConfig) error

WriteIndex writes the index to index.json in the runs subdirectory.

func WriteRunResult

func WriteRunResult(resultsDir string, result *RunResult, owner *fsutil.OwnerConfig) error

WriteRunResult writes the run result to result.json in the results directory.

func WriteStepResults

func WriteStepResults(
	resultDir, testName string,
	stepType StepType,
	result *TestResult,
	owner *fsutil.OwnerConfig,
) error

WriteStepResults writes the three output files for a test step. Files are written to: resultDir/testName/{stepType}.{response,result-details.json,result-aggregated.json}

func WriteSuiteStats

func WriteSuiteStats(resultsDir, suiteHash string, stats *SuiteStats, owner *fsutil.OwnerConfig) error

WriteSuiteStats writes suite statistics to the appropriate file.

Types

type AggregatedStats

type AggregatedStats struct {
	TotalTime        int64              `json:"time_total"`
	GasUsedTotal     uint64             `json:"gas_used_total"`
	GasUsedTimeTotal int64              `json:"gas_used_time_total"`
	Succeeded        int                `json:"success"`
	Failed           int                `json:"fail"`
	TotalMsgs        int                `json:"msg_count"`
	ResourceTotals   *ResourceTotals    `json:"resource_totals,omitempty"`
	MethodStats      *MethodsAggregated `json:"method_stats"`
}

AggregatedStats contains the full aggregated output.

type BlockLogCollector

type BlockLogCollector interface {
	RegisterBlockHash(testName, blockHash string)
}

BlockLogCollector is an interface for capturing JSON payloads from client logs.

type Config

type Config struct {
	Source                          *config.SourceConfig
	Filter                          string
	CacheDir                        string
	ResultsDir                      string
	ResultsOwner                    *fsutil.OwnerConfig // Optional file ownership for results directory
	SystemResourceCollectionEnabled bool                // Enable system resource collection (cgroups/Docker Stats)
	GitHubToken                     string              // Optional GitHub token for API-based artifact downloads
}

Config for the executor.

type EESTSource

type EESTSource struct {
	// contains filtered or unexported fields
}

EESTSource provides tests from EEST fixtures in GitHub releases or artifacts.

func NewEESTSource

func NewEESTSource(log logrus.FieldLogger, cfg *config.EESTFixturesSource, cacheDir, filter, githubToken string) *EESTSource

NewEESTSource creates a new EEST source.

func (*EESTSource) Cleanup

func (s *EESTSource) Cleanup() error

Cleanup is a no-op for EEST sources (we keep the cache).

func (*EESTSource) GetGenesisGroups

func (s *EESTSource) GetGenesisGroups() []*GenesisGroup

GetGenesisGroups returns the genesis groups discovered from pre_alloc.

func (*EESTSource) GetGenesisPath

func (s *EESTSource) GetGenesisPath(clientType string) string

GetGenesisPath returns the genesis file path for a client type. Maps client types to their genesis directories in the EEST release.

func (*EESTSource) GetGenesisPathForGroup

func (s *EESTSource) GetGenesisPathForGroup(genesisHash, clientType string) string

GetGenesisPathForGroup returns the genesis file path for a specific genesis hash and client type.

func (*EESTSource) GetSourceInfo

func (s *EESTSource) GetSourceInfo() (*SuiteSource, error)

GetSourceInfo returns source information for the suite summary.

func (*EESTSource) Prepare

func (s *EESTSource) Prepare(ctx context.Context) (*PreparedSource, error)

Prepare downloads and extracts fixtures from GitHub releases, artifacts, or resolves them from local directories/tarballs.

type EESTSourceInfo

type EESTSourceInfo struct {
	GitHubRepo     string `json:"github_repo,omitempty"`
	GitHubRelease  string `json:"github_release,omitempty"`
	FixturesURL    string `json:"fixtures_url,omitempty"`
	GenesisURL     string `json:"genesis_url,omitempty"`
	FixturesSubdir string `json:"fixtures_subdir,omitempty"`
	// Artifact fields (alternative to releases).
	FixturesArtifactName  string `json:"fixtures_artifact_name,omitempty"`
	GenesisArtifactName   string `json:"genesis_artifact_name,omitempty"`
	FixturesArtifactRunID string `json:"fixtures_artifact_run_id,omitempty"`
	GenesisArtifactRunID  string `json:"genesis_artifact_run_id,omitempty"`
	// Local source fields.
	LocalFixturesDir     string `json:"local_fixtures_dir,omitempty"`
	LocalGenesisDir      string `json:"local_genesis_dir,omitempty"`
	LocalFixturesTarball string `json:"local_fixtures_tarball,omitempty"`
	LocalGenesisTarball  string `json:"local_genesis_tarball,omitempty"`
}

EESTSourceInfo contains EEST source information for the suite summary.

type ExecuteOptions

type ExecuteOptions struct {
	EngineEndpoint                string
	JWT                           string
	ResultsDir                    string
	Filter                        string
	ContainerID                   string                                // Container ID for stats collection.
	DockerClient                  *client.Client                        // Docker client for fallback stats reader.
	DropMemoryCaches              string                                // "tests", "steps", or "" (disabled).
	DropCachesPath                string                                // Path to drop_caches file (default: /proc/sys/vm/drop_caches).
	RollbackStrategy              string                                // "rpc-debug-setHead" or "" (disabled).
	RPCEndpoint                   string                                // RPC endpoint for rollback calls (e.g. http://host:port).
	ClientRPCRollbackSpec         *clientpkg.RPCRollbackSpec            // Client-specific rollback method and param format.
	Tests                         []*TestWithSteps                      // Optional subset of tests to run (nil = run all).
	BlockLogCollector             BlockLogCollector                     // Optional collector for capturing block logs from client.
	RetryNewPayloadsSyncingConfig *config.RetryNewPayloadsSyncingConfig // Retry config for SYNCING responses.
	PostTestRPCCalls              []config.PostTestRPCCall              // Arbitrary RPC calls to execute after the test step.
}

ExecuteOptions contains options for test execution.

type ExecutionResult

type ExecutionResult struct {
	TotalTests        int
	Passed            int
	Failed            int
	TotalDuration     time.Duration
	StatsReaderType   string // "cgroupv2", "dockerstats", or empty if not available
	ContainerDied     bool   // true if container exited during execution
	TerminationReason string // reason for early termination, if any
}

ExecutionResult contains the overall execution summary.

type Executor

type Executor interface {
	Start(ctx context.Context) error
	Stop() error

	// ExecuteTests runs all tests against the specified endpoint.
	ExecuteTests(ctx context.Context, opts *ExecuteOptions) (*ExecutionResult, error)

	// GetSuiteHash returns the hash of the test suite.
	GetSuiteHash() string

	// GetTests returns the prepared test list. Returns nil if not yet prepared.
	GetTests() []*TestWithSteps

	// GetSource returns the underlying source, which can be used for genesis resolution.
	GetSource() Source
}

Executor runs Engine API tests against a client.

func NewExecutor

func NewExecutor(log logrus.FieldLogger, cfg *Config) Executor

NewExecutor creates a new executor instance.

type GenesisGroup

type GenesisGroup struct {
	GenesisHash string
	Tests       []*TestWithSteps
}

GenesisGroup represents a group of tests that share the same genesis.

type GenesisGroupProvider

type GenesisGroupProvider interface {
	// GetGenesisGroups returns the genesis groups discovered from pre_alloc.
	// Returns nil if no pre_alloc directory exists (backward compatible).
	GetGenesisGroups() []*GenesisGroup
	// GetGenesisPathForGroup returns the genesis file path for a specific
	// genesis hash and client type.
	GetGenesisPathForGroup(genesisHash, clientType string) string
}

GenesisGroupProvider is an optional interface that sources can implement to provide multiple genesis groups for multi-genesis test execution.

type GenesisProvider

type GenesisProvider interface {
	// GetGenesisPath returns the path to the genesis file for a client type.
	// Returns an empty string if no genesis is available for the client.
	GetGenesisPath(clientType string) string
}

GenesisProvider is an optional interface that sources can implement to provide genesis files for clients.

type GitSource

type GitSource struct {
	// contains filtered or unexported fields
}

GitSource clones/fetches from a git repository.

func (*GitSource) Cleanup

func (s *GitSource) Cleanup() error

Cleanup is a no-op for git sources (we keep the cache).

func (*GitSource) GetSourceInfo

func (s *GitSource) GetSourceInfo() (*SuiteSource, error)

GetSourceInfo returns source information for the suite summary.

func (*GitSource) Prepare

func (s *GitSource) Prepare(ctx context.Context) (*PreparedSource, error)

Prepare clones or updates the git repository and discovers tests.

type GitSourceInfo

type GitSourceInfo struct {
	Repo        string            `json:"repo"`
	Version     string            `json:"version"`
	SHA         string            `json:"sha"`
	PreRunSteps []string          `json:"pre_run_steps,omitempty"`
	Steps       *SourceStepsGlobs `json:"steps,omitempty"`
}

GitSourceInfo contains git repository source information.

type Index

type Index struct {
	Generated int64         `json:"generated"`
	Entries   []*IndexEntry `json:"entries"`
}

Index contains the aggregated index of all benchmark runs.

func GenerateIndex

func GenerateIndex(resultsDir string) (*Index, error)

GenerateIndex scans the results directory and builds an index from all runs.

func GenerateIndexFromS3

func GenerateIndexFromS3(
	ctx context.Context,
	log logrus.FieldLogger,
	reader IndexObjectReader,
	runsPrefix string,
) (*Index, error)

GenerateIndexFromS3 builds an Index by reading config.json and result.json from each run stored under runsPrefix in remote storage.

type IndexEntry

type IndexEntry struct {
	RunID             string          `json:"run_id"`
	Timestamp         int64           `json:"timestamp"`
	TimestampEnd      int64           `json:"timestamp_end,omitempty"`
	SuiteHash         string          `json:"suite_hash,omitempty"`
	Instance          *IndexInstance  `json:"instance"`
	Tests             *IndexTestStats `json:"tests"`
	Status            string          `json:"status,omitempty"`
	TerminationReason string          `json:"termination_reason,omitempty"`
}

IndexEntry contains summary information for a single benchmark run.

type IndexInstance

type IndexInstance struct {
	ID     string `json:"id"`
	Client string `json:"client"`
	Image  string `json:"image"`
}

IndexInstance contains the client instance information for the index.

type IndexObjectReader

type IndexObjectReader interface {
	// ListPrefixes lists immediate sub-prefixes under prefix.
	ListPrefixes(ctx context.Context, prefix string) ([]string, error)
	// GetObject returns the contents of key, or (nil, nil) when the
	// key does not exist.
	GetObject(ctx context.Context, key string) ([]byte, error)
}

IndexObjectReader abstracts reading objects from a remote store (e.g. S3) so that the executor package does not depend on upload.

type IndexStepStats

type IndexStepStats struct {
	Success         int             `json:"success"`
	Fail            int             `json:"fail"`
	Duration        int64           `json:"duration"`
	GasUsed         uint64          `json:"gas_used"`
	GasUsedDuration int64           `json:"gas_used_duration"`
	ResourceTotals  *ResourceTotals `json:"resource_totals,omitempty"`
}

IndexStepStats contains statistics for a single step type.

type IndexStepsStats

type IndexStepsStats struct {
	Setup   *IndexStepStats `json:"setup,omitempty"`
	Test    *IndexStepStats `json:"test,omitempty"`
	Cleanup *IndexStepStats `json:"cleanup,omitempty"`
}

IndexStepsStats contains per-step statistics.

func AggregateStepStats

func AggregateStepStats(result *RunResult) (*IndexStepsStats, int, int)

AggregateStepStats aggregates per-step statistics from a RunResult. Returns the step stats, total tests passed, and total tests failed.

type IndexTestStats

type IndexTestStats struct {
	TestsTotal  int              `json:"tests_total"`
	TestsPassed int              `json:"tests_passed"`
	TestsFailed int              `json:"tests_failed"`
	Steps       *IndexStepsStats `json:"steps"`
}

IndexTestStats contains aggregated test statistics for the index.

type LocalSource

type LocalSource struct {
	// contains filtered or unexported fields
}

LocalSource reads tests from a local directory.

func (*LocalSource) Cleanup

func (s *LocalSource) Cleanup() error

Cleanup is a no-op for local sources.

func (*LocalSource) GetSourceInfo

func (s *LocalSource) GetSourceInfo() (*SuiteSource, error)

GetSourceInfo returns source information for the suite summary.

func (*LocalSource) Prepare

func (s *LocalSource) Prepare(_ context.Context) (*PreparedSource, error)

Prepare validates that the local directory exists and discovers tests.

type LocalSourceInfo

type LocalSourceInfo struct {
	BaseDir     string            `json:"base_dir"`
	PreRunSteps []string          `json:"pre_run_steps,omitempty"`
	Steps       *SourceStepsGlobs `json:"steps,omitempty"`
}

LocalSourceInfo contains local directory source information.

type MethodResourceStats

type MethodResourceStats struct {
	CPUUsec        *MethodStats `json:"cpu_usec,omitempty"`
	DiskReadBytes  *MethodStats `json:"disk_read_bytes,omitempty"`
	DiskWriteBytes *MethodStats `json:"disk_write_bytes,omitempty"`
	DiskReadOps    *MethodStats `json:"disk_read_iops,omitempty"`
	DiskWriteOps   *MethodStats `json:"disk_write_iops,omitempty"`
}

MethodResourceStats contains aggregated resource statistics for a method.

type MethodStats

type MethodStats struct {
	Count int64 `json:"count"`
	Min   int64 `json:"min"`
	Max   int64 `json:"max"`
	P50   int64 `json:"p50"`
	P95   int64 `json:"p95"`
	P99   int64 `json:"p99"`
	Mean  int64 `json:"mean"`
	Last  int64 `json:"last"`
}

MethodStats contains aggregated statistics for a single method (int64 values).

func (*MethodStats) MarshalJSON

func (m *MethodStats) MarshalJSON() ([]byte, error)

MarshalJSON customizes JSON output based on Count. If Count == 1, only count and last are included. If Count > 1, all statistics are included.

type MethodStatsFloat

type MethodStatsFloat struct {
	Count int64   `json:"count"`
	Min   float64 `json:"min"`
	Max   float64 `json:"max"`
	P50   float64 `json:"p50"`
	P95   float64 `json:"p95"`
	P99   float64 `json:"p99"`
	Mean  float64 `json:"mean"`
	Last  float64 `json:"last"`
}

MethodStatsFloat contains aggregated statistics for a single method (float64 values).

func (*MethodStatsFloat) MarshalJSON

func (m *MethodStatsFloat) MarshalJSON() ([]byte, error)

MarshalJSON customizes JSON output based on Count. If Count == 1, only count and last are included. If Count > 1, all statistics are included.

type MethodsAggregated

type MethodsAggregated struct {
	Times      map[string]*MethodStats         `json:"times"`
	MGasPerSec map[string]*MethodStatsFloat    `json:"mgas_s"`
	Resources  map[string]*MethodResourceStats `json:"resources,omitempty"`
}

MethodsAggregated contains aggregated stats for both times and MGas/s.

type PostTestTemplateData

type PostTestTemplateData struct {
	BlockHash      string // e.g. "0xabc..."
	BlockNumber    string // Decimal string, e.g. "1234"
	BlockNumberHex string // Hex with 0x prefix, e.g. "0x4d2"
}

PostTestTemplateData contains template variables available in post-test RPC call params.

type PreparedSource

type PreparedSource struct {
	BasePath    string
	PreRunSteps []*StepFile
	Tests       []*TestWithSteps
}

PreparedSource contains the prepared test source with all discovered tests.

type ResourceDelta

type ResourceDelta struct {
	MemoryDelta    int64  `json:"memory_delta_bytes"`
	MemoryAbsBytes uint64 `json:"memory_abs_bytes,omitempty"`
	CPUDeltaUsec   uint64 `json:"cpu_delta_usec"`
	DiskReadBytes  uint64 `json:"disk_read_bytes"`
	DiskWriteBytes uint64 `json:"disk_write_bytes"`
	DiskReadOps    uint64 `json:"disk_read_iops"`
	DiskWriteOps   uint64 `json:"disk_write_iops"`
}

ResourceDelta contains resource usage delta for a single RPC call.

type ResourceTotals

type ResourceTotals struct {
	CPUUsec        uint64 `json:"cpu_usec"`
	MemoryDelta    int64  `json:"memory_delta_bytes"`
	MemoryBytes    uint64 `json:"memory_bytes,omitempty"`
	DiskReadBytes  uint64 `json:"disk_read_bytes"`
	DiskWriteBytes uint64 `json:"disk_write_bytes"`
	DiskReadIOPS   uint64 `json:"disk_read_iops"`
	DiskWriteIOPS  uint64 `json:"disk_write_iops"`
}

ResourceTotals contains aggregated resource usage metrics.

type ResultDetails

type ResultDetails struct {
	DurationNS []int64                `json:"duration_ns"`
	Status     []int                  `json:"status"`
	MGasPerSec map[int]float64        `json:"mgas_s"`
	GasUsed    map[int]uint64         `json:"gas_used"`
	Resources  map[int]*ResourceDelta `json:"resources,omitempty"`
	// OriginalTestName stores the original test name when using hashed filenames.
	OriginalTestName string `json:"original_test_name,omitempty"`
	// FilenameHash stores the truncated+hash filename when the original was too long.
	FilenameHash string `json:"filename_hash,omitempty"`
}

ResultDetails contains per-call timing and status for JSON output.

type RunDuration

type RunDuration struct {
	ID       string                 `json:"id"`
	Client   string                 `json:"client"`
	GasUsed  uint64                 `json:"gas_used"`
	Time     int64                  `json:"time_ns"`
	RunStart int64                  `json:"run_start"`
	RunEnd   int64                  `json:"run_end,omitempty"`
	Steps    *RunDurationStepsStats `json:"steps,omitempty"`
}

RunDuration contains timing information for a single run of a test.

type RunDurationStepStats

type RunDurationStepStats struct {
	GasUsed uint64 `json:"gas_used"`
	Time    int64  `json:"time_ns"`
}

RunDurationStepStats contains gas and time data for a single step.

type RunDurationStepsStats

type RunDurationStepsStats struct {
	Setup   *RunDurationStepStats `json:"setup,omitempty"`
	Test    *RunDurationStepStats `json:"test,omitempty"`
	Cleanup *RunDurationStepStats `json:"cleanup,omitempty"`
}

RunDurationStepsStats contains per-step gas and time data.

type RunResult

type RunResult struct {
	PreRunSteps map[string]*StepResult `json:"pre_run_steps,omitempty"`
	Tests       map[string]*TestEntry  `json:"tests"`
}

RunResult contains the aggregated results for all tests in a run.

func GenerateRunResult

func GenerateRunResult(resultsDir string) (*RunResult, error)

GenerateRunResult scans a results directory and builds a RunResult from all aggregated files. Results are organized by test name with setup/test/cleanup steps, and pre-run steps separately.

type Source

type Source interface {
	// Prepare ensures test files are available and returns the prepared source.
	Prepare(ctx context.Context) (*PreparedSource, error)
	// Cleanup removes any temporary resources.
	Cleanup() error
	// GetSourceInfo returns source information for the suite summary.
	GetSourceInfo() (*SuiteSource, error)
}

Source provides test files from local or git sources.

func NewSource

func NewSource(log logrus.FieldLogger, cfg *config.SourceConfig, cacheDir, filter, githubToken string) Source

NewSource creates a Source from the configuration.

type SourceStepsGlobs

type SourceStepsGlobs struct {
	Setup   []string `json:"setup,omitempty"`
	Test    []string `json:"test,omitempty"`
	Cleanup []string `json:"cleanup,omitempty"`
}

SourceStepsGlobs contains the glob patterns used to discover test steps.

type StepFile

type StepFile struct {
	Path     string       // Full absolute path (empty if using provider)
	Name     string       // Relative path from base or logical name
	Provider StepProvider // Optional provider for in-memory steps
}

StepFile represents a single step file.

type StepProvider

type StepProvider interface {
	// Lines returns the JSON-RPC lines for this step.
	Lines() []string
	// Content returns the full content as bytes for hashing.
	Content() []byte
}

StepProvider provides step lines without requiring a file on disk.

type StepResult

type StepResult struct {
	Aggregated *AggregatedStats `json:"aggregated"`
}

StepResult contains the result for a single step.

type StepType

type StepType string

StepType represents the type of step being executed.

const (
	StepTypeSetup   StepType = "setup"
	StepTypeTest    StepType = "test"
	StepTypeCleanup StepType = "cleanup"
	StepTypePreRun  StepType = "pre_run"
)

type StepsResult

type StepsResult struct {
	Setup   *StepResult `json:"setup,omitempty"`
	Test    *StepResult `json:"test,omitempty"`
	Cleanup *StepResult `json:"cleanup,omitempty"`
}

StepsResult contains results for all steps of a test.

type SuiteFile

type SuiteFile struct {
	OgPath string `json:"og_path"` // original relative path
}

SuiteFile represents a file in the suite output.

type SuiteInfo

type SuiteInfo struct {
	Hash        string       `json:"hash"`
	Source      *SuiteSource `json:"source"`
	Filter      string       `json:"filter,omitempty"`
	PreRunSteps []SuiteFile  `json:"pre_run_steps,omitempty"`
	Tests       []SuiteTest  `json:"tests"`
}

SuiteInfo contains information about a test suite.

type SuiteSource

type SuiteSource struct {
	Git   *GitSourceInfo   `json:"git,omitempty"`
	Local *LocalSourceInfo `json:"local,omitempty"`
	EEST  *EESTSourceInfo  `json:"eest,omitempty"`
}

SuiteSource contains source information for the suite.

type SuiteStats

type SuiteStats map[string]*TestDurations

SuiteStats maps test names directly to their durations.

type SuiteTest

type SuiteTest struct {
	Name        string         `json:"name"`
	GenesisHash string         `json:"genesis,omitempty"`
	Setup       *SuiteFile     `json:"setup,omitempty"`
	Test        *SuiteFile     `json:"test,omitempty"`
	Cleanup     *SuiteFile     `json:"cleanup,omitempty"`
	EEST        *SuiteTestEEST `json:"eest,omitempty"`
}

SuiteTest represents a test with its optional steps in the suite output.

type SuiteTestEEST

type SuiteTestEEST struct {
	Info *eest.FixtureInfo `json:"info"`
}

SuiteTestEEST contains EEST-specific metadata for a test.

type TestDurations

type TestDurations struct {
	Durations []*RunDuration `json:"durations"`
}

TestDurations contains the duration entries for a test across multiple runs.

type TestEntry

type TestEntry struct {
	Dir          string       `json:"dir"`
	FilenameHash string       `json:"filename_hash,omitempty"`
	Steps        *StepsResult `json:"steps,omitempty"`
}

TestEntry contains the result entry for a single test in the run result.

type TestResult

type TestResult struct {
	TestFile             string
	Responses            []string
	Times                []int64
	Statuses             []int // 0=success, 1=fail
	MGasPerSec           map[int]float64
	GasUsed              map[int]uint64
	Resources            map[int]*ResourceDelta
	MethodTimes          map[string][]int64
	MethodMGasPerSec     map[string][]float64
	MethodCPUUsec        map[string][]int64
	MethodDiskReadBytes  map[string][]int64
	MethodDiskWriteBytes map[string][]int64
	MethodDiskReadOps    map[string][]int64
	MethodDiskWriteOps   map[string][]int64
	Succeeded            int
	Failed               int
}

TestResult contains results for a single test file execution.

func NewTestResult

func NewTestResult(testFile string) *TestResult

NewTestResult creates a new TestResult.

func (*TestResult) AddResult

func (r *TestResult) AddResult(
	method, request, response string,
	elapsed int64,
	succeeded bool,
	resources *ResourceDelta,
)

AddResult adds a single RPC call result.

func (*TestResult) CalculateStats

func (r *TestResult) CalculateStats() *AggregatedStats

CalculateStats computes aggregated statistics from the test result.

type TestWithSteps

type TestWithSteps struct {
	Name        string            // Common test name (e.g., "abc.txt")
	Setup       *StepFile         // Optional setup step
	Test        *StepFile         // Optional test step
	Cleanup     *StepFile         // Optional cleanup step
	GenesisHash string            // Genesis hash from pre_alloc (empty if single-genesis)
	EESTInfo    *eest.FixtureInfo // EEST fixture metadata (nil for non-EEST sources)
}

TestWithSteps represents a test with its optional setup/test/cleanup steps.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL