Commit Graph

37 Commits

Author SHA1 Message Date
brian m. carlson
dcfd29419e
Remove NTLM support
Our NTLM support has been known to be broken in various situations for a
while, specifically on Windows.  The core team is unable to troubleshoot
these problems, and nobody has stepped up to maintain the NTLM support.
In addition, NTLM uses cryptography and security techniques that are
known to be insecure, such as the algorithms DES, MD4, and MD5, as well
as simple, unsalted hashes of passwords.

Since we now support Kerberos, most users should be able to replace
their use of NTLM with Kerberos instead.  Users have reported this
working on Windows and it is known to work well on at least Debian as
well.  Drop support for NTLM and remove it from the codebase.
2021-02-02 16:41:41 +00:00
brian m. carlson
44fae30843
t: add test for download gzip transport compression
Since we're uploading and downloading a large amount of data, we may
prefer to use transport compression.  Currently, Go will do this for us
automatically unless we ask it not to.  Let's detect this case and add a
trace output so people can find it and we can add a test that it
continues to work.

Note that it's not possible to detect this using the headers since Go
adds the headers on the request and strips the headers on the response
as part of making the request, so it's not readily apparent to users
without this trace output.
2020-12-14 20:05:43 +00:00
brian m. carlson
9e006ac4e2
Rename default branch in tests to "main"
Currently, our default branch in tests is "master".  This is the Git
default, but the Git default will likely change in the future, so it
makes sense to update our testsuite to be explicit about the branch
name.  We'll ensure this continues by building against older versions of
Git as well as newer versions.

We use "main" for the new branch name, since that's the proposed value
upstream.

This commit was made entirely by automated means using the following
command:

  git grep -l master t | xargs sed -i -e 's/master/main/g'
2020-07-08 15:38:17 +00:00
Chris Darroch
6f6b353c25 t: ensure local binary always used in tests
When running our test suite, including the Go tests, we want to ensure
that our locally compiled "git-lfs" binary is the one which is used
whenever "git-lfs" is invoked, for instance as a Git filter command
or as the transfer queue's default custom adapter.  Otherwise we may
see unexpected test failures or successes, if another "git-lfs" binary
installed elsewhere on the system is used instead.

Therefore we define an init() function in the common test utilities
package which prepends to the PATH environment variable an absolute path
to the working tree's "bin/" directory, to ensure our "git-lfs" binary
is always found in preference to any other installed versions.
2020-03-27 17:28:40 -07:00
vend_natalie.chen
d7d9fd711a fix upload retry 'file already closed' issue' 2020-02-26 11:13:54 +08:00
brian m. carlson
b1dad49a07
t/cmd: mark lfstest-realpath as being a test tool
It's important for us to flag this binary as a test tool so that Go
doesn't complain about us having multiple instances of the main function
in different files.  Not doing this causes failures when the Debian
package is built in the Docker containers, since the Debian build system
wants to build all packages, including the test packages, at once.
2019-10-01 14:29:32 +00:00
Rafal Kupka
bb87944770 Add http.cookieFile test
The script has to overwrite GITSERVER because golang http library refuses to
accept cookies for 127.0.0.1.
2019-09-28 19:02:20 +01:00
brian m. carlson
391689b02e
t: add a test helper equivalent to realpath(1)
On Actions, our Windows build root has a path with a short name.  This
causes significant grief, since our tests expect one version of the path
and we output another, causing our tests for equality to fail.  Since
Windows lacks a realpath(1) utility, provide a small wrapper around the
Go primitives to provide a limited version of this utility for use only
in our tests.
2019-09-09 14:30:54 +00:00
brian m. carlson
1b2e4c3d4e
t/cmd: make credential helper produce useful errors
The credential helper can fail in some cases when it gets data that
doesn't contain a colon.  In such a case, make it print a useful error
instead of panicking.
2019-09-09 14:07:37 +00:00
Kitten King
f5f712b4de
Fix Typos 2019-07-24 07:17:40 +00:00
brian m. carlson
8e21176ba6
t: make test server check for required headers
When we make a request to the test server, we need an appropriate Accept
header, and when we make a POST request, we need an appropriate
Content-Type header as well. To ensure we have the right behavior in all
code paths, have the test server check for the Accept header and return
a 406 if it's not correct. Similarly, check all POST requests for an
appropriate Content-Type header, and fail the request if it's wrong.
This ensures that all of our code paths have the expected behavior.
2019-05-22 21:02:03 +00:00
brian m. carlson
fe2fa6746b
Use git-lfs version of go-ntlm
The upstream of go-ntlm has archived its repository and is no longer
doing releases. Because this dependency is required for Git LFS, we've
created our own fork to ensure that the upstream repo doesn't disappear
on us. Use our own copy of go-ntlm within Git LFS.
2019-04-01 19:00:38 +00:00
brian m. carlson
420217c2a2
Log test server stderr to log
When there's a problem with the test server, it's helpful to see the log
output to help troubleshoot the issue. However, when the Stderr member
of a command struct is not set, the standard error gets redirected to
/dev/null, which isn't really what we want.

