Skip to content

refactor(export): inject CommandRunner into toolbox#31

Merged
fmenesesg merged 1 commit into
mainfrom
refactor/toolbox-command-runner
Jun 11, 2026
Merged

refactor(export): inject CommandRunner into toolbox#31
fmenesesg merged 1 commit into
mainfrom
refactor/toolbox-command-runner

Conversation

@fmenesesg

Copy link
Copy Markdown
Collaborator

Proposed change

Inject CommandRunner into Toolbox for testability (architecture review D1). Production code defaults to os/exec; tests use a mock to verify native/container command construction and error handling.

Type of change

  • New feature (refactor — no behavior change)

RHCL checklist

  • Tests added or updated (go test ./... or mvn test / npm test)
  • CI does not introduce -DskipTests without justification
  • No secrets in diff (tokens, kubeconfigs, OIDC secrets)
  • rhcl-ai docs updated if export/import contract changes
  • PR description and docs in English
  • Tested in local lab if applicable (seed → export → analyze)

Test plan

  • TestExportProductNativeUsesRunner — native binary + args
  • TestRunContainerArgs — podman run, cert mount, remote URL
  • TestRunCommandEmptyOutput / TestRunCommandStderrError
  • go test ./... — 122 tests; coverage 81.9%

Changes

File Change
internal/export/toolbox.go CommandRunner interface, execCommandRunner, inject via options
internal/export/toolbox_test.go Mock runner tests for native/container/error paths

Closes #30

Made with Cursor

Add CommandRunner interface with default exec implementation so
native and container export paths are testable without real exec.

Co-authored-by: Cursor <cursoragent@cursor.com>
@fmenesesg fmenesesg requested a review from pcastelo as a code owner June 11, 2026 20:43
@fmenesesg fmenesesg added area/tests Tests unitarios e integracion type:feature New feature or enhancement labels Jun 11, 2026
@fmenesesg fmenesesg merged commit b6a455d into main Jun 11, 2026
1 check passed
@fmenesesg fmenesesg deleted the refactor/toolbox-command-runner branch June 11, 2026 20:45
fmenesesg added a commit that referenced this pull request Jun 11, 2026
…nd-runner

refactor(export): inject CommandRunner into toolbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tests Tests unitarios e integracion type:feature New feature or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] Inject CommandRunner into toolbox for testability

1 participant