Skip to content

Commit

Permalink
meta: fix Delete test
Browse files Browse the repository at this point in the history
Behavior has changed a few times since the original implementation. Also, the
test was broken a little in 8107c8d.
Parent/child relations were changed and now are treated differently at higher
levels, so this test is not so important (see new `TestDeleteAllChildren`
below, it plays a more important role in metabase testing), but keeping it in
working condition with correct statements is not a bad idea.

Signed-off-by: Pavel Karpy <[email protected]>
  • Loading branch information
carpawell committed Sep 24, 2024
1 parent a0447ce commit 7fecaea
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/local_object_storage/metabase/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestDB_Delete(t *testing.T) {
err = metaDelete(db, object.AddressOf(parent))
require.NoError(t, err)

// inhume parent and child so they will be on graveyard
// inhume child so it will be on graveyard
ts := generateObjectWithCID(t, cnr)

err = metaInhume(db, object.AddressOf(child), object.AddressOf(ts))
Expand All @@ -58,14 +58,16 @@ func TestDB_Delete(t *testing.T) {
require.NoError(t, err)
require.Len(t, l, 0)

// check if they marked as already removed
// check if the child is still inhumed (deletion should not affect
// TS status that should be kept for some epochs and be handled
// separately) and parent is not found

ok, err := metaExists(db, object.AddressOf(child))
require.Error(t, apistatus.ObjectAlreadyRemoved{})
require.ErrorAs(t, err, new(apistatus.ObjectAlreadyRemoved))
require.False(t, ok)

ok, err = metaExists(db, object.AddressOf(parent))
require.Error(t, apistatus.ObjectAlreadyRemoved{})
require.NoError(t, err)
require.False(t, ok)
}

Expand Down

0 comments on commit 7fecaea

Please sign in to comment.