Skip to content
Branch: master
Find file History
bk2204 command/install: exit unsuccessfully on error
When git lfs install fails, exit unsuccessfully, so that the users
writing scripts can easily detect this error. Disable the test on
Windows, which does not have the proper chmod behavior to make the test
work.
Latest commit 743f9b3 Apr 23, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
cmd Use git-lfs version of go-ntlm Apr 1, 2019
fixtures Modify logic of 'migrate info' to process extensionless files Jan 8, 2019
git-lfs-test-server-api
Makefile
README.md t/README.md: link to 'Test Lifecycle' appropriately Jul 16, 2018
t-askpass.sh Merge branch 'master' into ttaylorr/prove Jul 17, 2018
t-attributes.sh commands/track: read all attributes files to parse macros Dec 3, 2018
t-batch-error-handling.sh
t-batch-retries-ratelimit.sh Add a test to check that git lfs clone handles rate limits Jan 8, 2019
t-batch-retries.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-batch-transfer.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-batch-unknown-oids.sh
t-checkout.sh filepathfilter: don't say file is both accepted and rejected Nov 2, 2018
t-chunked-transfer-encoding.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-clean.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-clone-deprecated.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-clone.sh lfsapi: add support for encrypted client TLS private keys Sep 24, 2018
t-commit-delete-push.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-config.sh
t-content-type.sh
t-credentials-no-prompt.sh
t-credentials.sh
t-custom-transfers.sh tq: pass custom transfer adapter args to the shell Sep 14, 2018
t-duplicate-oids.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-env.sh command/env: ensure we honor lfs.url Jan 11, 2019
t-expired.sh
t-ext.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-extra-header.sh
t-fetch-include.sh
t-fetch-paths.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-fetch-recent.sh
t-fetch-refspec.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-fetch.sh t: add a test for fetching from alternate repositories Nov 16, 2018
t-filter-branch.sh
t-filter-process.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-fsck.sh
t-happy-path.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-install-custom-hooks-path-unsupported.sh
t-install-custom-hooks-path.sh
t-install.sh
t-lock.sh
t-locks.sh
t-logs.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-ls-files.sh Rename ls-files --name option to --name-only (-n) Sep 20, 2018
t-malformed-pointers.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-mergetool.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-migrate-export.sh Merge branch 'master' into ttaylorr/prove Jul 23, 2018
t-migrate-fixup.sh Merge branch 'master' into ttaylorr/prove Jul 23, 2018
t-migrate-import-no-rewrite.sh
t-migrate-import.sh commands/command_migrate_import.go: install hooks Sep 5, 2018
t-migrate-info.sh
t-object-authenticated.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-pointer.sh commands/command_pointer.go: introduce `--check` option Feb 1, 2019
t-post-checkout.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-post-commit.sh
t-post-merge.sh
t-pre-push.sh commands: set push remote for pre-push Mar 27, 2019
t-progress-meter.sh
t-progress.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-prune-worktree.sh
t-prune.sh
t-pull.sh tq/adapterbase: fix typo enableHrefRerite to enableHrefRewrite Apr 4, 2019
t-push-bad-dns.sh
t-push-failures-local.sh
t-push-failures-remote.sh
t-push-file-with-branch-name.sh
t-push.sh tq/adapterbase: fix typo enableHrefRerite to enableHrefRewrite Apr 4, 2019
t-reference-clone.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-resume-http-range.sh tq: retry on oversize file Feb 22, 2019
t-resume-tus.sh
t-smudge.sh t/t-smudge.sh: remove unnecessary test Feb 6, 2019
t-ssh.sh
t-status.sh
t-submodule-lfsconfig.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-submodule.sh
t-track-attrs.sh
t-track-wildcards.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-track.sh t: don't use invalid syntax in .gitattributes Dec 3, 2018
t-umask.sh TST: Trim security context when checking permissions. Jan 15, 2019
t-uninstall.sh commands/uninstall: add a --skip-repo option Oct 17, 2018
t-unlock.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-untrack.sh Fix a redirection typo which has plagued the poor t-untrack.sh before… Aug 21, 2018
t-unusual-filenames.sh
t-update.sh t: load shell scripts from $(dirname) instead of 't' Jul 10, 2018
t-verify.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
t-version.sh
t-worktree.sh config: install worktree hooks in the proper directory Feb 27, 2019
t-zero-len-file.sh t: avoid using shell variables in printf's first argument Sep 10, 2018
test-alternates.sh
testenv.sh
testhelpers.sh t: generate an encrypted private key for tests Sep 24, 2018
testlib.sh t: add an environment variable to dump test output Sep 18, 2018

