forked from TrueCloudLab/frostfs-s3-gw
[#532] Fix object removal
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
12a2060dd0
commit
6ad7c988e6
7 changed files with 207 additions and 63 deletions
|
@ -53,10 +53,9 @@ func (tc *testContext) getObject(objectName, versionID string, needError bool) (
|
|||
return objInfo, content.Bytes()
|
||||
}
|
||||
|
||||
func (tc *testContext) deleteObject(objectName, versionID string, settings *data.BucketSettings) {
|
||||
func (tc *testContext) deleteObject(objectName, versionID string) {
|
||||
p := &DeleteObjectParams{
|
||||
BktInfo: tc.bktInfo,
|
||||
BktSettings: settings,
|
||||
BktInfo: tc.bktInfo,
|
||||
Objects: []*VersionedObject{
|
||||
{Name: objectName, VersionID: versionID},
|
||||
},
|
||||
|
@ -231,7 +230,7 @@ func TestVersioningDeleteObject(t *testing.T) {
|
|||
tc.putObject([]byte("content obj1 v1"))
|
||||
tc.putObject([]byte("content obj1 v2"))
|
||||
|
||||
tc.deleteObject(tc.obj, "", settings)
|
||||
tc.deleteObject(tc.obj, "")
|
||||
tc.getObject(tc.obj, "", true)
|
||||
|
||||
tc.checkListObjects()
|
||||
|
@ -269,19 +268,19 @@ func TestVersioningDeleteSpecificObjectVersion(t *testing.T) {
|
|||
objV3Content := []byte("content obj1 v3")
|
||||
objV3Info := tc.putObject(objV3Content)
|
||||
|
||||
tc.deleteObject(tc.obj, objV2Info.Version(), settings)
|
||||
tc.deleteObject(tc.obj, objV2Info.Version())
|
||||
tc.getObject(tc.obj, objV2Info.Version(), true)
|
||||
|
||||
_, buffer3 := tc.getObject(tc.obj, "", false)
|
||||
require.Equal(t, objV3Content, buffer3)
|
||||
|
||||
tc.deleteObject(tc.obj, "", settings)
|
||||
tc.deleteObject(tc.obj, "")
|
||||
tc.getObject(tc.obj, "", true)
|
||||
|
||||
versions := tc.listVersions()
|
||||
for _, ver := range versions.DeleteMarker {
|
||||
if ver.IsLatest {
|
||||
tc.deleteObject(tc.obj, ver.Object.Version(), settings)
|
||||
tc.deleteObject(tc.obj, ver.Object.Version())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,10 +295,7 @@ func TestNoVersioningDeleteObject(t *testing.T) {
|
|||
tc.putObject([]byte("content obj1 v1"))
|
||||
tc.putObject([]byte("content obj1 v2"))
|
||||
|
||||
versioning, err := tc.layer.GetBucketSettings(tc.ctx, tc.bktInfo)
|
||||
require.NoError(t, err)
|
||||
|
||||
tc.deleteObject(tc.obj, "", versioning)
|
||||
tc.deleteObject(tc.obj, "")
|
||||
tc.getObject(tc.obj, "", true)
|
||||
tc.checkListObjects()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue