Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-21 09:39:39 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-21 10:06:12 +0300
commitdcf424ce7954ff7917fa86d39ac0ee3523cb4dce (patch)
treebdecda24a24b9a2dd266799cd80893f5cee780bf
parent5e4dc14ef894554310a196692aa8f1fd8e2f7e23 (diff)
gittest: Stop using the seed repository for tests
We're currently using one of our seed repositories as default repo in our gittest tests. Because this seed repository is using SHA1 as the object hash this renders us unable to actually test against both SHA1 and SHA256. Convert the setup to instead use an empty repository. Tests should just create their required data at runtime.
-rw-r--r--internal/git/gittest/ref_test.go7
-rw-r--r--internal/git/gittest/testhelper_test.go2
2 files changed, 4 insertions, 5 deletions
diff --git a/internal/git/gittest/ref_test.go b/internal/git/gittest/ref_test.go
index 0753ef00f..70855f57e 100644
--- a/internal/git/gittest/ref_test.go
+++ b/internal/git/gittest/ref_test.go
@@ -12,8 +12,7 @@ import (
func TestResolveRevision(t *testing.T) {
cfg, _, repoPath := setup(t)
- require.Equal(t,
- git.ObjectID("1e292f8fedd741b75372e19097c76d327140c312"),
- ResolveRevision(t, cfg, repoPath, "refs/heads/master"),
- )
+ commitID := WriteCommit(t, cfg, repoPath, WithBranch(git.DefaultBranch))
+
+ require.Equal(t, commitID, ResolveRevision(t, cfg, repoPath, git.DefaultBranch))
}
diff --git a/internal/git/gittest/testhelper_test.go b/internal/git/gittest/testhelper_test.go
index 42e7bf48c..bcce5d9a1 100644
--- a/internal/git/gittest/testhelper_test.go
+++ b/internal/git/gittest/testhelper_test.go
@@ -54,7 +54,7 @@ func setup(t testing.TB) (config.Cfg, *gitalypb.Repository, string) {
require.NoError(t, cfg.Validate())
- repo, repoPath := CloneRepo(t, cfg, cfg.Storages[0])
+ repo, repoPath := InitRepo(t, cfg, cfg.Storages[0])
return cfg, repo, repoPath
}