From 94a42fa27353924c56c63556ff624989fd4bd34c Mon Sep 17 00:00:00 2001 From: Artem Tataurov Date: Wed, 16 Aug 2023 17:08:12 +0300 Subject: [PATCH] [#51] Update frostfs-sdk-go Signed-off-by: Artem Tataurov --- api/auth/presign_test.go | 2 +- api/handler/delete.go | 3 +-- api/handler/delete_test.go | 4 ++-- api/handler/get_test.go | 4 ++-- api/handler/head_test.go | 4 ++-- api/layer/frostfs_mock.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- internal/frostfs/errors/errors.go | 2 -- 9 files changed, 12 insertions(+), 15 deletions(-) diff --git a/api/auth/presign_test.go b/api/auth/presign_test.go index 8c4aa218..fd5b953d 100644 --- a/api/auth/presign_test.go +++ b/api/auth/presign_test.go @@ -36,7 +36,7 @@ func (m credentialsMock) addBox(addr oid.Address, box *accessbox.Box) { func (m credentialsMock) GetBox(_ context.Context, addr oid.Address) (*accessbox.Box, error) { box, ok := m.boxes[addr.String()] if !ok { - return nil, apistatus.ObjectNotFound{} + return nil, &apistatus.ObjectNotFound{} } return box, nil diff --git a/api/handler/delete.go b/api/handler/delete.go index d50f4d09..40283a8f 100644 --- a/api/handler/delete.go +++ b/api/handler/delete.go @@ -150,8 +150,7 @@ func isErrObjectLocked(err error) bool { switch err.(type) { default: return strings.Contains(err.Error(), "object is locked") - case apistatus.ObjectLocked, - *apistatus.ObjectLocked: + case *apistatus.ObjectLocked: return true } } diff --git a/api/handler/delete_test.go b/api/handler/delete_test.go index 947ef3f6..f084e463 100644 --- a/api/handler/delete_test.go +++ b/api/handler/delete_test.go @@ -28,7 +28,7 @@ func TestDeleteBucketOnAlreadyRemovedError(t *testing.T) { putObject(t, hc, bktName, objName) addr := getAddressOfLastVersion(hc, bktInfo, objName) - hc.tp.SetObjectError(addr, apistatus.ObjectAlreadyRemoved{}) + hc.tp.SetObjectError(addr, &apistatus.ObjectAlreadyRemoved{}) deleteObjects(t, hc, bktName, [][2]string{{objName, emptyVersion}}) @@ -73,7 +73,7 @@ func TestDeleteBucketOnNotFoundError(t *testing.T) { var addr oid.Address addr.SetContainer(bktInfo.CID) addr.SetObject(nodeVersion.OID) - hc.tp.SetObjectError(addr, apistatus.ObjectNotFound{}) + hc.tp.SetObjectError(addr, &apistatus.ObjectNotFound{}) deleteObjects(t, hc, bktName, [][2]string{{objName, emptyVersion}}) diff --git a/api/handler/get_test.go b/api/handler/get_test.go index 9ee7df34..6a480efb 100644 --- a/api/handler/get_test.go +++ b/api/handler/get_test.go @@ -192,8 +192,8 @@ func TestGetObject(t *testing.T) { checkFound(hc.t, hc, bktName, objName, emptyVersion) addr := getAddressOfLastVersion(hc, bktInfo, objName) - hc.tp.SetObjectError(addr, apistatus.ObjectNotFound{}) - hc.tp.SetObjectError(objInfo.Address(), apistatus.ObjectNotFound{}) + hc.tp.SetObjectError(addr, &apistatus.ObjectNotFound{}) + hc.tp.SetObjectError(objInfo.Address(), &apistatus.ObjectNotFound{}) getObjectAssertS3Error(hc, bktName, objName, objInfo.VersionID(), s3errors.ErrNoSuchVersion) getObjectAssertS3Error(hc, bktName, objName, emptyVersion, s3errors.ErrNoSuchKey) diff --git a/api/handler/head_test.go b/api/handler/head_test.go index e3dde567..e2c943c3 100644 --- a/api/handler/head_test.go +++ b/api/handler/head_test.go @@ -120,8 +120,8 @@ func TestHeadObject(t *testing.T) { checkFound(hc.t, hc, bktName, objName, emptyVersion) addr := getAddressOfLastVersion(hc, bktInfo, objName) - hc.tp.SetObjectError(addr, apistatus.ObjectNotFound{}) - hc.tp.SetObjectError(objInfo.Address(), apistatus.ObjectNotFound{}) + hc.tp.SetObjectError(addr, &apistatus.ObjectNotFound{}) + hc.tp.SetObjectError(objInfo.Address(), &apistatus.ObjectNotFound{}) headObjectAssertS3Error(hc, bktName, objName, objInfo.VersionID(), s3errors.ErrNoSuchVersion) headObjectAssertS3Error(hc, bktName, objName, emptyVersion, s3errors.ErrNoSuchKey) diff --git a/api/layer/frostfs_mock.go b/api/layer/frostfs_mock.go index b8fa8cce..e550cd85 100644 --- a/api/layer/frostfs_mock.go +++ b/api/layer/frostfs_mock.go @@ -198,7 +198,7 @@ func (t *TestFrostFS) ReadObject(ctx context.Context, prm PrmObjectRead) (*Objec }, nil } - return nil, fmt.Errorf("%w: %s", apistatus.ObjectNotFound{}, addr) + return nil, fmt.Errorf("%w: %s", &apistatus.ObjectNotFound{}, addr) } func (t *TestFrostFS) CreateObject(_ context.Context, prm PrmObjectCreate) (oid.ID, error) { diff --git a/go.mod b/go.mod index 76b9f654..c0101bb3 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44 git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 - git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230802103237-363f153eafa6 + git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230816095347-6fdbe755179e github.com/aws/aws-sdk-go v1.44.6 github.com/bluele/gcache v0.0.2 github.com/go-chi/chi/v5 v5.0.8 diff --git a/go.sum b/go.sum index b86b5e73..7dd05179 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSV git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 h1:aGQ6QaAnTerQ5Dq5b2/f9DUQtSqPkZZ/bkMx/HKuLCo= git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6/go.mod h1:W8Nn08/l6aQ7UlIbpF7FsQou7TVpcRD1ZT1KG4TrFhE= -git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230802103237-363f153eafa6 h1:u6lzNotV6MEMNEG/XeS7g+FjPrrf+j4gnOHtvun2KJc= -git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230802103237-363f153eafa6/go.mod h1:LI2GOj0pEx0jYTjB3QHja2PNhQFYL2pCm71RAFwDv0M= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230816095347-6fdbe755179e h1:+78sZdTFeK2t+2qJ4Tmm5CItUjfcF4/nFMum3JnZ6PQ= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230816095347-6fdbe755179e/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw= git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc= git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA= diff --git a/internal/frostfs/errors/errors.go b/internal/frostfs/errors/errors.go index 04574ebe..80079ed9 100644 --- a/internal/frostfs/errors/errors.go +++ b/internal/frostfs/errors/errors.go @@ -25,8 +25,6 @@ func IsErrObjectAccessDenied(err error) (string, bool) { switch err := err.(type) { default: return "", false - case apistatus.ObjectAccessDenied: - return err.Reason(), true case *apistatus.ObjectAccessDenied: return err.Reason(), true }