2020-11-23 13:30:56 +00:00
|
|
|
package meta_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-12-01 10:48:28 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
2020-12-08 09:56:14 +00:00
|
|
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
2020-11-23 13:30:56 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestDB_Inhume(t *testing.T) {
|
|
|
|
db := newDB(t)
|
|
|
|
defer releaseDB(db)
|
|
|
|
|
|
|
|
raw := generateRawObject(t)
|
|
|
|
addAttribute(raw, "foo", "bar")
|
|
|
|
|
|
|
|
tombstoneID := generateAddress()
|
|
|
|
|
2020-12-08 09:56:14 +00:00
|
|
|
err := putBig(db, raw.Object())
|
2020-11-23 13:30:56 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
2020-12-08 09:56:14 +00:00
|
|
|
err = meta.Inhume(db, raw.Object().Address(), tombstoneID)
|
2020-11-23 13:30:56 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
2020-12-08 09:56:14 +00:00
|
|
|
_, err = meta.Exists(db, raw.Object().Address())
|
2020-12-01 10:48:28 +00:00
|
|
|
require.EqualError(t, err, object.ErrAlreadyRemoved.Error())
|
2020-11-23 13:30:56 +00:00
|
|
|
|
2020-12-08 09:56:14 +00:00
|
|
|
_, err = meta.Get(db, raw.Object().Address())
|
2020-12-01 10:48:28 +00:00
|
|
|
require.EqualError(t, err, object.ErrAlreadyRemoved.Error())
|
2020-11-23 13:30:56 +00:00
|
|
|
}
|