Re: [PATCH v2 2/2] t: add tests for pull --verify-signatures
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 12, 2017, 19:03 UTC
- Message-ID
- <xmqqbmj33h0s.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20171210065358.8156-2-hji@dyntopia.com>
Hans Jerry Illikainen <hji@dyntopia.com> writes:
> +test_expect_success GPG 'pull unsigned commit with --verify-signatures' ' > + test_must_fail git pull --ff-only --verify-signatures unsigned 2>pullerror && > + test_i18ngrep "does not have a GPG signature" pullerror > +'
Note that this is without "when-finished"; if 'git pull' got broken and does not fail as expected, the next test will start from a state that it is not expecting. Same for the ones that run 'git pull' under test_must_fail.
Interestingly, the tests that do expect 'git pull' to succeed protect themselves with "when-finished" mechanism correctly [*1*], like so:
Show 6 quoted lines
> +test_expect_success GPG 'pull signed commit with --verify-signatures' ' > + test_when_finished "git checkout initial" && > + git pull --verify-signatures signed >pulloutput && > + test_i18ngrep "has a good GPG signature" pulloutput > +' > +
Other than that, looked nicely done. Thanks.
[Footnote]
*1* I am guessing that the branches that are being pulled in tests
are designed in such a way to never produce merge conflicts, and
failures are possible only due to signature verification. If
that were not the case, "when-finished" would want to do a hard
reset before checking out the initial to go back to a known
state.