diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-02-27 16:04:32 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-02-27 16:04:33 -0800 |
| commit | a56bb9f66ab8dbbb07cf70496f829dd42b5c63d6 (patch) | |
| tree | b5e9a105d1131cced05efdac470e834e8a0156d8 | |
| parent | 70dadd510be0c4673eb81138d3daeefb01afae2a (diff) | |
| parent | e41d68b75c7e9beb1bc92ad5519c30a215c9d9d1 (diff) | |
| download | git-a56bb9f66ab8dbbb07cf70496f829dd42b5c63d6.tar.gz | |
Merge branch 'jk/t0303-clean'
Test clean-up.
* jk/t0303-clean:
t0303: check that helper_test_clean removes all credentials
| -rwxr-xr-x | t/t0303-credential-external.sh | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/t/t0303-credential-external.sh b/t/t0303-credential-external.sh index 095574bfc6..72ae405c3e 100755 --- a/t/t0303-credential-external.sh +++ b/t/t0303-credential-external.sh @@ -32,9 +32,24 @@ commands. . ./test-lib.sh . "$TEST_DIRECTORY"/lib-credential.sh +# If we're not given a specific external helper to run against, +# there isn't much to test. But we can still run through our +# battery of tests with a fake helper and check that the +# test themselves are self-consistent and clean up after +# themselves. +# +# We'll use the "store" helper, since we can easily inspect +# its state by looking at the on-disk file. But since it doesn't +# implement any caching or expiry logic, we'll cheat and override +# the "check" function to just report all results as OK. if test -z "$GIT_TEST_CREDENTIAL_HELPER"; then - skip_all="used to test external credential helpers" - test_done + GIT_TEST_CREDENTIAL_HELPER=store + GIT_TEST_CREDENTIAL_HELPER_TIMEOUT=store + check () { + test "$1" = "approve" || return 0 + git -c credential.helper=store credential approve + } + check_cleanup=t fi test -z "$GIT_TEST_CREDENTIAL_HELPER_SETUP" || @@ -59,4 +74,11 @@ fi # might be long-term system storage helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER" +if test "$check_cleanup" = "t" +then + test_expect_success 'test cleanup removes everything' ' + test_must_be_empty "$HOME/.git-credentials" + ' +fi + test_done |
