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

object_pool_test.go « housekeeping « git « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1501744c9cfbdfb647a89772c639205623f63c77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package housekeeping

import (
	"testing"

	"github.com/stretchr/testify/require"
	"gitlab.com/gitlab-org/gitaly/internal/git/gittest"
)

func TestIsPoolPath(t *testing.T) {
	for _, tc := range []struct {
		desc         string
		relativePath string
		isPoolPath   bool
	}{
		{
			desc:         "rails pool directory",
			relativePath: gittest.NewObjectPoolName(t),
			isPoolPath:   true,
		},
		{
			desc: "empty string",
		},
		{
			desc:         "rails path first to subdirs dont match full hash",
			relativePath: "@pools/aa/bb/ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff.git",
		},
		{
			desc:         "normal repos dont match",
			relativePath: "@hashed/" + gittest.NewRepositoryName(t, true),
		},
	} {
		t.Run(tc.desc, func(t *testing.T) {
			require.Equal(t, tc.isPoolPath, IsPoolPath(tc.relativePath))
		})
	}
}