From a97ea2aa21b8e8f2609e679774b2fda163a82dd3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 2 Jun 2022 17:09:34 +0300 Subject: [PATCH] [#1471] eacl: Add testcase with local storage failure ACL service should not deny request on local storage failure since in this case relay nodes won't be able to continue the operation. Signed-off-by: Leonard Lyubich --- pkg/services/object/acl/eacl/v2/eacl_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/services/object/acl/eacl/v2/eacl_test.go b/pkg/services/object/acl/eacl/v2/eacl_test.go index d99d73ef7..2d12adf55 100644 --- a/pkg/services/object/acl/eacl/v2/eacl_test.go +++ b/pkg/services/object/acl/eacl/v2/eacl_test.go @@ -2,6 +2,7 @@ package v2 import ( "crypto/ecdsa" + "errors" "testing" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -21,13 +22,15 @@ type testLocalStorage struct { expAddr oid.Address obj *object.Object + + err error } func (s *testLocalStorage) Head(addr oid.Address) (*object.Object, error) { require.True(s.t, addr.Container().Equals(s.expAddr.Container())) require.True(s.t, addr.Object().Equals(s.expAddr.Object())) - return s.obj, nil + return s.obj, s.err } func testXHeaders(strs ...string) []session.XHeader { @@ -128,4 +131,8 @@ func TestHeadRequest(t *testing.T) { obj.SetAttributes() require.Equal(t, eaclSDK.ActionAllow, validator.CalculateAction(unit.WithHeaderSource(newSource(t)))) + + lStorage.err = errors.New("any error") + + require.Equal(t, eaclSDK.ActionAllow, validator.CalculateAction(unit.WithHeaderSource(newSource(t)))) }