diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-06-01 14:23:04 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-06-02 15:05:59 +0300 |
commit | bf56aa362f18e5255248f4c34d221175ea9de474 (patch) | |
tree | 6a7ce4b75d556973bec14b407780ae0db2cc9498 /internal/helper | |
parent | 83be32a7dc83976e7638d7bd6f25e0364847a13e (diff) |
helper: Move `RepoPathEqual()` into storage module
Move the `RepoPathEqual()` helper function into the storage module. This
is a more natural fit given that the functionality acts on the storage
repository interface and contains knowledge around storage paths.
Diffstat (limited to 'internal/helper')
-rw-r--r-- | internal/helper/repo.go | 9 | ||||
-rw-r--r-- | internal/helper/repo_test.go | 64 |
2 files changed, 0 insertions, 73 deletions
diff --git a/internal/helper/repo.go b/internal/helper/repo.go deleted file mode 100644 index 810cefffe..000000000 --- a/internal/helper/repo.go +++ /dev/null @@ -1,9 +0,0 @@ -package helper - -import "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" - -// RepoPathEqual compares if two repositories are in the same location -func RepoPathEqual(a, b storage.Repository) bool { - return a.GetStorageName() == b.GetStorageName() && - a.GetRelativePath() == b.GetRelativePath() -} diff --git a/internal/helper/repo_test.go b/internal/helper/repo_test.go deleted file mode 100644 index 1da084b50..000000000 --- a/internal/helper/repo_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package helper - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" - "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" -) - -func TestMain(m *testing.M) { - testhelper.Run(m) -} - -func TestRepoPathEqual(t *testing.T) { - testCases := []struct { - desc string - a, b *gitalypb.Repository - equal bool - }{ - { - desc: "equal", - a: &gitalypb.Repository{ - StorageName: "default", - RelativePath: "repo.git", - }, - b: &gitalypb.Repository{ - StorageName: "default", - RelativePath: "repo.git", - }, - equal: true, - }, - { - desc: "different storage", - a: &gitalypb.Repository{ - StorageName: "default", - RelativePath: "repo.git", - }, - b: &gitalypb.Repository{ - StorageName: "storage2", - RelativePath: "repo.git", - }, - equal: false, - }, - { - desc: "different path", - a: &gitalypb.Repository{ - StorageName: "default", - RelativePath: "repo.git", - }, - b: &gitalypb.Repository{ - StorageName: "default", - RelativePath: "repo2.git", - }, - equal: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - assert.Equal(t, tc.equal, RepoPathEqual(tc.a, tc.b)) - }) - } -} |