Since we already have a log set up for logging standard output, send
standard error there as well.
2019-03-27 17:18:20 +00:00
brian m. carlson
73e8a713aa
tq: retry on oversize file
If we're attempting to resume a download but the file we have on disk is
the expected size or too large, we'll send an invalid Range header where
the lower bound is greater than the upper bound. If this situation
occurs, simply retry the download from the beginning, since we clearly
don't have the expected data (or we wouldn't be resuming) and it isn't
clear how else to recover.
2019-02-22 14:46:10 +00:00
Zac Romero
4fe0a8db4f Add integration tests; check other places where 429 could occur 2019-01-07 12:27:02 +03:00
brian m. carlson
cc815f59e6
Use proper repo permissions when creating directories
Honor the repository permssions set with the umask or
core.sharedRepository when creating directories by using tools.MkdirAll.
Pass an appropriate configuration or filesystem object through as needed
to ensure that we can query the proper permissions. Add a test that
these code paths work by cloning a new repository and then performing
some operations on it.

Note that in the test, we match patterns with either the setgid bit
clear or set, since it may be set or not depending on whether the system
has SysV or BSD group semantics.
2018-12-13 17:51:02 +00:00
Preben Ingvaldsen
955cddbbbe t: add netrc retry test
Add a test to ensure that, if netrc credentials fail, the
credential helper will successfuly fall back on other credential
helpers.
2018-10-08 16:18:06 -07:00
Preben Ingvaldsen
3f61ea62f4 tq: use correct access
For tq requests, use the URL being transferred to for the access
mode instead of the LFS API endpoint. Since these endpoints are
different, this will ensure credentials aren't passed along
needlessly if, for example, the API endpoint requires
authentication and the endpoint being transferred to does not.
2018-09-28 14:16:55 -07:00
Preben Ingvaldsen
880bbf81af lfsapi: add Access param to DoWithAuth()
Add a new Access parameter to DoWithAuth() to allow callers to
specify the URL Access Mode. This removes the assumption that
DoWithAuth() will always be used for an LFS API request. This
commit also adds DoAPIRequestWithAuth(), which provides the
functionality of DoWithAuth() while explicitly using the LFS API
endpoint for the access mode, allowing parity with the previous
DoWithAuth() functionality.
2018-09-28 14:16:55 -07:00
brian m. carlson
52f94c2f70
t: generate an encrypted private key for tests
In the future, we'll want to run integration tests that use an encrypted
private key.  To make this as easy as possible, create an encrypted
private key as part of the test setup.  Set up credentials for this key
using the credential helper.

