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:
authorMateusz Nowotyński <maxmati4@gmail.com>2020-05-14 21:11:07 +0300
committerMateusz Nowotyński <maxmati4@gmail.com>2020-06-30 22:26:58 +0300
commitf0a5bdd7f04fb2819b62ed7afd466daabf672d15 (patch)
tree54149fb8e50e07628d062072104df6c8e6806b25 /internal/helper/repo_test.go
parenta2b2d4d3109e05124d1e6ab73fa543a07457bbd9 (diff)
Port FetchSourceBranch to go
Part of #2741 Signed-off-by: Mateusz Nowotyński <maxmati4@gmail.com>
Diffstat (limited to 'internal/helper/repo_test.go')
-rw-r--r--internal/helper/repo_test.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/internal/helper/repo_test.go b/internal/helper/repo_test.go
index a4f7d00fa..ca748c15c 100644
--- a/internal/helper/repo_test.go
+++ b/internal/helper/repo_test.go
@@ -17,6 +17,57 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}
+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))
+ })
+ }
+}
+
func TestGetRepoPath(t *testing.T) {
defer func(oldStorages []config.Storage) {
config.Config.Storages = oldStorages