]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0303-credential-external.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / t0303-credential-external.sh
CommitLineData
861444f6
JK
1#!/bin/sh
2
6c556cb8
ZJS
3test_description='external credential helper tests
4
5This is a tool for authors of external helper tools to sanity-check
6their helpers. If you have written the "git-credential-foo" helper,
7you check it with:
8
9 make GIT_TEST_CREDENTIAL_HELPER=foo t0303-credential-external.sh
10
11This assumes that your helper is capable of both storing and
12retrieving credentials (some helpers may be read-only, and they will
13fail these tests).
14
15Please note that the individual tests do not verify all of the
16preconditions themselves, but rather build on each other. A failing
17test means that tests later in the sequence can return false "OK"
18results.
19
20If your helper supports time-based expiration with a configurable
21timeout, you can test that feature with:
22
23 make GIT_TEST_CREDENTIAL_HELPER=foo \
24 GIT_TEST_CREDENTIAL_HELPER_TIMEOUT="foo --timeout=1" \
25 t0303-credential-external.sh
26
27If your helper requires additional setup before the tests are started,
28you can set GIT_TEST_CREDENTIAL_HELPER_SETUP to a sequence of shell
29commands.
30'
31
861444f6
JK
32. ./test-lib.sh
33. "$TEST_DIRECTORY"/lib-credential.sh
34
16e44810
ZJS
35if test -z "$GIT_TEST_CREDENTIAL_HELPER"; then
36 skip_all="used to test external credential helpers"
37 test_done
38fi
861444f6 39
16e44810
ZJS
40test -z "$GIT_TEST_CREDENTIAL_HELPER_SETUP" ||
41 eval "$GIT_TEST_CREDENTIAL_HELPER_SETUP"
861444f6 42
16e44810
ZJS
43# clean before the test in case there is cruft left
44# over from a previous run that would impact results
45helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
861444f6 46
16e44810 47helper_test "$GIT_TEST_CREDENTIAL_HELPER"
861444f6
JK
48
49if test -z "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"; then
16e44810 50 say "# skipping timeout tests (GIT_TEST_CREDENTIAL_HELPER_TIMEOUT not set)"
861444f6 51else
861444f6 52 helper_test_timeout "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"
861444f6
JK
53fi
54
16e44810
ZJS
55# clean afterwards so that we are good citizens
56# and don't leave cruft in the helper's storage, which
57# might be long-term system storage
58helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
59
861444f6 60test_done