git-lfs/tq
Chris Darroch e2a0e1cd1e tq/transfer_test.go: enable and fix all tests
The three test functions in the tq/transfer_test.go source file are
all named with the prefix "test" rather than "Test", and as a result,
do not actually execute.  This oversight dates from the original
introduction of these tests in the "transfer" package in commit
10623f5d7a7d785fb3863c2b190b0f2f99686b7c of PR #1265.  (The package
was later renamed to the current "tq" package in commit
891db97a429405f80d54c7e09219bda9799e8e6e of PR #1780.)

We therefore change the test function names to begin with "Test",
and resolve several test regressions which have accumulated since the
tests were first added.

First, the TestBasicAdapterExists() function calls the
GetDownloadAdapterNames() and GetUploadAdapterNames() methods of the
Manifest structure, and these now return the names of three transfer
adapter implementations rather than just the original "basic" one,
so we allow for all three names to appear in any order.  (The
"lfs-standalone-file" adapter was added in commit
bb05cf5053d9abd6d7ca68354ca9663e57bb6737 of PR #3748, and the "ssh"
adapter was added in commit 594f8e386cce3441e06c9094ab5e251f0e07ca1f
of PR #4446.)

Second, the TestAdapterRegAndOverride() function expects the
NewDownloadAdapter() and NewUploadAdapter() methods of the Manifest
structure to return nil if the provided name argument does not match
that of any registered transfer adapter.  However, this has not been
the behaviour of those methods since commit
c5c2a756c70b2a961cea284fc7b00d2753bfaa3b of PR #1279, shortly after
the tests were first introduced in PR #1265.  In that commit, the
NewAdapterOrDefault() method was added, and the NewDownloadAdapter()
and NewUploadAdapter() methods revised to call it, so they return the
default "basic" adapter if the requested name does not match a
registered adapter.  We therefore revise and expand the test to
account for this behaviour, and also make sure to directly test the
underlying NewAdapter() method, which retains the originally intended
behaviour and returns nil if it does not find a matching adapter
for the provided name argument.

Third, although the TestAdapterRegButBasicOnly() function passes without
changes, it no longer fully performs the checks it was intended to make,
since the NewDownloadAdapter() and NewUploadAdapter() methods now always
return a non-nil value, so using a non-nil response from them to prove
that the "test" adapter was found is insufficient.  We therefore update
the test to confirm that the returned value from these functions is
a "test" adapter, as expected, and not just a "basic" one.

We also replace the use of the BasicAdapterName variable with the
"basic" string to align with the other tests.
2023-07-26 17:58:12 -07:00
..
schemas tq,lfsapi/ssh: convert int64 to int 2017-04-05 14:46:45 -06:00
adapterbase.go make additional message strings translatable 2022-01-29 22:36:19 -08:00
api_test.go tq/api_test.go: remove unneeded translations 2022-01-29 22:32:57 -08:00
api.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
basic_download.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
basic_upload.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
custom_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
custom.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
errors_test.go tq/errors: implement MalformedObjectError 2017-03-24 14:36:59 -06:00
errors.go tq: make strings translatable 2022-01-18 17:38:25 +00:00
manifest_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
manifest.go tq: avoid spawning SSH process needlessly 2023-03-28 15:21:58 +00:00
meter.go avoid extra message format parsing where possible 2022-01-29 22:32:58 -08:00
ssh.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
transfer_queue_test.go tq: add exponential backoff for retries 2020-04-15 14:10:16 -07:00
transfer_queue.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
transfer_test.go tq/transfer_test.go: enable and fix all tests 2023-07-26 17:58:12 -07:00
transfer.go make additional message strings translatable 2022-01-29 22:36:19 -08:00
tus_upload.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
verify_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
verify.go Set package version to v3 2021-09-02 20:41:08 +00:00