7ac3145980
Adapt all audit wrapper calls to new structures. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
package audit_test
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
|
auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper"
|
|
auditAPI "github.com/nspcc-dev/neofs-sdk-go/audit"
|
|
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestAuditResults(t *testing.T) {
|
|
t.Skip()
|
|
const epoch = 11
|
|
|
|
endpoint := "http://morph_chain.neofs.devenv:30333"
|
|
sAuditHash := "cdfb3dab86e6d60e8a143d9e2ecb0b188f3dc2eb"
|
|
irKeyWIF := "L3o221BojgcCPYgdbXsm6jn7ayTZ72xwREvBHXKknR8VJ3G4WmjB"
|
|
|
|
key, err := keys.NewPrivateKeyFromWIF(irKeyWIF)
|
|
require.NoError(t, err)
|
|
|
|
auditHash, err := util.Uint160DecodeStringLE(sAuditHash)
|
|
require.NoError(t, err)
|
|
|
|
morphClient, err := client.New(key, endpoint)
|
|
require.NoError(t, err)
|
|
|
|
auditClientWrapper, err := auditWrapper.NewFromMorph(morphClient, auditHash, 0)
|
|
require.NoError(t, err)
|
|
|
|
id := cidtest.GenerateID()
|
|
|
|
auditRes := auditAPI.NewResult()
|
|
auditRes.SetAuditEpoch(epoch)
|
|
auditRes.SetPublicKey(key.PublicKey().Bytes())
|
|
auditRes.SetContainerID(id)
|
|
|
|
prm := auditWrapper.PutPrm{}
|
|
prm.SetResult(auditRes)
|
|
|
|
require.NoError(t, auditClientWrapper.PutAuditResult(prm))
|
|
|
|
time.Sleep(5 * time.Second)
|
|
|
|
list, err := auditClientWrapper.ListAuditResultIDByCID(epoch, id)
|
|
require.NoError(t, err)
|
|
require.Len(t, list, 1)
|
|
|
|
savedAuditRes, err := auditClientWrapper.GetAuditResult(list[0])
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, auditRes, savedAuditRes)
|
|
}
|