Message ID | 68c911e29b509d75e390aba573921d6ac385fcaf.1585115341.git.liu.denton@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | t: replace incorrect test_must_fail usage (part 3) | expand |
Denton Liu <liu.denton@gmail.com> writes: > The test_must_fail() family of functions (including test_might_fail()) > should only be used on git commands. Rewrite the use of > test_might_fail() with grep to remove this improper usage. > > Signed-off-by: Denton Liu <liu.denton@gmail.com> > --- > t/t5550-http-fetch-dumb.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh > index b811d89cfd..a06294ad8f 100755 > --- a/t/t5550-http-fetch-dumb.sh > +++ b/t/t5550-http-fetch-dumb.sh > @@ -248,7 +248,7 @@ test_expect_success 'fetch can handle previously-fetched .idx files' ' > ' > > test_expect_success 'did not use upload-pack service' ' > - test_might_fail grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act && > + { grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act || :; } && We can use sed -n -e "/\/git-upload-pack/p" "$HTTPD_ROOT_PATH/access.log" >actual instead, but "grep for the pattern but don't worry if we found no match" is also OK. > : >exp && > test_cmp exp act Having said that, if the expectation is not to find any match, shouldn't the whole test be just ! grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log" a single liner? In any case, the use of sq in the original is broken. > '
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh index b811d89cfd..a06294ad8f 100755 --- a/t/t5550-http-fetch-dumb.sh +++ b/t/t5550-http-fetch-dumb.sh @@ -248,7 +248,7 @@ test_expect_success 'fetch can handle previously-fetched .idx files' ' ' test_expect_success 'did not use upload-pack service' ' - test_might_fail grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act && + { grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act || :; } && : >exp && test_cmp exp act '
The test_must_fail() family of functions (including test_might_fail()) should only be used on git commands. Rewrite the use of test_might_fail() with grep to remove this improper usage. Signed-off-by: Denton Liu <liu.denton@gmail.com> --- t/t5550-http-fetch-dumb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)