diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2022-10-06 09:22:13 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2022-10-07 08:47:13 +0300 |
commit | ce2451fa0fc17966739a3faa5e633ca9a946843c (patch) | |
tree | c0a5101dc3bfe38e2f160f3afb966256a9622e55 | |
parent | a5ecd581fc8c124332e5823a132bb2a039ebdc72 (diff) |
config: Simplify error messageps-locator
If relative path is not provided the error message used to include
the full Repository entity. It has no much of usage as we don't
rely on this data. With it the error message was hard to read and
to create an expected results in the tests. It is simplified to
have only an error message without the full Repository entity.
-rw-r--r-- | internal/gitaly/config/locator.go | 2 | ||||
-rw-r--r-- | internal/gitaly/config/locator_test.go | 4 | ||||
-rw-r--r-- | internal/gitaly/service/ssh/receive_pack_test.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/ssh/upload_pack_test.go | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/internal/gitaly/config/locator.go b/internal/gitaly/config/locator.go index 3812c6190..786eb2d45 100644 --- a/internal/gitaly/config/locator.go +++ b/internal/gitaly/config/locator.go @@ -69,7 +69,7 @@ func (l *configLocator) GetPath(repo repository.GitRepo) (string, error) { relativePath := repo.GetRelativePath() if len(relativePath) == 0 { - err := helper.ErrInvalidArgumentf("GetPath: relative path missing from %+v", repo) + err := helper.ErrInvalidArgumentf("GetPath: relative path missing") return "", err } diff --git a/internal/gitaly/config/locator_test.go b/internal/gitaly/config/locator_test.go index 9f34e463d..4b77a5c0f 100644 --- a/internal/gitaly/config/locator_test.go +++ b/internal/gitaly/config/locator_test.go @@ -63,7 +63,7 @@ func TestConfigLocator_GetRepoPath(t *testing.T) { { desc: "relative path is empty", repo: &gitalypb.Repository{StorageName: storageName, RelativePath: ""}, - expErr: helper.ErrInvalidArgumentf(`GetPath: relative path missing from storage_name:"exists"`), + expErr: helper.ErrInvalidArgumentf("GetPath: relative path missing"), }, { desc: "unknown relative path", @@ -161,7 +161,7 @@ func TestConfigLocator_GetPath(t *testing.T) { { desc: "relative path is empty", repo: &gitalypb.Repository{StorageName: storageName, RelativePath: ""}, - expErr: helper.ErrInvalidArgumentf(`GetPath: relative path missing from storage_name:"exists"`), + expErr: helper.ErrInvalidArgumentf("GetPath: relative path missing"), }, { desc: "relative path escapes parent folder", diff --git a/internal/gitaly/service/ssh/receive_pack_test.go b/internal/gitaly/service/ssh/receive_pack_test.go index 0f9317696..7267022b6 100644 --- a/internal/gitaly/service/ssh/receive_pack_test.go +++ b/internal/gitaly/service/ssh/receive_pack_test.go @@ -67,7 +67,7 @@ func TestReceivePack_validation(t *testing.T) { return helper.ErrInvalidArgumentf("repo scoped: invalid Repository") } - return helper.ErrInvalidArgumentf("GetPath: relative path missing from storage_name:\"default\"") + return helper.ErrInvalidArgumentf("GetPath: relative path missing") }(), }, { diff --git a/internal/gitaly/service/ssh/upload_pack_test.go b/internal/gitaly/service/ssh/upload_pack_test.go index 4d6e9e46b..491783e97 100644 --- a/internal/gitaly/service/ssh/upload_pack_test.go +++ b/internal/gitaly/service/ssh/upload_pack_test.go @@ -445,7 +445,7 @@ func TestUploadPack_validation(t *testing.T) { if testhelper.IsPraefectEnabled() { return helper.ErrInvalidArgumentf("repo scoped: invalid Repository") } - return helper.ErrInvalidArgumentf("GetPath: relative path missing from storage_name:%q", "default") + return helper.ErrInvalidArgumentf("GetPath: relative path missing") }(), }, { |