Skip to content

Add end-to-end tests for SSH agent forwarding#47

Open
JAORMX wants to merge 1 commit intomainfrom
test/agent-forwarding-e2e
Open

Add end-to-end tests for SSH agent forwarding#47
JAORMX wants to merge 1 commit intomainfrom
test/agent-forwarding-e2e

Conversation

@JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Mar 17, 2026

Summary

  • Adds TestAgentForwardingEndToEnd: verifies a forwarded ECDSA key is visible via ssh-add -l through the full client→server→agent proxy pipeline
  • Adds TestAgentForwardingEndToEnd_NoClientHandler: confirms graceful failure when the client doesn't register an auth-agent@openssh.com channel handler

Test plan

  • Tests pass locally with go test -v -race -run TestAgentForwarding ./guest/sshd/
  • CI passes (task test-nocgo — these tests are linux-only and require ssh-add)

🤖 Generated with Claude Code

Verify the full agent forwarding pipeline after the channel
request handler fix in #46: one test confirms a forwarded key
is visible via ssh-add, the other confirms graceful failure
when the client omits the channel handler.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

lgtm, there is some lint issue that the CI is complaining about plus one question/nit in the tests.

err = agent.RequestAgentForwarding(session)
require.NoError(t, err)

output, err := session.CombinedOutput("ssh-add -l")
Copy link
Contributor

Choose a reason for hiding this comment

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

if the test is supposed to be run automatically, we might want to skip it if ssh-add is not available (it is by default on Ubuntu runners in github)

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.

2 participants