WIP: Morph: Add unit tests #2

Closed
dstepanov-yadro wants to merge 233 commits from TrueCloudLab/frostfs-node:master into object-3608-morph-unit-tests
13 changed files with 20 additions and 20 deletions
Showing only changes of commit 8a4e250dae - Show all commits

View file

@ -40,7 +40,7 @@ func verifyResponse(cmd *cobra.Command,
commonCmd.ExitOnErr(cmd, "", errors.New("missing response signature"))
}
// TODO(@cthulhu-rider): #1387 use Signature message from NeoFS API to avoid conversion
// TODO(@cthulhu-rider): #468 use Signature message from FrostFS API to avoid conversion
var sigV2 refs.Signature
sigV2.SetScheme(refs.ECDSA_SHA512)
sigV2.SetKey(sigControl.GetKey())

View file

@ -163,7 +163,7 @@ func printHeader(cmd *cobra.Command, obj *object.Object) error {
if signature := obj.Signature(); signature != nil {
cmd.Print("ID signature:\n")
// TODO(@carpawell): #1387 implement and use another approach to avoid conversion
// TODO(@carpawell): #468 implement and use another approach to avoid conversion
var sigV2 refs.Signature
signature.WriteToV2(&sigV2)

View file

@ -435,7 +435,7 @@ func (s *morphEACLFetcher) GetEACL(cnr cid.ID) (*containercore.EACL, error) {
}
if !eaclInfo.Signature.Verify(binTable) {
// TODO(@cthulhu-rider): #1387 use "const" error
// TODO(@cthulhu-rider): #468 use "const" error
return nil, errors.New("invalid signature of the eACL table")
}

View file

@ -135,7 +135,7 @@ func (v *FormatValidator) Validate(ctx context.Context, obj *object.Object, unpr
func (v *FormatValidator) validateSignatureKey(obj *object.Object) error {
sig := obj.Signature()
if sig == nil {
// TODO(@cthulhu-rider): #1387 use "const" error
// TODO(@cthulhu-rider): #468 use "const" error
return errors.New("missing signature")
}

View file

@ -86,7 +86,7 @@ func (c *Client) GetEACL(cnr cid.ID) (*container.EACL, error) {
}
}
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
var sigV2 refs.Signature
sigV2.SetKey(pub)
sigV2.SetSign(sig)

View file

@ -31,7 +31,7 @@ func PutEACL(c *Client, eaclInfo containercore.EACL) error {
prm.SetToken(eaclInfo.Session.Marshal())
}
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
var sigV2 refs.Signature
eaclInfo.Signature.WriteToV2(&sigV2)

View file

@ -105,7 +105,7 @@ func (c *Client) Get(cid []byte) (*containercore.Container, error) {
}
}
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
var sigV2 refs.Signature
sigV2.SetKey(pub)
sigV2.SetSign(sigBytes)

View file

@ -28,7 +28,7 @@ func Put(c *Client, cnr containercore.Container) (*cid.ID, error) {
prm.SetToken(cnr.Session.Marshal())
}
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
var sigV2 refs.Signature
cnr.Signature.WriteToV2(&sigV2)

View file

@ -52,7 +52,7 @@ func NewExecutor(rdr Reader, wrt Writer) containerSvc.ServiceExecutor {
func (s *morphExecutor) Put(_ context.Context, tokV2 *sessionV2.Token, body *container.PutRequestBody) (*container.PutResponseBody, error) {
sigV2 := body.GetSignature()
if sigV2 == nil {
// TODO(@cthulhu-rider): #1387 use "const" error
// TODO(@cthulhu-rider): #468 use "const" error
return nil, errors.New("missing signature")
}
@ -206,7 +206,7 @@ func (s *morphExecutor) List(_ context.Context, body *container.ListRequestBody)
func (s *morphExecutor) SetExtendedACL(_ context.Context, tokV2 *sessionV2.Token, body *container.SetExtendedACLRequestBody) (*container.SetExtendedACLResponseBody, error) {
sigV2 := body.GetSignature()
if sigV2 == nil {
// TODO(@cthulhu-rider): #1387 use "const" error
// TODO(@cthulhu-rider): #468 use "const" error
return nil, errors.New("missing signature")
}

View file

@ -24,7 +24,7 @@ var errDisallowedKey = errors.New("key is not in the allowed list")
func (s *Server) isValidRequest(req SignedMessage) error {
sign := req.GetSignature()
if sign == nil {
// TODO(@cthulhu-rider): #1387 use "const" error
// TODO(@cthulhu-rider): #468 use "const" error
return errors.New("missing signature")
}
@ -50,7 +50,7 @@ func (s *Server) isValidRequest(req SignedMessage) error {
return fmt.Errorf("marshal request body: %w", err)
}
// TODO(@cthulhu-rider): #1387 use Signature message from NeoFS API to avoid conversion
// TODO(@cthulhu-rider): #468 use Signature message from FrostFS API to avoid conversion
var sigV2 refs.Signature
sigV2.SetKey(sign.GetKey())
sigV2.SetSign(sign.GetSign())
@ -62,7 +62,7 @@ func (s *Server) isValidRequest(req SignedMessage) error {
}
if !sig.Verify(binBody) {
// TODO(@cthulhu-rider): #1387 use "const" error
// TODO(@cthulhu-rider): #468 use "const" error
return errors.New("invalid signature")
}
@ -83,7 +83,7 @@ func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error {
return fmt.Errorf("calculate signature: %w", err)
}
// TODO(@cthulhu-rider): #1387 use Signature message from NeoFS API to avoid conversion
// TODO(@cthulhu-rider): #468 use Signature message from FrostFS API to avoid conversion
var sigV2 refs.Signature
sig.WriteToV2(&sigV2)

View file

@ -24,7 +24,7 @@ var errDisallowedKey = errors.New("key is not in the allowed list")
func (s *Server) isValidRequest(req SignedMessage) error {
sign := req.GetSignature()
if sign == nil {
// TODO(@cthulhu-rider): #1387 use "const" error
// TODO(@cthulhu-rider): #468 use "const" error
return errors.New("missing signature")
}
@ -50,7 +50,7 @@ func (s *Server) isValidRequest(req SignedMessage) error {
return fmt.Errorf("marshal request body: %w", err)
}
// TODO(@cthulhu-rider): #1387 use Signature message from NeoFS API to avoid conversion
// TODO(@cthulhu-rider): #468 use Signature message from FrostFS API to avoid conversion
var sigV2 refs.Signature
sigV2.SetKey(sign.GetKey())
sigV2.SetSign(sign.GetSign())
@ -62,7 +62,7 @@ func (s *Server) isValidRequest(req SignedMessage) error {
}
if !sig.Verify(binBody) {
// TODO(@cthulhu-rider): #1387 use "const" error
// TODO(@cthulhu-rider): #468 use "const" error
return errors.New("invalid signature")
}
@ -83,7 +83,7 @@ func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error {
return fmt.Errorf("calculate signature: %w", err)
}
// TODO(@cthulhu-rider): #1387 use Signature message from NeoFS API to avoid conversion
// TODO(@cthulhu-rider): #468 use Signature message from FrostFS API to avoid conversion
var sigV2 refs.Signature
sig.WriteToV2(&sigV2)

View file

@ -118,7 +118,7 @@ func ownerFromToken(token *sessionSDK.Object) (*user.ID, *keys.PublicKey, error)
}
// 2. Then check if session token owner issued the session token
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
var tokV2 sessionV2.Token
token.WriteToV2(&tokV2)

View file

@ -159,7 +159,7 @@ func verifyMessage(m message) error {
sig := m.GetSignature()
// TODO(@cthulhu-rider): #1387 use Signature message from NeoFS API to avoid conversion
// TODO(@cthulhu-rider): #468 use Signature message from FrostFS API to avoid conversion
var sigV2 refs.Signature
sigV2.SetKey(sig.GetKey())
sigV2.SetSign(sig.GetSign())