README.md

t

This directory contains one of the two types of tests that the Git LFS project uses to protect against regression. The first, scattered in *_test.go files throughout the repository are unit tests, and written in Go, designed to uncover failures at the unit level.

The second kind--and the one contained in this directory--are integration tests, which are designed to exercise Git LFS in an end-to-end fashion, running the git, and git-lfs binaries, along with a mock Git server.

You can run all tests in this directory with any of the following:

$ make
$ make test
$ make PROVE_EXTRA_ARGS=-j9 test

Or run a single test (for example, t-checkout.sh) by any of the following:

$ make ./t-checkout.sh
$ make PROVE_EXTRA_ARGS=-v ./t-checkout.sh
$ ./t-checkout.sh

Alternatively, one can run a selection of tests (via explicitly listing them or making use of the built-in shell globbing) by any of the following:

$ make ./t-*.sh
$ make PROVE_EXTRA_ARGS=-j9 ./t-*.sh
$ ./t-*.sh

Test File(s)

There are a few important kinds of files to know about in the t directory:

  • cmd/: contains the source code of binaries that are useful during test time, like the mocked Git server, or the test counting binary. For more about the contents of this directory, see test lifecycle below.

    The file t/cmd/testutils.go is automatically linked and included during the build process of each file in cmd.

  • fixtures/: contains shell scripts that load fixture repositories useful for testing against.

  • t-*.sh: file(s) containing zero or more tests, typically related to a similar topic (c.f,. t/t-push.sh, t/t-pull.sh, etc.)

  • testenv.sh: loads environment variables useful during tests. This file is sourced by testlib.sh.

  • testhelpers.sh: loads shell functions useful during tests, like setup_remote_repo, and clone_repo.

  • testlib.sh: loads the begin_test, end_test, and similar functions useful for instantiating a particular test.

Test Lifecycle

When a test is run, the following occurs, in order:

  1. Missing test binaries are compiled into the bin directory in the repository root. Note: this does not include the git-lfs binary, which is re-compiled via script/boostrap.

  2. An integration server is started by either (1) the Makefile or (2) the cmd/lfstest-count-test.go program, which keeps track of the number of running tests and starts an integration server any time the number of active tests goes from 0 to 1, and stops the server when it goes from n to 0.

  3. After sourcing t/testlib.sh (& loading t/testenv.sh), each test is run in sequence per file. (In other words, multiple test files can be run in parallel, but the tests in a single file are run in sequence.)

  4. An individual test will finish, and (if running under prove) another will be started in its place. Once all tests are done, t/test_count will go to 0, and the test server will be torn down.

Test Environment

There are a few environment variables that you can set to change the test suite behavior:

  • GIT_LFS_TEST_DIR=path - This sets the directory that is used as the current working directory of the tests. By default, this will be in your temp dir. It's recommended that this is set to a directory outside of any Git repository.

  • KEEPTRASH=1 - This will leave the local repository data in a tmp directory and the remote repository data in test/remote.

Also ensure that your noproxy environment variable contains 127.0.0.1 host, to allow git commands to reach the local Git server lfstest-gitserver.

Writing new tests

A new test file should be named t/t-*.sh, where * is the topic of Git LFS being tested. It should look as follows:

#!/usr/bin/env bash

. "$(dirname "$0")/testlib.sh"

begin_test "my test"
(
  set -e

  # ...
)
end_test
You can’t perform that action at this time.