Note that in order to get Git to use the credential helper for the
encrypted private key instead of prompting using OpenSSL, we need to
set GIT_SSL_CERT_PASSWORD_PROTECTED, which makes Git think that the
certificate is password-protected, too.  Therefore, specify credentials
for both the certificate (which isn't really encrypted) and the
encrypted private key.
2018-09-24 15:09:20 +00:00
brian m. carlson
1790168bd5
t: make credential helper handle local URLs
The lfstest credential helper provides credentials found by reading a
file on the system.  Currently, it expects that there is a colon in the
URL followed by one or more slashes.  If there is not (say, because
we're using a file:/// or cert:/// URL), it fails to concatenate the
path properly, and instead of looking in the credentials directory,
looks for a different file one directory higher.  This occurs because
filepath.Join strips off a trailing slash if the second argument passed
to it is empty.

This, of course, makes the credential helper fail to work and the tests
hang waiting for input.  Insert an additional slash in the environment
variable and handle the empty string case properly so that credentials
for local paths can be looked up properly.
2018-09-24 15:09:20 +00:00
brian m. carlson
c53f28aca5
Merge pull request #3259 from bk2204/custom-transfer-args
Expand custom transfer args by using the shell
2018-09-24 14:07:00 +00:00
brian m. carlson
c055fc5eb3 t: make lfstest credential helper log all operations
There are current some tests which randomly fail on CI systems that
don't appear to fail on normal development systems.  To help
troubleshoot these, always log when the lfstest credential helper (which
is used in our tests) receives a command, even if we ignore it.
2018-09-18 20:48:18 +00:00
brian m. carlson
7646075431 tq: pass custom transfer adapter args to the shell
When a custom transfer adapter is specified in the configuration, it is
not possible to specify multiple arguments to the process, because only
the last value of the lfs.customtransfer.*.args option is read and the
value is not split.  To make things easier and more flexible,
concatenate the path (after quoting) and the arguments and pass them to
the shell.  Update the documentation to reflect this change.

Update the test custom transfer adapter to parse its arguments (which
are otherwise ignored) and mention them to standard error.  Make the
test check that the arguments are parsed as the shell would expect them
to be.
2018-09-14 23:52:38 +00:00
brian m. carlson
47f70aec2e t: avoid panic in lfstest-customadapter
The custom adapter test binary wraps the HTTP API client and returns
various responses from the HTTP response to the custom transfer adapter.
This code assumes that if an error occurs, we will always have a valid
HTTP response object, but this is not the case.  If we lack such an
object, we will get a nil pointer dereference, a panic, and a segfault
in the client, causing the test to fail.

While it's currently unknown how to reproduce this issue, it has been
seen on the CI servers.  In order to improve the reliability of the
test, check to see if the response object is non-nil before
dereferencing it and produce a different but distinct error code if it
is nil.
2018-09-13 23:24:51 +00:00
Taylor Blau
9b73c8096a appveyor.yml: disable lock acquiring
On the AppVeyor CI Windows environment, there exist issues that prevent
the lfstest-count-tests program from acquiring the test_count.lock file
correctly.

Instead of debugging these environment-specific issues further, note
that because GIT_LFS_NO_TEST_COUNT=1, there is only ever one running
instance of lfstest-count-tests (at the beginning and end of the
integration suite).

So, disable the lock acquisition step entirely, and thus skip acquiring
the test_count.lock file in the first place.
2018-07-23 11:17:48 -05:00
Taylor Blau
8f6da1074b t/cmd/lfstest-count-tests.go: return errNegativeCount when negative 2018-07-16 16:38:06 -05:00
Taylor Blau
bbb8f5e485 t/cmd/lfstest-count-tests.go: prefer consistent constant usage
In both the 'increment' and 'decrement' countFn, we observer the
following pattern:

    if /* some computation with n */ {
      // ...
      return n +- 1, nil
    }
    // ...
    return /* 0 or 1 */, nil

But in the below case of the increment implementation, we violate this
example. Let's fix that be adhering to the above.
2018-07-16 16:34:47 -05:00
Taylor Blau
55fe3b99bb t/cmd/lfstest-count-tests.go: document our implementation 2018-07-13 14:10:21 -05:00
Taylor Blau
eb5c5c0417 cmd/lfstest-count-tests.go: use platform-appropriate executable name 2018-07-13 13:06:44 -05:00
Taylor Blau
eb056fb74b t: move testutils.go to cmd sub-package 2018-07-13 12:54:18 -05:00
Taylor Blau
2097051b12 t: store test_count{,.lock} in t, not t/remote 2018-07-11 13:58:02 -05:00
Taylor Blau
900c3e77a3 cmd/lfstest-count-test.go: POST to /shutdown 2018-07-11 13:18:25 -05:00
Taylor Blau
fb07024eb6 cmd/lfstest-count-tests: wait for longer to acquire lock 2018-07-11 13:18:25 -05:00
Taylor Blau
1926e94297 t/cmd/lfstest-count-tests.go: initial commit 2018-07-11 13:18:15 -05:00
Taylor Blau
4a380ce009 t/Makefile: build auxiliary test programs for 'test' 2018-07-10 13:52:59 -05:00
Taylor Blau
7b1420243e test: move to 'test' to 't'
By default, the prove(1) program looks for tests to run in the 't'
directory at the repository root, so let's put existing tests there in
order to remove a non-default argument from prove.
2018-07-09 16:07:32 -05:00