forked from TrueCloudLab/frostfs-node
[#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 <leonard@nspcc.ru>
This commit is contained in:
parent
fdd54b0a03
commit
a97ea2aa21
1 changed files with 8 additions and 1 deletions
|
@ -2,6 +2,7 @@ package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
|
@ -21,13 +22,15 @@ type testLocalStorage struct {
|
||||||
expAddr oid.Address
|
expAddr oid.Address
|
||||||
|
|
||||||
obj *object.Object
|
obj *object.Object
|
||||||
|
|
||||||
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *testLocalStorage) Head(addr oid.Address) (*object.Object, 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.Container().Equals(s.expAddr.Container()))
|
||||||
require.True(s.t, addr.Object().Equals(s.expAddr.Object()))
|
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 {
|
func testXHeaders(strs ...string) []session.XHeader {
|
||||||
|
@ -128,4 +131,8 @@ func TestHeadRequest(t *testing.T) {
|
||||||
obj.SetAttributes()
|
obj.SetAttributes()
|
||||||
|
|
||||||
require.Equal(t, eaclSDK.ActionAllow, validator.CalculateAction(unit.WithHeaderSource(newSource(t))))
|
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))))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue