From 868edfdb314d73ddff55553e9328ce03253dc7e4 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 1 Jun 2023 15:31:05 +0300 Subject: [PATCH] [#78] Add test of bucket removal with object not found error Signed-off-by: Alex Vanin --- api/handler/delete_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api/handler/delete_test.go b/api/handler/delete_test.go index e9fb0e2..713aad4 100644 --- a/api/handler/delete_test.go +++ b/api/handler/delete_test.go @@ -53,6 +53,26 @@ func TestDeleteBucket(t *testing.T) { deleteBucket(t, tc, bktName, http.StatusNoContent) } +func TestDeleteBucketOnNotFoundError(t *testing.T) { + hc := prepareHandlerContext(t) + + bktName, objName := "bucket-for-removal", "object-to-delete" + bktInfo := createTestBucket(hc, bktName) + + putObject(t, hc, bktName, objName) + + nodeVersion, err := hc.tree.GetUnversioned(hc.context, bktInfo, objName) + require.NoError(t, err) + var addr oid.Address + addr.SetContainer(bktInfo.CID) + addr.SetObject(nodeVersion.OID) + hc.tp.SetObjectError(addr, apistatus.ObjectNotFound{}) + + deleteObjects(t, hc, bktName, [][2]string{{objName, emptyVersion}}) + + deleteBucket(t, hc, bktName, http.StatusNoContent) +} + func TestDeleteObject(t *testing.T) { tc := prepareHandlerContext(t)