From: Derrick Stolee <derrickstolee@github.com>
To: Junio C Hamano <gitster@pobox.com>, Taylor Blau <me@ttaylorr.com>
Cc: Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, chakrabortyabhradeep79@gmail.com
Subject: Re: [PATCH] test-lib-functions: fix test_subcommand_inexact
Date: Thu, 24 Mar 2022 11:42:44 -0400 [thread overview]
Message-ID: <72c54461-8af7-29fc-04da-f435adee9bbe@github.com> (raw)
In-Reply-To: <xmqqfsn8p8nr.fsf@gitster.g>
On 3/23/2022 7:10 PM, Junio C Hamano wrote:
> Taylor Blau <me@ttaylorr.com> writes:
>
>> On Wed, Mar 23, 2022 at 10:55:37AM -0400, Derrick Stolee wrote:
>>>> So, perhaps #3 ;-)?
>>>
>>> I'll default to #3 (do nothing), but if this shows up again
>>> I'll plan on adding a comment to the helper to be clear on
>>> how "inexact" the helper really is.
>>
>> I wonder if we could sidestep the whole issue with
>> test_subcommand_inexact by testing this behavior by looking at the
>> contents of the packs themselves.
>>
>> If we have a kept pack, and then add some new objects, and run "git
>> repack --write-midx -adb", the new pack should not contain any of the
>> objects found in the old (kept) pack. And that's the case after this
>> patch, but was broken before it.
>
> Sounds quite sensible.
>
> Instead of saying "we are happy as long as we internally run this
> command, as that _should_ give us the desired outcome", we check the
> resulting packs ourselves, and we do not really care how the
> "repack" command gave us that desired outcome.
Sounds good. It's all about a balance: using test_subcommand[_inexact]
gives us a way to check "Did we trigger this other command that we
trust works correctly from other tests?" without the more complicated
work of doing a full post-condition check. It's a bit more of a unit-
level check than most Git tests.
The full post-condition check requires more test code, but that's not
really a problem. The problem comes in if that test is now too rigid
to future changes in that subcommand. What if the post-conditions
change in a subtle way because of the subcommand does something
differently, but in a way that is not of importance to the top
command?
In this specific case, the test name says that it "packs non-kept
objects", so we can do more here to validate that post-condition
that we care about.
As I'm looking at Taylor's test case example, the one thing I notice
is that there is only one pack-file before the repack. It would be
good to have a non-kept packfile get repacked in the process, not
just the loose objects added by the test_commit. I'll take a look at
what can be done here.
Thanks,
-Stolee
next prev parent reply other threads:[~2022-03-24 15:42 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 20:34 [PATCH] test-lib-functions: fix test_subcommand_inexact Derrick Stolee via GitGitGadget
2022-03-22 15:17 ` Derrick Stolee
2022-03-23 14:53 ` Junio C Hamano
2022-03-23 14:55 ` Derrick Stolee
2022-03-23 21:45 ` Taylor Blau
2022-03-23 23:10 ` Junio C Hamano
2022-03-24 15:42 ` Derrick Stolee [this message]
2022-03-24 16:02 ` Taylor Blau
2022-03-24 16:39 ` Derrick Stolee
2022-03-24 16:38 ` Junio C Hamano
2022-03-24 18:10 ` Abhradeep Chakraborty
2022-03-25 0:33 ` Junio C Hamano
2022-03-25 8:13 ` Abhradeep Chakraborty
2022-03-24 18:34 ` [PATCH v2 0/2] " Derrick Stolee via GitGitGadget
2022-03-24 18:34 ` [PATCH v2 1/2] t7700: check post-condition in kept-pack test Derrick Stolee via GitGitGadget
2022-03-24 18:58 ` Taylor Blau
2022-03-25 13:55 ` Derrick Stolee
2022-03-25 17:07 ` Junio C Hamano
2022-03-25 17:23 ` Derrick Stolee
2022-03-25 17:36 ` Taylor Blau
2022-03-25 18:22 ` Junio C Hamano
2022-03-24 18:34 ` [PATCH v2 2/2] test-lib-functions: fix test_subcommand_inexact Derrick Stolee via GitGitGadget
2022-03-24 18:49 ` Taylor Blau
2022-03-24 20:48 ` Junio C Hamano
2022-03-25 14:03 ` Derrick Stolee
2022-03-25 17:25 ` Junio C Hamano
2022-03-25 19:02 ` [PATCH v3 0/2] " Derrick Stolee via GitGitGadget
2022-03-25 19:02 ` [PATCH v3 1/2] t7700: check post-condition in kept-pack test Derrick Stolee via GitGitGadget
2022-03-25 19:02 ` [PATCH v3 2/2] test-lib-functions: remove test_subcommand_inexact Derrick Stolee via GitGitGadget
2022-03-30 2:44 ` [PATCH v3 0/2] test-lib-functions: fix test_subcommand_inexact Taylor Blau
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=72c54461-8af7-29fc-04da-f435adee9bbe@github.com \
--to=derrickstolee@github.com \
--cc=chakrabortyabhradeep79@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.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).