forked from TrueCloudLab/frostfs-node
[#481] Update frostfs-sdk-go and error pointer receivers
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
de3d1eb99c
commit
5b7e4a51b7
77 changed files with 265 additions and 313 deletions
|
@ -65,16 +65,14 @@ func TestDeleteBigObject(t *testing.T) {
|
|||
}
|
||||
require.NoError(t, Put(context.Background(), e, link))
|
||||
|
||||
var splitErr *objectSDK.SplitInfoError
|
||||
|
||||
addrParent := object.AddressOf(parent)
|
||||
checkGetError(t, e, addrParent, &splitErr)
|
||||
checkGetError[*objectSDK.SplitInfoError](t, e, addrParent, true)
|
||||
|
||||
addrLink := object.AddressOf(link)
|
||||
checkGetError(t, e, addrLink, nil)
|
||||
checkGetError[error](t, e, addrLink, false)
|
||||
|
||||
for i := range children {
|
||||
checkGetError(t, e, object.AddressOf(children[i]), nil)
|
||||
checkGetError[error](t, e, object.AddressOf(children[i]), false)
|
||||
}
|
||||
|
||||
var deletePrm DeletePrm
|
||||
|
@ -84,20 +82,21 @@ func TestDeleteBigObject(t *testing.T) {
|
|||
_, err := e.Delete(context.Background(), deletePrm)
|
||||
require.NoError(t, err)
|
||||
|
||||
checkGetError(t, e, addrParent, &apistatus.ObjectNotFound{})
|
||||
checkGetError(t, e, addrLink, &apistatus.ObjectNotFound{})
|
||||
checkGetError[*apistatus.ObjectNotFound](t, e, addrParent, true)
|
||||
checkGetError[*apistatus.ObjectNotFound](t, e, addrLink, true)
|
||||
for i := range children {
|
||||
checkGetError(t, e, object.AddressOf(children[i]), &apistatus.ObjectNotFound{})
|
||||
checkGetError[*apistatus.ObjectNotFound](t, e, object.AddressOf(children[i]), true)
|
||||
}
|
||||
}
|
||||
|
||||
func checkGetError(t *testing.T, e *StorageEngine, addr oid.Address, expected any) {
|
||||
func checkGetError[E error](t *testing.T, e *StorageEngine, addr oid.Address, shouldFail bool) {
|
||||
var getPrm GetPrm
|
||||
getPrm.WithAddress(addr)
|
||||
|
||||
_, err := e.Get(context.Background(), getPrm)
|
||||
if expected != nil {
|
||||
require.ErrorAs(t, err, expected)
|
||||
if shouldFail {
|
||||
var target E
|
||||
require.ErrorAs(t, err, &target)
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue