t5510-fetch: run non-httpd-specific test before sourcing 'lib-httpd.sh'

't5510-fetch.sh' sources 'lib-httpd.sh' near the end to run a httpd-specific test, but 'lib-httpd.sh' skips all the rest of the test script if the dependencies for running httpd tests are not fulfilled. Alas, recently cdbd70c437 (fetch: add --[no-]show-forced-updates argument, 2019-06-18) appended a non-httpd-specific test at the end, and this test is then skipped as well when httpd tests can't be run. Move this new test earlier in the test script, before 'lib-httpd.sh' is sourced, so it will be run even when httpd tests aren't. Also add a comment at the end of this test script to warn against adding non-httpd-specific tests at the end, in the hope that it will help prevent similar issues in the future. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Aug 1, 2019 at 17:53 UTC 12b1826609d5c309336ffd9f56e42abaf8d96cef
1 file changed +25 -22
t/t5510-fetch.sh
+25 -22
@@ -902,6 +902,29 @@ test_expect_success C_LOCALE_OUTPUT 'fetch compact output' '
902 test_cmp expect actual
903 '
904
905 +test_expect_success '--no-show-forced-updates' '
906 + mkdir forced-updates &&
907 + (
908 + cd forced-updates &&
909 + git init &&
910 + test_commit 1 &&
911 + test_commit 2
912 + ) &&
913 + git clone forced-updates forced-update-clone &&
914 + git clone forced-updates no-forced-update-clone &&
915 + git -C forced-updates reset --hard HEAD~1 &&
916 + (
917 + cd forced-update-clone &&
918 + git fetch --show-forced-updates origin 2>output &&
919 + test_i18ngrep "(forced update)" output
920 + ) &&
921 + (
922 + cd no-forced-update-clone &&
923 + git fetch --no-show-forced-updates origin 2>output &&
924 + test_i18ngrep ! "(forced update)" output
925 + )
926 +'
927 +
928 setup_negotiation_tip () {
929 SERVER="$1"
930 URL="$2"
@@ -978,27 +1001,7 @@ test_expect_success '--negotiation-tip limits "have" lines sent with HTTP protoc
1001 check_negotiation_tip
1002 '
1003
981 -test_expect_success '--no-show-forced-updates' '
982 - mkdir forced-updates &&
983 - (
984 - cd forced-updates &&
985 - git init &&
986 - test_commit 1 &&
987 - test_commit 2
988 - ) &&
989 - git clone forced-updates forced-update-clone &&
990 - git clone forced-updates no-forced-update-clone &&
991 - git -C forced-updates reset --hard HEAD~1 &&
992 - (
993 - cd forced-update-clone &&
994 - git fetch --show-forced-updates origin 2>output &&
995 - test_i18ngrep "(forced update)" output
996 - ) &&
997 - (
998 - cd no-forced-update-clone &&
999 - git fetch --no-show-forced-updates origin 2>output &&
1000 - test_i18ngrep ! "(forced update)" output
1001 - )
1002 -'
1004 +# DO NOT add non-httpd-specific tests here, because the last part of this
1005 +# test script is only executed when httpd is available and enabled.
1006
1007 test_done