Commit 9bae8eb
committed
t: add object presence assertion for SSH remotes
In subsequent commits in this PR we expect to resolve a pair of issues
which prevent us from testing the SSH object transfer protocol with
more than a single object. The SSH transfer protocol was introduced in
PR git-lfs#4446, and in commit 691de51 of
that PR, the "batch transfers with ssh endpoint (git-lfs-transfer)" test
in our t/t-batch-transfer.sh test script was added to validate that the
new protocol worked as expected.
This test pushes and then fetches a single object, so the issues which
arise when handling multiple objects in a batch do not cause the test to
fail. Hence we intend to add two other tests to accompany the existing
one so as to validate the SSH transfer protocol with multiple objects.
As these tests will all perform object transfers only over SSH, our
HTTP-based lfstest-gitserver test helper program will not be used in
any of them. That program retains a copy of each object it receives
in memory to simulate a remote Git LFS server. As a consequence, many
of our tests use the assert_server_object() function defined in our
t/testhelpers.sh library to confirm that an object has been received
by the remote server; this function makes an HTTP batch request to
the lfstest-gitserver program and checks the JSON response.
In our tests of the SSH transfer protocol, by contrast, object
data will be proxied by the lfs-ssh-echo helper program to the
git-lfs-transfer command, which will write the data into a separate
bare Git repository in the location provided as command argument.
In fact this is how the existing test already operates; it uses
the ssh_remote() function from our t/testhelpers.sh library to
establish the SSH URL for its remote repository. The URLs returned
by this function always include the directory path from our REMOTEDIR
variable. We expect to also use the ssh_remote() function in our
new tests to establish their remote repositories.
In both our existing test and the ones we will add in a subsequent
commit in this PR, we would like to confirm that the Git LFS objects
we push have been successfully written into the "lfs/objects" cache
in the remote repositories. To simplify such checks, we define a new
assert_remote_object() assertion function in our shell test library.
Unlike the assert_server_object() function, which makes an HTTP
request, our new assertion acts in a similar manner to the existing
assert_local_object() function by simply validating the size and
existence of an object file in the appropriate subdirectory of the
"lfs/objects" cache hierarchy of a bare repository. However, our new
assert_remote_object() function constructs the path to the repository
using the REMOTEDIR variable, rather than checking the object's
presence in the current local repository as the assert_local_object()
function does.
With the assert_remote_object() function defined, we then update our
existing "batch transfers with ssh endpoint (git-lfs-transfer)" test
to make use of it after pushing an object over the SSH transfer
protocol, and we will use the function for the same purpose in the
additional tests we expect to introduce in a later commit in this PR.1 parent 39f9786 commit 9bae8eb
2 files changed
+17
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
179 | 195 | | |
180 | 196 | | |
181 | 197 | | |
| |||
0 commit comments