forked from TrueCloudLab/frostfs-node
[#280] ir: Add container processor unit tests
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
686f01bce5
commit
5010b35466
11 changed files with 409 additions and 51 deletions
|
@ -12,34 +12,34 @@ import (
|
|||
|
||||
// Delete structure of container.Delete notification from morph chain.
|
||||
type Delete struct {
|
||||
containerID []byte
|
||||
signature []byte
|
||||
token []byte
|
||||
ContainerIDValue []byte
|
||||
SignatureValue []byte
|
||||
TokenValue []byte
|
||||
|
||||
// For notary notifications only.
|
||||
// Contains raw transactions of notary request.
|
||||
notaryRequest *payload.P2PNotaryRequest
|
||||
NotaryRequestValue *payload.P2PNotaryRequest
|
||||
}
|
||||
|
||||
// MorphEvent implements Neo:Morph Event interface.
|
||||
func (Delete) MorphEvent() {}
|
||||
|
||||
// ContainerID is a marshalled container structure, defined in API.
|
||||
func (d Delete) ContainerID() []byte { return d.containerID }
|
||||
func (d Delete) ContainerID() []byte { return d.ContainerIDValue }
|
||||
|
||||
// Signature of marshalled container by container owner.
|
||||
func (d Delete) Signature() []byte { return d.signature }
|
||||
func (d Delete) Signature() []byte { return d.SignatureValue }
|
||||
|
||||
// SessionToken returns binary token of the session
|
||||
// within which the eACL was set.
|
||||
func (d Delete) SessionToken() []byte {
|
||||
return d.token
|
||||
return d.TokenValue
|
||||
}
|
||||
|
||||
// NotaryRequest returns raw notary request if notification
|
||||
// was received via notary service. Otherwise, returns nil.
|
||||
func (d Delete) NotaryRequest() *payload.P2PNotaryRequest {
|
||||
return d.notaryRequest
|
||||
return d.NotaryRequestValue
|
||||
}
|
||||
|
||||
const expectedItemNumDelete = 3
|
||||
|
@ -63,19 +63,19 @@ func ParseDelete(e *state.ContainedNotificationEvent) (event.Event, error) {
|
|||
}
|
||||
|
||||
// parse container
|
||||
ev.containerID, err = client.BytesFromStackItem(params[0])
|
||||
ev.ContainerIDValue, err = client.BytesFromStackItem(params[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get container: %w", err)
|
||||
}
|
||||
|
||||
// parse signature
|
||||
ev.signature, err = client.BytesFromStackItem(params[1])
|
||||
ev.SignatureValue, err = client.BytesFromStackItem(params[1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get signature: %w", err)
|
||||
}
|
||||
|
||||
// parse session token
|
||||
ev.token, err = client.BytesFromStackItem(params[2])
|
||||
ev.TokenValue, err = client.BytesFromStackItem(params[2])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get session token: %w", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue