forked from TrueCloudLab/frostfs-node
[#321] adm/test: Check wallet correctness in parallel
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
fe4082799a
commit
c8c5f14e2e
1 changed files with 23 additions and 15 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring"
|
||||||
|
@ -71,24 +72,31 @@ func TestGenerateAlphabet(t *testing.T) {
|
||||||
buf.WriteString(testContractPassword + "\r")
|
buf.WriteString(testContractPassword + "\r")
|
||||||
require.NoError(t, generateAlphabetCreds(generateAlphabetCmd, nil))
|
require.NoError(t, generateAlphabetCreds(generateAlphabetCmd, nil))
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
for i := uint64(0); i < size; i++ {
|
for i := uint64(0); i < size; i++ {
|
||||||
p := filepath.Join(walletDir, innerring.GlagoliticLetter(i).String()+".json")
|
i := i
|
||||||
w, err := wallet.NewWalletFromFile(p)
|
go func() {
|
||||||
require.NoError(t, err, "wallet doesn't exist")
|
defer wg.Done()
|
||||||
require.Equal(t, 3, len(w.Accounts), "not all accounts were created")
|
p := filepath.Join(walletDir, innerring.GlagoliticLetter(i).String()+".json")
|
||||||
for _, a := range w.Accounts {
|
w, err := wallet.NewWalletFromFile(p)
|
||||||
err := a.Decrypt(strconv.FormatUint(i, 10), keys.NEP2ScryptParams())
|
require.NoError(t, err, "wallet doesn't exist")
|
||||||
require.NoError(t, err, "can't decrypt account")
|
require.Equal(t, 3, len(w.Accounts), "not all accounts were created")
|
||||||
switch a.Label {
|
|
||||||
case consensusAccountName:
|
for _, a := range w.Accounts {
|
||||||
require.Equal(t, smartcontract.GetDefaultHonestNodeCount(size), len(a.Contract.Parameters))
|
err := a.Decrypt(strconv.FormatUint(i, 10), keys.NEP2ScryptParams())
|
||||||
case committeeAccountName:
|
require.NoError(t, err, "can't decrypt account")
|
||||||
require.Equal(t, smartcontract.GetMajorityHonestNodeCount(size), len(a.Contract.Parameters))
|
switch a.Label {
|
||||||
default:
|
case consensusAccountName:
|
||||||
require.Equal(t, singleAccountName, a.Label)
|
require.Equal(t, smartcontract.GetDefaultHonestNodeCount(size), len(a.Contract.Parameters))
|
||||||
|
case committeeAccountName:
|
||||||
|
require.Equal(t, smartcontract.GetMajorityHonestNodeCount(size), len(a.Contract.Parameters))
|
||||||
|
default:
|
||||||
|
require.Equal(t, singleAccountName, a.Label)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}()
|
||||||
}
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
t.Run("check contract group wallet", func(t *testing.T) {
|
t.Run("check contract group wallet", func(t *testing.T) {
|
||||||
p := filepath.Join(walletDir, contractWalletFilename)
|
p := filepath.Join(walletDir, contractWalletFilename)
|
||||||
|
|
Loading…
Reference in a new issue