Page MenuHomePhabricator

tests: add low-level SSH protocol tests
ClosedPublic

Authored by indygreg on Feb 4 2018, 10:35 PM.

Details

Summary

We don't really have good low-level tests for the behavior of the SSH
wire protocol. This commit attempts to establish some.

The added tests consist of a mixture of starting a server
with hg serve --stdio and sending bytes to it and using
hg debugpeer to go through the official client code. Having
insight into what raw bytes are exchanged as well as what the peer
does is useful.

We also introduce a test extension for modifying the behavior of
the SSH server and peer. For example, we change the server to
not recognize the "hello" command, simulating behavior of <0.9.1
servers.

These tests are generally useful to have. But the impetus for creating
them now is they will be needed for verifying behavior of old clients
and servers when a new SSH protocol is introduced.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Feb 4 2018, 10:35 PM
lothiraldan added inline comments.
tests/test-ssh-proto.t
115

Is the SSHSERVERMODE needed here?

130

Is the SSHSERVERMODE needed here?

indygreg marked 2 inline comments as done.Feb 5 2018, 11:46 AM
indygreg added inline comments.
tests/test-ssh-proto.t
115

Yes. dummyssh will run hg serve --stdio and that process needs to inherit the environment variable so it ignores the hello command.

130

Ditto.

indygreg marked 2 inline comments as done.Feb 5 2018, 12:15 PM
indygreg updated this revision to Diff 5227.
yuja accepted this revision.Feb 6 2018, 8:07 AM
This revision is now accepted and ready to land.Feb 6 2018, 8:07 AM
This revision was automatically updated to reflect the committed changes.