forked from TrueCloudLab/frostfs-s3-gw
Fixed deletes for failed tests
test_multi_object_delete test_multi_objectv2_delete Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
e319f2422e
commit
ed47bc1596
2 changed files with 16 additions and 18 deletions
|
@ -213,19 +213,7 @@ func (h *handler) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *http.Re
|
||||||
|
|
||||||
var errs []error
|
var errs []error
|
||||||
for _, obj := range deletedObjects {
|
for _, obj := range deletedObjects {
|
||||||
if obj.Error == nil {
|
if obj.Error != nil {
|
||||||
deletedObj := DeletedObject{
|
|
||||||
ObjectIdentifier: ObjectIdentifier{
|
|
||||||
ObjectName: obj.Name,
|
|
||||||
VersionID: obj.VersionID,
|
|
||||||
},
|
|
||||||
DeleteMarkerVersionID: obj.DeleteMarkVersion,
|
|
||||||
}
|
|
||||||
if deletedObj.DeleteMarkerVersionID != "" {
|
|
||||||
deletedObj.DeleteMarker = true
|
|
||||||
}
|
|
||||||
response.DeletedObjects = append(response.DeletedObjects, deletedObj)
|
|
||||||
} else if !requested.Quiet {
|
|
||||||
code := "BadRequest"
|
code := "BadRequest"
|
||||||
if s3err, ok := obj.Error.(errors.Error); ok {
|
if s3err, ok := obj.Error.(errors.Error); ok {
|
||||||
code = s3err.Code
|
code = s3err.Code
|
||||||
|
@ -237,15 +225,26 @@ func (h *handler) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *http.Re
|
||||||
VersionID: obj.VersionID,
|
VersionID: obj.VersionID,
|
||||||
})
|
})
|
||||||
errs = append(errs, obj.Error)
|
errs = append(errs, obj.Error)
|
||||||
|
} else if !requested.Quiet {
|
||||||
|
deletedObj := DeletedObject{
|
||||||
|
ObjectIdentifier: ObjectIdentifier{
|
||||||
|
ObjectName: obj.Name,
|
||||||
|
VersionID: obj.VersionID,
|
||||||
|
},
|
||||||
|
DeleteMarkerVersionID: obj.DeleteMarkVersion,
|
||||||
|
}
|
||||||
|
if deletedObj.DeleteMarkerVersionID != "" {
|
||||||
|
deletedObj.DeleteMarker = true
|
||||||
|
}
|
||||||
|
response.DeletedObjects = append(response.DeletedObjects, deletedObj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(errs) != 0 {
|
||||||
if !requested.Quiet && len(errs) != 0 {
|
fields := []zap.Field{
|
||||||
additional := []zap.Field{
|
|
||||||
zap.Array("objects", marshaler),
|
zap.Array("objects", marshaler),
|
||||||
zap.Errors("errors", errs),
|
zap.Errors("errors", errs),
|
||||||
}
|
}
|
||||||
h.logAndSendError(w, "could not delete objects", reqInfo, nil, additional...)
|
h.log.Error("couldn't delete objects", fields...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := api.EncodeToResponse(w, response); err != nil {
|
if err := api.EncodeToResponse(w, response); err != nil {
|
||||||
|
|
|
@ -568,7 +568,6 @@ func (n *layer) deleteObject(ctx context.Context, bkt *data.BucketInfo, settings
|
||||||
}
|
}
|
||||||
last := versions.getLast(FromUnversioned())
|
last := versions.getLast(FromUnversioned())
|
||||||
if last == nil {
|
if last == nil {
|
||||||
obj.Error = errors.GetAPIError(errors.ErrInvalidVersion)
|
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
p.Header[VersionsDeleteMarkAttr] = last.Version()
|
p.Header[VersionsDeleteMarkAttr] = last.Version()
|
||||||
|
|
Loading…
Reference in a new issue