mbox series

[v3,0/6] t: mark "files"-backend specific tests

Message ID cover.1706085756.git.ps@pks.im (mailing list archive)
Headers show
Series t: mark "files"-backend specific tests | expand

Message

Patrick Steinhardt Jan. 24, 2024, 8:45 a.m. UTC
Hi,

this is the third version of my patch series that addresses tests whihc
are specific to the "files" backend. Changes compared to v2:

  - Reworded some commit messages to hopefully explain better what is
    going on.

  - Refactored a test "while at it" to not use double quotes for the
    test body.

  - Removed the now-unneeded OID cache for one of our tests.

Thanks all for your comments!

Patrick

Patrick Steinhardt (6):
  t1300: make tests more robust with non-default ref backends
  t1301: mark test for `core.sharedRepository` as reffiles specific
  t1302: make tests more robust with new extensions
  t1419: mark test suite as files-backend specific
  t5526: break test submodule differently
  t: mark tests regarding git-pack-refs(1) to be backend specific

 t/t1300-config.sh             | 78 ++++++++++++++++++++++-------------
 t/t1301-shared-repo.sh        |  2 +-
 t/t1302-repo-version.sh       | 23 +++++++----
 t/t1409-avoid-packing-refs.sh |  6 +++
 t/t1419-exclude-refs.sh       |  6 +++
 t/t3210-pack-refs.sh          |  6 +++
 t/t5526-fetch-submodules.sh   |  2 +-
 7 files changed, 85 insertions(+), 38 deletions(-)

Range-diff against v2:
1:  0552123fa3 ! 1:  a57e57a7c3 t1300: make tests more robust with non-default ref backends
    @@ Metadata
      ## Commit message ##
         t1300: make tests more robust with non-default ref backends
     
    -    The t1300 test suite exercises the git-config(1) tool. To do so we
    -    overwrite ".git/config" to contain custom contents. While this is easy
    -    enough to do, it may create problems when using a non-default repository
    -    format because we also overwrite the repository format version as well
    -    as any potential extensions. With the upcoming "reftable" ref backend
    -    the result is that we may try to access refs via the "files" backend
    -    even though the repository has been initialized with the "reftable"
    -    backend.
    +    The t1300 test suite exercises the git-config(1) tool. To do so, the
    +    test overwrites ".git/config" to contain custom contents. While this is
    +    easy enough to do, it may create problems when using a non-default
    +    repository format because this causes us to overwrite the repository
    +    format version as well as any potential extensions. With the upcoming
    +    "reftable" ref backend the result is that Git would try to access refs
    +    via the "files" backend even though the repository has been initialized
    +    with the "reftable" backend, which will cause failures when trying to
    +    access any refs.
     
         Refactor tests which access the refdb to be more robust by using their
         own separate repositories, which allows us to be more careful and not
         discard required extensions.
     
    +    Note that we also have to touch up how the CUSTOM_CONFIG_FILE gets
    +    accessed. This environment variable contains the relative path to a
    +    custom config file which we're setting up. But because we are now using
    +    subrepositories, this relative path will not be found anymore because
    +    our working directory changes. This issue is addressed by storing the
    +    absolute path to the file in CUSTOM_CONFIG_FILE instead.
    +
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
      ## t/t1300-config.sh ##
     @@ t/t1300-config.sh: test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
    + 	test_must_fail git config --file=linktolinktonada --list
      '
      
    - test_expect_success 'check split_cmdline return' "
    +-test_expect_success 'check split_cmdline return' "
     -	git config alias.split-cmdline-fix 'echo \"' &&
     -	test_must_fail git split-cmdline-fix &&
     -	echo foo > foo &&
    @@ t/t1300-config.sh: test_expect_success SYMLINKS 'symlink to nonexistent configur
     -	git commit -m 'initial commit' &&
     -	git config branch.main.mergeoptions 'echo \"' &&
     -	test_must_fail git merge main
    -+	test_when_finished 'rm -rf repo' &&
    +-"
    ++test_expect_success 'check split_cmdline return' '
    ++	test_when_finished "rm -rf repo" &&
     +	git init repo &&
     +	(
     +		cd repo &&
    -+		git config alias.split-cmdline-fix 'echo \"' &&
    ++		git config alias.split-cmdline-fix "echo \"" &&
     +		test_must_fail git split-cmdline-fix &&
     +		echo foo >foo &&
     +		git add foo &&
    -+		git commit -m 'initial commit' &&
    -+		git config branch.main.mergeoptions 'echo \"' &&
    ++		git commit -m "initial commit" &&
    ++		git config branch.main.mergeoptions "echo \"" &&
     +		test_must_fail git merge main
     +	)
    - "
    ++'
      
      test_expect_success 'git -c "key=value" support' '
    + 	cat >expect <<-\EOF &&
     @@ t/t1300-config.sh: test_expect_success 'git -c works with aliases of builtins' '
      '
      
2:  384250fec2 = 2:  fd6dd92c23 t1301: mark test for `core.sharedRepository` as reffiles specific
3:  1284b70fab ! 3:  ec90320ff1 t1302: make tests more robust with new extensions
    @@ Commit message
     
         In t1302 we exercise logic around "core.repositoryFormatVersion" and
         extensions. These tests are not particularly robust against extensions
    -    like the newly introduced "refStorage" extension.
    +    like the newly introduced "refStorage" extension as we tend to clobber
    +    the repository's config file. We thus overwrite any extensions that were
    +    set, which may render the repository inaccessible in case it has to be
    +    accessed with a non-default ref storage.
     
         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.
    +        Furthermore, this allows us to stop seeding the now-unneeded object
    +        ID cache that was only used to figure out the repository version.
     
           - 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.
    +        ensures that we don't break the main test repository. While we could
    +        rewrite these tests to not overwrite preexisting extensions, it
    +        feels cleaner like this so that we can test extensions standalone
    +        without interference from the environment.
     
           - Do not rewrite ".git/config" when exercising the "preciousObjects"
             extension.
    @@ Commit message
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
      ## t/t1302-repo-version.sh ##
    +@@ t/t1302-repo-version.sh: TEST_PASSES_SANITIZE_LEAK=true
    + . ./test-lib.sh
    + 
    + test_expect_success 'setup' '
    +-	test_oid_cache <<-\EOF &&
    +-	version sha1:0
    +-	version sha256:1
    +-	EOF
    + 	cat >test.patch <<-\EOF &&
    + 	diff --git a/test.txt b/test.txt
    + 	new file mode 100644
     @@ t/t1302-repo-version.sh: test_expect_success 'setup' '
      '
      
4:  c6062b612c = 4:  d0d70c3f18 t1419: mark test suite as files-backend specific
5:  ae08afc459 = 5:  066c297189 t5526: break test submodule differently
6:  df648be535 = 6:  7b8921817b t: mark tests regarding git-pack-refs(1) to be backend specific