forked from TrueCloudLab/frostfs-s3-gw
[#542] Handle unversioned mode
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
fdf0974679
commit
f1a0288e3a
2 changed files with 18 additions and 1 deletions
|
@ -44,6 +44,23 @@ func TestDeleteObjectVersioned(t *testing.T) {
|
|||
require.False(t, existInMockedNeoFS(tc, bktInfo, objInfo), "object exists but shouldn't")
|
||||
}
|
||||
|
||||
func TestDeleteObjectUnversioned(t *testing.T) {
|
||||
tc := prepareHandlerContext(t)
|
||||
|
||||
bktName, objName := "bucket-for-removal-unversioned", "object-to-delete-unversioned"
|
||||
bktInfo, objInfo := createBucketAndObject(t, tc, bktName, objName)
|
||||
|
||||
checkFound(t, tc, bktName, objName, emptyVersion)
|
||||
deleteObject(t, tc, bktName, objName, emptyVersion)
|
||||
checkNotFound(t, tc, bktName, objName, emptyVersion)
|
||||
|
||||
versions := listVersions(t, tc, bktName)
|
||||
require.Len(t, versions.DeleteMarker, 0, "delete markers must be empty")
|
||||
require.Len(t, versions.Version, 0, "versions must be empty")
|
||||
|
||||
require.False(t, existInMockedNeoFS(tc, bktInfo, objInfo), "object exists but shouldn't")
|
||||
}
|
||||
|
||||
func TestRemoveDeleteMarker(t *testing.T) {
|
||||
tc := prepareHandlerContext(t)
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ func getRandomOID() (oid.ID, error) {
|
|||
}
|
||||
|
||||
func (n *layer) deleteObject(ctx context.Context, bkt *data.BucketInfo, settings *data.BucketSettings, obj *VersionedObject) *VersionedObject {
|
||||
if len(obj.VersionID) != 0 {
|
||||
if len(obj.VersionID) != 0 || settings.IsNoneStatus {
|
||||
var nodeVersion *data.NodeVersion
|
||||
if nodeVersion, obj.Error = n.getNodeVersionToDelete(ctx, bkt, obj); obj.Error != nil {
|
||||
return obj
|
||||
|
|
Loading…
Reference in a new issue