Skip to content

Commit 16e4481

Browse files
keszybzgitster
authored andcommitted
t0303: immediately bail out w/o GIT_TEST_CREDENTIAL_HELPER
t0300-credential-helpers.sh requires GIT_TEST_CREDENTIAL_HELPER to be configured to do something sensible. If it is not set, prove will say: ./t0303-credential-external.sh .. skipped: (no reason given) which isn't very nice. Use skip_all="..." && test_done to bail out immediately and provide a nicer message. In case GIT_TEST_CREDENTIAL_HELPER is set, but the timeout tests are skipped, mention GIT_TEST_CREDENTIAL_HELPER_TIMEOUT. Signed-off-by: Zbigniew Jędrzejewski-Szmek <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a460348 commit 16e4481

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

t/t0303-credential-external.sh

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,29 @@ test_description='external credential helper tests'
44
. ./test-lib.sh
55
. "$TEST_DIRECTORY"/lib-credential.sh
66

7-
pre_test() {
8-
test -z "$GIT_TEST_CREDENTIAL_HELPER_SETUP" ||
9-
eval "$GIT_TEST_CREDENTIAL_HELPER_SETUP"
7+
if test -z "$GIT_TEST_CREDENTIAL_HELPER"; then
8+
skip_all="used to test external credential helpers"
9+
test_done
10+
fi
1011

11-
# clean before the test in case there is cruft left
12-
# over from a previous run that would impact results
13-
helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
14-
}
12+
test -z "$GIT_TEST_CREDENTIAL_HELPER_SETUP" ||
13+
eval "$GIT_TEST_CREDENTIAL_HELPER_SETUP"
1514

16-
post_test() {
17-
# clean afterwards so that we are good citizens
18-
# and don't leave cruft in the helper's storage, which
19-
# might be long-term system storage
20-
helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
21-
}
15+
# clean before the test in case there is cruft left
16+
# over from a previous run that would impact results
17+
helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
2218

23-
if test -z "$GIT_TEST_CREDENTIAL_HELPER"; then
24-
say "# skipping external helper tests (set GIT_TEST_CREDENTIAL_HELPER)"
25-
else
26-
pre_test
27-
helper_test "$GIT_TEST_CREDENTIAL_HELPER"
28-
post_test
29-
fi
19+
helper_test "$GIT_TEST_CREDENTIAL_HELPER"
3020

3121
if test -z "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"; then
32-
say "# skipping external helper timeout tests"
22+
say "# skipping timeout tests (GIT_TEST_CREDENTIAL_HELPER_TIMEOUT not set)"
3323
else
34-
pre_test
3524
helper_test_timeout "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"
36-
post_test
3725
fi
3826

27+
# clean afterwards so that we are good citizens
28+
# and don't leave cruft in the helper's storage, which
29+
# might be long-term system storage
30+
helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
31+
3932
test_done

0 commit comments

Comments
 (0)