2020-11-23 13:30:56 +00:00
|
|
|
package meta_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase/v2"
|
|
|
|
"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-11-27 09:03:35 +00:00
|
|
|
err := db.Put(raw.Object(), nil)
|
2020-11-23 13:30:56 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
2020-11-27 09:03:35 +00:00
|
|
|
err = db.Inhume(raw.Object().Address(), tombstoneID)
|
2020-11-23 13:30:56 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
2020-11-27 09:03:35 +00:00
|
|
|
_, err = db.Exists(raw.Object().Address())
|
2020-11-23 13:30:56 +00:00
|
|
|
require.EqualError(t, err, meta.ErrAlreadyRemoved.Error())
|
|
|
|
|
2020-11-27 09:03:35 +00:00
|
|
|
_, err = db.Get(raw.Object().Address())
|
2020-11-23 13:30:56 +00:00
|
|
|
require.EqualError(t, err, meta.ErrAlreadyRemoved.Error())
|
|
|
|
}
|