diff --git a/pkg/local_object_storage/metabase/version_test.go b/pkg/local_object_storage/metabase/version_test.go index c21911a3dc..568017d931 100644 --- a/pkg/local_object_storage/metabase/version_test.go +++ b/pkg/local_object_storage/metabase/version_test.go @@ -11,6 +11,7 @@ import ( "testing" objectconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/object" + "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard/mode" apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status" "github.com/nspcc-dev/neofs-sdk-go/object" oid "github.com/nspcc-dev/neofs-sdk-go/object/id" @@ -307,16 +308,20 @@ func TestMigrate2to3(t *testing.T) { }) require.NoError(t, err) + // inhumeV2 stores data in the old format, but new DB has current version by default, force old version. err = db.boltDB.Update(func(tx *bbolt.Tx) error { - err = updateVersion(tx, 2) - if err != nil { - return err - } - - return migrateFrom2Version(db, tx) + return updateVersion(tx, 2) }) require.NoError(t, err) + db.mode = mode.DegradedReadOnly // Force reload. + ok, err := db.Reload(WithPath(db.info.Path), WithEpochState(epochState{})) + require.True(t, ok) + require.NoError(t, err) + + err = db.Init() // Migration happens here. + require.NoError(t, err) + err = db.boltDB.View(func(tx *bbolt.Tx) error { return tx.Bucket(graveyardBucketName).ForEach(func(k, v []byte) error { require.Len(t, v, addressKeySize+8)