[#142] container: do not fail when deleting missing container
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
6bd088aa9f
commit
2cb10edfd2
2 changed files with 8 additions and 1 deletions
|
@ -303,7 +303,7 @@ func Delete(containerID []byte, signature interop.Signature, token []byte) {
|
||||||
|
|
||||||
ownerID := getOwnerByID(ctx, containerID)
|
ownerID := getOwnerByID(ctx, containerID)
|
||||||
if ownerID == nil {
|
if ownerID == nil {
|
||||||
panic(NotFoundError)
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if notaryDisabled {
|
if notaryDisabled {
|
||||||
|
|
|
@ -185,6 +185,13 @@ func TestContainerDelete(t *testing.T) {
|
||||||
tx = PrepareInvoke(t, bc, CommitteeAcc, h, "delete", c.id[:], c.sig, c.token)
|
tx = PrepareInvoke(t, bc, CommitteeAcc, h, "delete", c.id[:], c.sig, c.token)
|
||||||
AddBlockCheckHalt(t, bc, tx)
|
AddBlockCheckHalt(t, bc, tx)
|
||||||
|
|
||||||
|
t.Run("missing container", func(t *testing.T) {
|
||||||
|
id := c.id
|
||||||
|
id[0] ^= 0xFF
|
||||||
|
tx = PrepareInvoke(t, bc, CommitteeAcc, h, "delete", id[:], c.sig, c.token)
|
||||||
|
AddBlockCheckHalt(t, bc, tx)
|
||||||
|
})
|
||||||
|
|
||||||
tx = PrepareInvoke(t, bc, acc, h, "get", c.id[:])
|
tx = PrepareInvoke(t, bc, acc, h, "get", c.id[:])
|
||||||
_, err := TestInvoke(bc, tx)
|
_, err := TestInvoke(bc, tx)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
|
|
Loading…
Reference in a new issue