Skip to content

Improve git client tests - #14351

Merged
BagToad merged 1 commit into
williammartin-git-transport-testsfrom
williammartin-improve-git-tests
Oct 30, 2026
Merged

BagToad merged 1 commit into
williammartin-git-transport-testsfrom
williammartin-improve-git-tests

Conversation

@williammartin

@williammartin williammartin commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Description

Follow on from #14350

Several tests put successful operations and errors in the same table, which makes the setup and assertions branch on the expected outcome. Other tests repeat equivalent cases or compile a separate executable just to return fixed output.

This PR separates success and failure cases, removes duplicate setup and uses the existing subprocess helper for Command.Output tests.

How did you test this change?

Not tested manually. This simplifies tests without changing production code.

Key points

Command output tests keep a small subprocess helper so they can control standard output, standard error and the exit code without compiling another executable. The client tests continue to use real Git repositories.

Notes for reviewers

Start with the command scenarios, then read the smaller remote setup and separated URL parsing scenarios.

This builds on #14350. #14355 removes the remaining obsolete process-mocking infrastructure.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @williammartin will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The error-message check in git/command_test.go uses a nonfatal assertion, contrary to AGENTS.md’s requirement for fatal error checks.

1 open issue
What changed in this PR

This test-only follow-up to #14350 simplifies the Git client suite after its move to local repositories. Production code is unchanged.

Changes:

  • Replace temporary executable builds with the existing helper-process setup for command output tests.
  • Reduce redundant remote setup and separate success and failure scenarios.
  • Clarify parser and value tests with Given/When/Then structure and stronger assertions.
File Description
git/​url_test.go Remove redundant URL variation and separate malformed-input coverage.
git/​command_test.go Reuse helper processes to test output and Git errors without nested builds.
git/​client_test.go Simplify repository setup, split scenarios, and clarify assertions.

Review effort: Balanced

Comment thread git/command_test.go Resolved
@williammartin
williammartin force-pushed the williammartin-improve-git-tests branch from a0965e2 to 737ffb5 Compare October 29, 2026 11:49
@williammartin
williammartin force-pushed the williammartin-improve-git-tests branch from 737ffb5 to 3764002 Compare October 29, 2026 19:24
@williammartin
williammartin requested a balanced review from Copilot October 29, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for this test-only cleanup.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <[email protected]>
@williammartin
williammartin force-pushed the williammartin-improve-git-tests branch from 628fe6b to 5714558 Compare October 29, 2026 20:39
@williammartin
williammartin marked this pull request as ready for review October 29, 2026 20:44
@williammartin
williammartin requested a review from a team as a code owner October 29, 2026 20:44
@BagToad
BagToad merged commit 443baeb into trunk Oct 30, 2026
18 checks passed
@BagToad
BagToad deleted the williammartin-improve-git-tests branch October 30, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants