git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/6] t1302: make tests more robust with new extensions

From
Taylor Blau <me@ttaylorr.com>
Date
Jan 9, 2024, 18:43 UTC
Message-ID
<ZZ2T3G+igA6zAIKO@nand.local>
In-Reply-To
<9af1e418d47730f503dabb271d30c848bf74fa0b.1704802213.git.ps@pks.im>
On Tue, Jan 09, 2024 at 01:17:12PM +0100, Patrick Steinhardt wrote:
Show 62 quoted lines
> In t1302 we exercise logic around "core.repositoryFormatVersion" and
> extensions. These tests are not particularly robust against extensions
> like the newly introduced "refStorage" extension.
>
> Refactor the tests to be more robust:
>
>   - Check the DEFAULT_REPO_FORMAT prereq to determine the expected
>     repository format version. This helps to ensure that we only need to
>     update the prereq in a central place when new extensions are added.
>
>   - Use a separate repository to rewrite ".git/config" to test
>     combinations of the repository format version and extensions. This
>     ensures that we don't break the main test repository.
>
>   - Do not rewrite ".git/config" when exercising the "preciousObjects"
>     extension.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  t/t1302-repo-version.sh | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh
> index 179474fa65..fb30c87e1b 100755
> --- a/t/t1302-repo-version.sh
> +++ b/t/t1302-repo-version.sh
> @@ -28,7 +28,12 @@ test_expect_success 'setup' '
>  '
>
>  test_expect_success 'gitdir selection on normal repos' '
> -	test_oid version >expect &&
> +	if test_have_prereq DEFAULT_REPO_FORMAT
> +	then
> +		echo 0
> +	else
> +		echo 1
> +	fi >expect &&
>  	git config core.repositoryformatversion >actual &&
>  	git -C test config core.repositoryformatversion >actual2 &&
>  	test_cmp expect actual &&
> @@ -79,8 +84,13 @@ mkconfig () {
>
>  while read outcome version extensions; do
>  	test_expect_success "$outcome version=$version $extensions" "
> -		mkconfig $version $extensions >.git/config &&
> -		check_${outcome}
> +		test_when_finished 'rm -rf extensions' &&
> +		git init extensions &&
> +		(
> +			cd extensions &&
> +			mkconfig $version $extensions >.git/config &&
> +			check_${outcome}
> +		)
>  	"
>  done <<\EOF
>  allow 0
> @@ -94,7 +104,8 @@ allow 1 noop-v1
>  EOF
>
>  test_expect_success 'precious-objects allowed' '
> -	mkconfig 1 preciousObjects >.git/config &&
> +	git config core.repositoryformatversion 1 &&

I'm nit-picking, but it looks like core.repositoryformatversion is all lower-case, whereas extensions.preciousObjects is camel-case. I don't think it's a big deal either way, but I couldn't *not* mention it while reading ;-)

Show 6 quoted lines
> +	git config extensions.preciousObjects 1 &&
>  	check_allow
>  '
>
> --
> 2.43.GIT

Thanks, Taylor

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 9 of 54 in “t: mark "files"-backend specific tests”
  1. 0/6 t: mark "files"-backend specific testsPatrick Steinhardt, Jan 9, 2024
  2. 1/6 t1300: mark tests to require default repo formatPatrick Steinhardt, Jan 9, 2024
  3. Taylor BlauJan 9, 2024
  4. Patrick SteinhardtJan 10, 2024
  5. Eric SunshineJan 9, 2024
  6. Patrick SteinhardtJan 10, 2024
  7. 2/6 t1301: mark test for `core.sharedRepository` as reffiles specificPatrick Steinhardt, Jan 9, 2024
  8. 3/6 t1302: make tests more robust with new extensionsPatrick Steinhardt, Jan 9, 2024
  9. Taylor BlauJan 9, 2024
  10. 4/6 t1419: mark test suite as files-backend specificPatrick Steinhardt, Jan 9, 2024
  11. Eric SunshineJan 9, 2024
  12. Patrick SteinhardtJan 10, 2024
  13. Junio C HamanoJan 10, 2024
  14. Patrick SteinhardtJan 11, 2024
  15. 5/6 t5526: break test submodule differentlyPatrick Steinhardt, Jan 9, 2024
  16. Eric SunshineJan 9, 2024
  17. Patrick SteinhardtJan 10, 2024
  18. 6/6 t: mark tests regarding git-pack-refs(1) to be backend specificPatrick Steinhardt, Jan 9, 2024
  19. 0/6 t: mark "files"-backend specific testsPatrick Steinhardt, Jan 10, 2024
  20. 1/6 t1300: make tests more robust with non-default ref backendsPatrick Steinhardt, Jan 10, 2024
  21. Toon ClaesJan 23, 2024
  22. Patrick SteinhardtJan 23, 2024
  23. Justin ToblerJan 23, 2024
  24. Christian CouderJan 23, 2024
  25. Patrick SteinhardtJan 24, 2024
  26. Christian CouderJan 29, 2024
  27. Patrick SteinhardtJan 29, 2024
  28. 2/6 t1301: mark test for `core.sharedRepository` as reffiles specificPatrick Steinhardt, Jan 10, 2024
  29. 3/6 t1302: make tests more robust with new extensionsPatrick Steinhardt, Jan 10, 2024
  30. Toon ClaesJan 23, 2024
  31. Patrick SteinhardtJan 23, 2024
  32. Christian CouderJan 23, 2024
  33. Patrick SteinhardtJan 24, 2024
  34. 4/6 t1419: mark test suite as files-backend specificPatrick Steinhardt, Jan 10, 2024
  35. 5/6 t5526: break test submodule differentlyPatrick Steinhardt, Jan 10, 2024
  36. 6/6 t: mark tests regarding git-pack-refs(1) to be backend specificPatrick Steinhardt, Jan 10, 2024
  37. Christian CouderJan 23, 2024
  38. 0/6 t: mark "files"-backend specific testsPatrick Steinhardt, Jan 24, 2024
  39. 1/6 t1300: make tests more robust with non-default ref backendsPatrick Steinhardt, Jan 24, 2024
  40. 2/6 t1301: mark test for `core.sharedRepository` as reffiles specificPatrick Steinhardt, Jan 24, 2024
  41. 3/6 t1302: make tests more robust with new extensionsPatrick Steinhardt, Jan 24, 2024
  42. 4/6 t1419: mark test suite as files-backend specificPatrick Steinhardt, Jan 24, 2024
  43. 5/6 t5526: break test submodule differentlyPatrick Steinhardt, Jan 24, 2024
  44. 6/6 t: mark tests regarding git-pack-refs(1) to be backend specificPatrick Steinhardt, Jan 24, 2024
  45. 0/6 t: mark "files"-backend specific testsPatrick Steinhardt, Jan 29, 2024
  46. 1/6 t1300: make tests more robust with non-default ref backendsPatrick Steinhardt, Jan 29, 2024
  47. Christian CouderJan 29, 2024
  48. 2/6 t1301: mark test for `core.sharedRepository` as reffiles specificPatrick Steinhardt, Jan 29, 2024
  49. 3/6 t1302: make tests more robust with new extensionsPatrick Steinhardt, Jan 29, 2024
  50. 4/6 t1419: mark test suite as files-backend specificPatrick Steinhardt, Jan 29, 2024
  51. 5/6 t5526: break test submodule differentlyPatrick Steinhardt, Jan 29, 2024
  52. 6/6 t: mark tests regarding git-pack-refs(1) to be backend specificPatrick Steinhardt, Jan 29, 2024
  53. Christian CouderJan 29, 2024
  54. Junio C HamanoJan 29, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.