diff --git a/op-acceptance-tests/cmd/main.go b/op-acceptance-tests/cmd/main.go index f5e737d14de3a..ff02a26823bd6 100644 --- a/op-acceptance-tests/cmd/main.go +++ b/op-acceptance-tests/cmd/main.go @@ -22,6 +22,19 @@ const ( defaultAcceptor = "op-acceptor" ) +// AcceptorConfig holds all configuration for running op-acceptor +type AcceptorConfig struct { + Orchestrator string + Devnet string + Gate string + TestDir string + Validators string + LogLevel string + Acceptor string + Serial bool + ShowProgress bool +} + var ( // Command line flags orchestratorFlag = &cli.StringFlag{ @@ -85,6 +98,12 @@ var ( Value: false, EnvVars: []string{"SERIAL"}, } + showProgressFlag = &cli.BoolFlag{ + Name: "show-progress", + Usage: "Show progress information during test execution", + Value: false, + EnvVars: []string{"SHOW_PROGRESS"}, + } ) func main() { @@ -102,6 +121,7 @@ func main() { acceptorFlag, reuseDevnetFlag, serialFlag, + showProgressFlag, }, Action: runAcceptanceTest, } @@ -124,6 +144,7 @@ func runAcceptanceTest(c *cli.Context) error { acceptor := c.String(acceptorFlag.Name) reuseDevnet := c.Bool(reuseDevnetFlag.Name) serial := c.Bool(serialFlag.Name) + showProgress := c.Bool(showProgressFlag.Name) // Validate inputs based on orchestrator type if orchestrator != "sysgo" && orchestrator != "sysext" { @@ -193,7 +214,18 @@ func runAcceptanceTest(c *cli.Context) error { // Run acceptance tests steps = append(steps, func(ctx context.Context) error { - return runOpAcceptor(ctx, tracer, orchestrator, devnet, gate, absTestDir, absValidators, logLevel, acceptor, serial) + config := AcceptorConfig{ + Orchestrator: orchestrator, + Devnet: devnet, + Gate: gate, + TestDir: absTestDir, + Validators: absValidators, + LogLevel: logLevel, + Acceptor: acceptor, + Serial: serial, + ShowProgress: showProgress, + } + return runOpAcceptor(ctx, tracer, config) }, ) @@ -224,7 +256,7 @@ func deployDevnet(ctx context.Context, tracer trace.Tracer, devnet string, kurto return nil } -func runOpAcceptor(ctx context.Context, tracer trace.Tracer, orchestrator string, devnet string, gate string, testDir string, validators string, logLevel string, acceptor string, serial bool) error { +func runOpAcceptor(ctx context.Context, tracer trace.Tracer, config AcceptorConfig) error { ctx, span := tracer.Start(ctx, "run acceptance test") defer span.End() @@ -232,37 +264,41 @@ func runOpAcceptor(ctx context.Context, tracer trace.Tracer, orchestrator string // Build the command arguments args := []string{ - "--testdir", testDir, - "--gate", gate, - "--validators", validators, - "--log.level", logLevel, - "--orchestrator", orchestrator, + "--testdir", config.TestDir, + "--gate", config.Gate, + "--validators", config.Validators, + "--log.level", config.LogLevel, + "--orchestrator", config.Orchestrator, } - if serial { + if config.Serial { args = append(args, "--serial") } + if config.ShowProgress { + args = append(args, "--show-progress") + args = append(args, "--progress-interval", "5s") + } // Handle devnet parameter based on orchestrator type - if orchestrator == "sysext" && devnet != "" { + if config.Orchestrator == "sysext" && config.Devnet != "" { var devnetEnvURL string - if strings.HasPrefix(devnet, "kt://") || strings.HasPrefix(devnet, "ktnative://") { + if strings.HasPrefix(config.Devnet, "kt://") || strings.HasPrefix(config.Devnet, "ktnative://") { // Already a URL or file path - use directly - devnetEnvURL = devnet + devnetEnvURL = config.Devnet } else { // Simple name - wrap as Kurtosis URL - devnetEnvURL = fmt.Sprintf("kt://%s-devnet", devnet) + devnetEnvURL = fmt.Sprintf("kt://%s-devnet", config.Devnet) } args = append(args, "--devnet-env-url", devnetEnvURL) } // For sysgo, we allow skips - if orchestrator == "sysgo" { + if config.Orchestrator == "sysgo" { args = append(args, "--allow-skips") } - acceptorCmd := exec.CommandContext(ctx, acceptor, args...) + acceptorCmd := exec.CommandContext(ctx, config.Acceptor, args...) acceptorCmd.Env = env acceptorCmd.Stdout = os.Stdout acceptorCmd.Stderr = os.Stderr diff --git a/op-acceptance-tests/justfile b/op-acceptance-tests/justfile index 24e969741e07c..95f12cf4ce237 100644 --- a/op-acceptance-tests/justfile +++ b/op-acceptance-tests/justfile @@ -82,6 +82,7 @@ acceptance-test devnet="" gate="holocene": # Set binary path and log level BINARY_PATH=$(mise which op-acceptor) + BINARY_PATH=/Users/stefano/code/infra/op-acceptor/op-acceptor-progress echo "Using mise-managed binary: $BINARY_PATH" LOG_LEVEL="$(echo "${LOG_LEVEL:-info}" | grep -E '^(debug|info|warn|error)$' || echo 'info')" echo "LOG_LEVEL: $LOG_LEVEL" @@ -94,28 +95,30 @@ acceptance-test devnet="" gate="holocene": # Build command arguments based on mode if [[ "$GATELESS_MODE" == "true" ]]; then - # Gateless mode + # Gateless mode - use binary directly CMD_ARGS=( "$BINARY_PATH" "--testdir" "{{REPO_ROOT}}/op-acceptance-tests/..." "--allow-skips" "--timeout" "90m" "--default-timeout" "10m" + "--orchestrator" "$ORCHESTRATOR" + "--show-progress" ) else - # Gate mode + # Gate mode - use go run with acceptor binary CMD_ARGS=( "go" "run" "cmd/main.go" "--gate" "{{gate}}" "--testdir" "{{REPO_ROOT}}" "--validators" "./acceptance-tests.yaml" "--acceptor" "$BINARY_PATH" + "--log.level" "${LOG_LEVEL}" + "--orchestrator" "$ORCHESTRATOR" + "--show-progress" ) fi - # Add common arguments - CMD_ARGS+=("--log.level" "${LOG_LEVEL}" "--orchestrator" "$ORCHESTRATOR") - # Add sysext-specific arguments if [[ "$ORCHESTRATOR" == "sysext" ]]; then CMD_ARGS+=("--devnet" "{{devnet}}" "--kurtosis-dir" "{{KURTOSIS_DIR}}" "--serial")