diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2023-10-09 21:24:51 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2023-10-11 09:27:32 +0300 |
commit | 74467c9debcef7c3632aa917729181f7ddf0c17d (patch) | |
tree | ba7147e7086a8a91ca2fe154042661ff2f85ec60 /internal/praefect | |
parent | b5a172e7e46d15e1f22019e328d9b90f17a347e6 (diff) |
Setup repository correctly in TestCoordinator_grpcErrorHandling
TestCoordinator_grpcErrorHandling is not creating the test repository
on the Gitaly storages configured as part of a virtual storage. This
causes the test to fail when WAL is enabled as the UserCreateBranch
errors with unexpected error due to the repository not existing. Setup
the repository in the storages to avoid this.
Diffstat (limited to 'internal/praefect')
-rw-r--r-- | internal/praefect/coordinator_test.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go index 07a658090..8f781ed01 100644 --- a/internal/praefect/coordinator_test.go +++ b/internal/praefect/coordinator_test.go @@ -2131,11 +2131,7 @@ func TestCoordinator_grpcErrorHandling(t *testing.T) { } ctx := testhelper.Context(t) - cfg := testcfg.Build(t) - - repoProto, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ - SkipCreationViaService: true, - }) + relativePath := gittest.NewRepositoryName(t) for _, tc := range []struct { desc string @@ -2176,6 +2172,11 @@ func TestCoordinator_grpcErrorHandling(t *testing.T) { cfg := testcfg.Build(t, testcfg.WithStorages(gitaly)) + _, _ = gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ + SkipCreationViaService: true, + RelativePath: relativePath, + }) + operationServer := &mockOperationServer{ t: t, wg: &wg, @@ -2226,7 +2227,7 @@ func TestCoordinator_grpcErrorHandling(t *testing.T) { // nodes will take part in transactions. WithRepoStore: datastore.MockRepositoryStore{ GetReplicaPathFunc: func(ctx context.Context, repositoryID int64) (string, error) { - return repoProto.GetRelativePath(), nil + return relativePath, nil }, GetConsistentStoragesFunc: func(ctx context.Context, virtualStorage, relativePath string) (string, *datastructure.Set[string], error) { return relativePath, datastructure.SetFromValues("primary", "secondary-1", "secondary-2"), nil @@ -2243,7 +2244,10 @@ func TestCoordinator_grpcErrorHandling(t *testing.T) { _, err := gitalypb.NewOperationServiceClient(praefectConn).UserCreateBranch(ctx, &gitalypb.UserCreateBranchRequest{ - Repository: repoProto, + Repository: &gitalypb.Repository{ + StorageName: testhelper.DefaultStorageName, + RelativePath: relativePath, + }, }) testhelper.RequireGrpcError(t, tc.expectedErr, err) |