From: Masaya Suzuki <masayasuzuki@google.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>, Jeff King <peff@peff.net>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH 2/2] Unset CURLOPT_FAILONERROR
Date: Fri, 28 Dec 2018 12:00:20 -0800 [thread overview]
Message-ID: <CAJB1erUMPKUKz-x9+xdyUayO9FUmZVQ1MbewtrQQJxgsLZyqbA@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cTOK9XkGiPcHdVrWbV-L0a+Av0Kv=NcRVYsUHnb0j5-Zw@mail.gmail.com>
On Fri, Dec 28, 2018 at 11:58 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
>
> On Fri, Dec 28, 2018 at 2:51 PM Masaya Suzuki <masayasuzuki@google.com> wrote:
> > On Fri, Dec 28, 2018 at 11:37 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
> > > On Thu, Dec 27, 2018 at 8:47 PM Masaya Suzuki <masayasuzuki@google.com> wrote:
> > > > +test_expect_success 'failure in git-upload-pack is shown' '
> > > > + (GIT_CURL_VERBOSE=1 git clone --bare "$HTTPD_URL/error_git_upload_pack/smart/repo.git" 2>curl_log ||
> > > > + true) &&
> > >
> > > Using test_might_fail() would allow you to drop the subshell and the "|| true":
> > >
> > > test_might_fail env GIT_CURL_VERBOSE=1 git clone ... &&
> > >
> > > > + cat curl_log | grep "< HTTP/1.1 500 Intentional Breakage"
> > > > +'
> >
> > The test should success. This is a test that a log is produced after a
> > git command fails. The point of this test is "cat curl_log | grep ..."
> > part that asserts the log.
>
> Unfortunately, the name "test_might_fail" is confusing. It is not
> saying that the entire test might or might not fail. Rather, it is
> saying that the one command might or might not fail (and that you
> don't care if it does fail). The idiom:
>
> (some-git-command || true) &&
>
> can be replaced with:
>
> test_might_fail some-git-command &&
>
> without changing its meaning, and without affecting the
> success/failure status of the test overall.
>
> So, this new test could be written like this:
>
> --- 8< ---
> test_expect_success 'failure in git-upload-pack is shown' '
> test_might_fail env GIT_CURL_VERBOSE=1 git clone --bare
> "$HTTPD_URL/error_git_upload_pack/smart/repo.git" 2>curl_log &&
> cat curl_log | grep "< HTTP/1.1 500 Intentional Breakage"
> '
> --- 8< ---
>
> and have the same meaning.
Ah. I see. It's used inside the test. Thanks.
next prev parent reply other threads:[~2018-12-28 20:00 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-28 1:47 [PATCH 1/2] Change how HTTP response body is returned Masaya Suzuki
2018-12-28 1:47 ` [PATCH 2/2] Unset CURLOPT_FAILONERROR Masaya Suzuki
2018-12-28 19:36 ` Eric Sunshine
2018-12-28 19:51 ` Masaya Suzuki
2018-12-28 19:58 ` Eric Sunshine
2018-12-28 20:00 ` Masaya Suzuki [this message]
2018-12-29 19:44 ` [PATCH v2 0/2] Show HTTP headers of failed requests with GIT_CURL_VERBOSE Masaya Suzuki
2018-12-29 19:44 ` [PATCH v2 1/2] Change how HTTP response body is returned Masaya Suzuki
2019-01-03 19:09 ` Junio C Hamano
2019-01-04 10:11 ` Jeff King
2019-01-04 20:13 ` Junio C Hamano
2019-01-04 10:30 ` Jeff King
2018-12-29 19:44 ` [PATCH v2 2/2] Unset CURLOPT_FAILONERROR Masaya Suzuki
2019-01-04 10:49 ` Jeff King
2019-01-07 23:24 ` Masaya Suzuki
2019-01-08 2:47 ` [PATCH v3 0/5] Show HTTP headers of failed requests with GIT_CURL_VERBOSE Masaya Suzuki
2019-01-08 2:47 ` [PATCH v3 1/5] http: support file handles for HTTP_KEEP_ERROR Masaya Suzuki
2019-01-09 12:15 ` SZEDER Gábor
2019-01-08 2:47 ` [PATCH v3 2/5] http: enable keep_error for HTTP requests Masaya Suzuki
2019-01-08 2:47 ` [PATCH v3 3/5] remote-curl: define struct for CURLOPT_WRITEFUNCTION Masaya Suzuki
2019-01-08 2:47 ` [PATCH v3 4/5] remote-curl: unset CURLOPT_FAILONERROR Masaya Suzuki
2019-01-08 2:47 ` [PATCH v3 5/5] test: test GIT_CURL_VERBOSE=1 shows an error Masaya Suzuki
2019-01-10 19:33 ` [PATCH v4 0/5] Show HTTP headers of failed requests with GIT_CURL_VERBOSE Masaya Suzuki
2019-01-10 19:33 ` [PATCH v4 1/5] http: support file handles for HTTP_KEEP_ERROR Masaya Suzuki
2019-01-10 19:33 ` [PATCH v4 2/5] http: enable keep_error for HTTP requests Masaya Suzuki
2019-01-10 19:33 ` [PATCH v4 3/5] remote-curl: define struct for CURLOPT_WRITEFUNCTION Masaya Suzuki
2019-01-10 19:33 ` [PATCH v4 4/5] remote-curl: unset CURLOPT_FAILONERROR Masaya Suzuki
2019-01-10 19:33 ` [PATCH v4 5/5] test: test GIT_CURL_VERBOSE=1 shows an error Masaya Suzuki
2019-01-10 23:06 ` [PATCH v4 0/5] Show HTTP headers of failed requests with GIT_CURL_VERBOSE Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJB1erUMPKUKz-x9+xdyUayO9FUmZVQ1MbewtrQQJxgsLZyqbA@mail.gmail.com \
--to=masayasuzuki@google.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).