diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-18 10:02:32 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-20 07:54:13 +0300 |
commit | 69743f934c1e5462b5dce44eae7b8ef3422799d2 (patch) | |
tree | 97103eca2b58e1cdcbda36aeec670357f1612dc2 | |
parent | 2ba30c8b1b5a428a645faf72881771af9a505ab2 (diff) |
repository: Fix test writing into Gitaly's repository
One of our tests for `clnoeFromURLCommand()` tries to clone into a
subdirectory of the Gitaly repository itself. This is wrong: all test
data should always end up in a temporary directory.
Fix this by properly cloning into a temporary directory. While at it,
add a call to `cmd.Wait()` to not leak the process.
-rw-r--r-- | internal/gitaly/service/repository/create_repository_from_url_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/gitaly/service/repository/create_repository_from_url_test.go b/internal/gitaly/service/repository/create_repository_from_url_test.go index 5fdd93ccb..b9c971934 100644 --- a/internal/gitaly/service/repository/create_repository_from_url_test.go +++ b/internal/gitaly/service/repository/create_repository_from_url_test.go @@ -260,7 +260,7 @@ func TestServer_CloneFromURLCommand_withMirror(t *testing.T) { t.Parallel() ctx := testhelper.Context(t) - repositoryFullPath := "full/path/to/repository" + repositoryFullPath := filepath.Join(testhelper.TempDir(t), "full/path/to/repository") url := "https://www.example.com/secretrepo.git" cfg := testcfg.Build(t) @@ -271,6 +271,7 @@ func TestServer_CloneFromURLCommand_withMirror(t *testing.T) { args := cmd.Args() require.Contains(t, args, "--mirror") require.NotContains(t, args, "--bare") + require.Error(t, cmd.Wait()) } func gitServerWithBasicAuth(ctx context.Context, t testing.TB, gitCmdFactory git.CommandFactory, user, pass, repoPath string) (int, func() error) { |