Repository navigation
Improve git client tests - #14351
Draft
williammartin wants to merge 1 commit into
Draft
Improve git client tests#14351williammartin wants to merge 1 commit into
williammartin wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Layers 1-3 replaced broad
git.Clientmocks with real local Git repositories. This follow-up makes that converted suite smaller and clearer without changing production code.It replaces
Command.Outputtests that compiled temporary Go executables with the existing helper-process seam, removes an incidental URL data variation, narrows redundant remote setup, splits tables that mixed success and failure strategies, and gives parser/value tests explicit Given/When/Then structure. Distinct transport outcomes, parser equivalence classes, credential scoping and clearing,--,--ff-only,--set-upstream, and command modifier contracts remain covered.How did you test this change?
Given the rewritten command error scenario, when I temporarily stopped
Command.Outputfrom preserving the process exit status, I saw the focused test fail with an expected status of 128 and an actual status of 0. I reverted the mutation.Given a repository with no remote resolution metadata, when I temporarily removed the special handling for Git's no-matching-config status, I saw the focused remotes test fail with exit status 1. I reverted the mutation.
Given a
git+sshURL, when I temporarily removed that supported transport from URL classification, I saw the specific classifier scenario fail. I reverted the mutation.Key points
TestOutputno longer performs two nestedgo buildoperations.gitbecause parser and command-construction contracts are deliberately internal; moving them would require exporting production internals.Notes for reviewers
Start with
git/command_test.gofor the feedback-time change, then review the split parser scenarios ingit/url_test.goand the reduced setup and table shape ingit/client_test.go.Parent draft: #14350.
Authorship and follow-up
Who wrote this:
Who answers review comments: