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:
authorSami Hiltunen <shiltunen@gitlab.com>2023-12-01 17:19:10 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2023-12-05 14:25:53 +0300
commitafcd7c451df3ae406f920976b0c004ffd8ffdcf5 (patch)
treed3e4944e81331769701ef9af875e3b9c6e166f85 /internal/praefect
parentc7543d74d8d9d9fbe041bbf92161b2648998a0c4 (diff)
Identify pools by suffixes
Gitaly is using the repository's path to identify whether a repository is a pool. Rails' pool paths are checked exhaustively with a regex and Praefects paths are checked for a given prefix. These checks are not sufficient to identify pools with transactions as the pool path will be prefixed by the snapshot's root directory. Account for this by changing the checks to verify the suffix of the path matches the expected pool suffix. A test was removed that is asserting behavior related to invalid pool paths. Such state can't be created through the API anymore as we're verifying the pool path in a stricter manner. We've never created such paths as are being tested, so opted for removal rather than maintaining the test.
Diffstat (limited to 'internal/praefect')
-rw-r--r--internal/praefect/get_object_pool_test.go41
1 files changed, 0 insertions, 41 deletions
diff --git a/internal/praefect/get_object_pool_test.go b/internal/praefect/get_object_pool_test.go
index 83585d7ba..60143fc8f 100644
--- a/internal/praefect/get_object_pool_test.go
+++ b/internal/praefect/get_object_pool_test.go
@@ -273,47 +273,6 @@ func TestGetObjectPoolHandler(t *testing.T) {
}
},
},
- {
- desc: "object pool cluster path does not contain valid repository ID",
- setup: func(t *testing.T) setupData {
- client, repoStore := setupPraefect(t)
-
- // Create repositories that will be liked to object pools on each Gitaly node with
- // replica path and register them in Praefect.
- relativePath := gittest.NewRepositoryName(t)
- replicaPath := storage.DeriveReplicaPath(5)
- repo1, _ := gittest.CreateRepository(t, ctx, gitaly1Cfg, gittest.CreateRepositoryConfig{
- RelativePath: replicaPath,
- })
- repo2, _ := gittest.CreateRepository(t, ctx, gitaly2Cfg, gittest.CreateRepositoryConfig{
- RelativePath: replicaPath,
- })
- require.NoError(t, repoStore.CreateRepository(ctx, 5, virtualStorage, relativePath, replicaPath, gitaly1Storage, []string{gitaly2Storage}, nil, false, false))
-
- // Create object pool repositories that link to the previously created repositories
- // with the invalid cluster pool path and register them with Praefect. Praefect
- // relies on the cluster path to get the repository ID which is needed to fetch
- // repository metadata. If a valid repository ID cannot be parsed from the object
- // pool cluster path, an error is returned.
- poolRelativePath := gittest.NewObjectPoolName(t)
- poolReplicaPath := storage.DerivePoolPath(6) + "foobar"
- gittest.CreateObjectPool(t, ctx, gitaly1Cfg, repo1, gittest.CreateObjectPoolConfig{
- RelativePath: poolReplicaPath,
- LinkRepositoryToObjectPool: true,
- })
- gittest.CreateObjectPool(t, ctx, gitaly2Cfg, repo2, gittest.CreateObjectPoolConfig{
- RelativePath: poolReplicaPath,
- LinkRepositoryToObjectPool: true,
- })
- require.NoError(t, repoStore.CreateRepository(ctx, 6, virtualStorage, poolRelativePath, poolRelativePath, gitaly1Storage, []string{gitaly2Storage}, nil, false, false))
-
- return setupData{
- client: client,
- repository: &gitalypb.Repository{StorageName: virtualStorage, RelativePath: relativePath},
- expectedError: structerr.NewInternal("parsing repository ID: strconv.ParseInt: parsing \"6foobar\": invalid syntax"),
- }
- },
- },
} {
tc := tc
t.Run(tc.desc, func(t *testing.T) {