Commit a84cd13
committed
t/t-batch-transfer.sh: test multiple SSH sessions
In commit 691de51 of PR #4446 we added
the "batch transfers with ssh endpoint (git-lfs-transfer)" test to our
t/t-batch-transfer.sh test script in order to validate that the new
SSH object transfer protocol for Git LFS was operating as expected.
This test only creates a single test object, and so does not cause
the Git LFS client to establish multiple SSH sessions during the batch
object transfer phase. While the sole SSH session started during this
phase may create a control socket to multiplex its connection, it will
not be shared by any other SSH sessions, since only one is started.
In practice, this means that even if the "lfs.ssh.autoMultiplex"
configuration option is set to "true" and the available SSH client
is considered to be compatible with OpenSSH, the "batch transfers with
ssh endpoint (git-lfs-transfer)" test will never try to start an SSH
session with a value for the ControlMaster argument other than "yes".
Our test suite sets the GIT_SSH environment variable to refer to our
lfs-ssh-echo test utility program rather than an actual SSH client.
As noted in #5903, at present the Git LFS client treats this program,
which it does not recognize as matching the filename of any known
SSH client, as compatible with OpenSSH, and so our tests invoke our
lfs-ssh-echo utility with the ControlMaster and ControlPath arguments.
As described in a prior commit in this PR, our lfs-ssh-echo test
utility program had a bug which prevented it from starting SSH
sessions with the ControlMaster argument set to "no", so the "batch
transfers with ssh endpoint (git-lfs-transfer)" test would have
failed if it tried to push more than a single object.
Such a test would also fail if it tried to fetch more than a single
object, due to the bug described in #5880. Specifically, we returned
a nil from the Connection() method of the SSHTransfer structure in our
"ssh" package when we had terminated all the SSH sessions, but then
sometimes tried to reference that nil pointer in the batchInternal()
method of the SSHBatchClient structure in the "tq" package, causing
a Go panic condition.
In prior commits in this PR we resolved these problems, first the bug
in the lfs-ssh-echo test utility and then the bad return value from the
Connection() method of the SSHTransfer structure in the Git LFS client.
In the case of the latter issue, we adjusted the Connection() method
to return a non-nil error when the requested session ID exceeds the
maximum number of sessions permitted, which also covers the case where
all the sessions have already been terminated.
Therefore we can now introduce additional tests of the SSH object
transfer protocol which push and fetch multiple objects. In these
tests we use the new assert_remote_object() function that we defined
in a prior commit in this PR to confirm that the pushed objects are
all written to the remote repository. As well, we use the new
assert_ssh_transfer_sessions() function we defined in another prior
commit in this PR to check that the number of SSH sessions that
create a control socket matches our expectations, as do the number
of startup, success, and termination trace log messages.
The first of our new tests leaves the maximum number of concurrent
object transfers set to the default value of eight, so that all three
of the objects we create in the test are pushed in a single batch,
and may also be fetched in a single batch if the available version
of Git is 2.11.0 or higher. To push or fetch these objects in a
single batch requires that the Git LFS client establish as many as
three separate SSH sessions per invocation, of which only the first
should create a control socket.
The second of our new tests sets the maximum number of concurrent
object transfers to two, so we expect to see a maximum of only two SSH
sessions per invocation of the Git LFS client, and only the first of
these sessions should start an SSH connection with a control socket.
Prior to version 2.11.0, Git did not support the "process" filter
attribute, and so during a clone operation Git LFS would be invoked
via the "smudge" filter instead, once for each object. When testing
with such a version of Git, our assert_ssh_transfer_sessions()
function adjusts its expectations to account for the fact that each
invocation of Git LFS during a clone operation will establish its
own SSH session with a control socket, and so the total number of
trace log messages from these sessions should match the total number
of objects being fetched.1 parent eca6c8a commit a84cd13
1 file changed
Lines changed: 109 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
202 | 222 | | |
203 | 223 | | |
| 224 | + | |
204 | 225 | | |
205 | 226 | | |
| 227 | + | |
206 | 228 | | |
207 | 229 | | |
208 | 230 | | |
| |||
247 | 269 | | |
248 | 270 | | |
249 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
0 commit comments