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-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-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-12-01 10:48:28 +00:00
|
|
|
require.EqualError(t, err, object.ErrAlreadyRemoved.Error())
|
2020-11-23 13:30:56 +00:00
|
|
|
|
2020-11-27 09:03:35 +00:00
|
|
|
_, err = db.Get(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
|
|
|
}
|