Skip to content

Add unit tests for internal/gh and internal/docker #104

Description

@ewega

Problem

internal/gh (wraps gh repo list and gh api) and internal/docker (wraps docker compose up/down/build) have zero test files. While they're thin wrappers over external CLIs, they contain output parsing logic that could break silently if the CLI output format changes.

Lower priority than internal/devlake tests (#96) but still valuable for catching regressions during refactoring.

Scope of Changes

internal/gh/gh_test.go

  • Test ListRepos output parsing (newline-separated nameWithOwner)
  • Test GetRepoDetails JSON parsing
  • Test IsAvailable with/without gh in PATH (may need test helper)

internal/docker/docker_test.go

  • Test command construction for ComposeUp, ComposeDown, Build
  • Test that service list is passed correctly
  • Test that --build flag is included when build=true

Note: These tests should validate command construction and output parsing, not actually invoke Docker/gh (which would require those tools to be installed).

Acceptance Criteria

  • go test ./internal/gh/... passes
  • go test ./internal/docker/... passes
  • Tests don't require Docker or gh CLI to be installed (mock or check command construction)
  • go build ./... and go vet ./... pass

Metadata

Metadata

Assignees

Labels

refactorCode restructure, no behavior change

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions