Skip to content

Make ssh tests behavioural with a shared fake ssh - #311

Merged
williammartin merged 1 commit into
trunkfrom
williammartin-behavioural-ssh-tests
Oct 8, 2026
Merged

williammartin merged 1 commit into
trunkfrom
williammartin-behavioural-ssh-tests

Conversation

@williammartin

@williammartin williammartin commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Description

This rewrites the pkg/ssh tests to exercise behaviour through ssh.Translator.Translate. It adds testutils.StubSSH in internal/testutils. This puts a fake ssh on PATH, built from the running test binary. Now each test describes what a caller sees.

The test package's TestMain needs to call RunFakeSSHIfRequested. It only acts when the binary runs as ssh. This is groundwork for adding comprehensive pkg/repository tests in #274. No production code changes.

@williammartin
williammartin requested a review from a team as a code owner October 8, 2026 14:24
@williammartin
williammartin requested review from tidy-dev and a balanced review from Copilot and removed request for a team and tidy-dev October 8, 2026 14:24

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

The test refactor and shared fake SSH utility are coherent, portable, and cover the intended behaviors without production changes.

0 open findings

What changed in this PR

Reworks SSH translation tests around observable behavior and adds a reusable fake SSH executable.

Changes:

  • Adds behavioral coverage for translation, caching, and fallback behavior.
  • Adds shared StubSSH test infrastructure.
File Description
pkg/​ssh/​ssh_test.go Replaces implementation-focused tests with behavioral tests.
internal/​testutils/​ssh_stub.go Provides configurable fake SSH test support.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@williammartin
williammartin force-pushed the williammartin-behavioural-ssh-tests branch from d6dff30 to 3adbe01 Compare October 8, 2026 15:17
@williammartin
williammartin requested review from babakks and a balanced review from Copilot October 8, 2026 15:18

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 rewrite removes explicit coverage of SSH executable-path caching.

1 open finding

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread pkg/ssh/ssh_test.go
return c
},
}
func TestTranslatorResolvesEachHostSeparately(t *testing.T) {
@williammartin
williammartin merged commit 61532b9 into trunk Oct 8, 2026
12 checks passed
@williammartin
williammartin deleted the williammartin-behavioural-ssh-tests branch October 8, 2026 15:32
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