[] node: Resolve never used errors

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-04-03 16:53:55 +03:00
parent e21c5bea21
commit bab11492ad
3 changed files with 9 additions and 2 deletions
pkg/local_object_storage

View file

@ -50,6 +50,11 @@ func TestDB_Delete(t *testing.T) {
err = metaInhume(db, object.AddressOf(child), object.AddressOf(ts)) err = metaInhume(db, object.AddressOf(child), object.AddressOf(ts))
require.NoError(t, err) require.NoError(t, err)
ts = testutil.GenerateObjectWithCID(cnr)
err = metaInhume(db, object.AddressOf(parent), object.AddressOf(ts))
require.NoError(t, err)
// delete object // delete object
err = metaDelete(db, object.AddressOf(child)) err = metaDelete(db, object.AddressOf(child))
require.NoError(t, err) require.NoError(t, err)
@ -62,11 +67,11 @@ func TestDB_Delete(t *testing.T) {
// check if they marked as already removed // check if they marked as already removed
ok, err := metaExists(db, object.AddressOf(child)) ok, err := metaExists(db, object.AddressOf(child))
require.Error(t, apistatus.ObjectAlreadyRemoved{}) require.ErrorAs(t, err, &apistatus.ObjectAlreadyRemoved{})
require.False(t, ok) require.False(t, ok)
ok, err = metaExists(db, object.AddressOf(parent)) ok, err = metaExists(db, object.AddressOf(parent))
require.Error(t, apistatus.ObjectAlreadyRemoved{}) require.ErrorAs(t, err, &apistatus.ObjectAlreadyRemoved{})
require.False(t, ok) require.False(t, ok)
} }

View file

@ -181,6 +181,7 @@ func TestDB_Exists(t *testing.T) {
require.ErrorIs(t, err, meta.ErrObjectIsExpired) require.ErrorIs(t, err, meta.ErrObjectIsExpired)
gotObj, err = metaExists(db, object.AddressOf(nonExp)) gotObj, err = metaExists(db, object.AddressOf(nonExp))
require.NoError(t, err)
require.True(t, gotObj) require.True(t, gotObj)
}) })
}) })

View file

@ -225,6 +225,7 @@ func testForestTreeDrop(t *testing.T, s Forest) {
} }
} }
list, err := s.TreeList(cid) list, err := s.TreeList(cid)
require.NoError(t, err)
require.NotEmpty(t, list) require.NotEmpty(t, list)
require.NoError(t, s.TreeDrop(cid, "")) require.NoError(t, s.TreeDrop(cid, ""))