forked from TrueCloudLab/frostfs-node
[#755] morph: Drop FrostFSID contract usage
Unused. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
d5c9dd3c83
commit
1cd2bfe51a
18 changed files with 16 additions and 844 deletions
|
@ -5,12 +5,9 @@ import (
|
|||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/balance"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/frostfsid"
|
||||
nmClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap"
|
||||
frostfsEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/frostfs"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger/test"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -194,80 +191,11 @@ func TestHandleConfig(t *testing.T) {
|
|||
require.EqualValues(t, []nmClient.SetConfigPrm{expConfig}, nm.config, "invalid config value")
|
||||
}
|
||||
|
||||
func TestHandleUnbind(t *testing.T) {
|
||||
t.Parallel()
|
||||
es := &testEpochState{
|
||||
epochCounter: 100,
|
||||
}
|
||||
m := &testMorphClient{
|
||||
balance: 150,
|
||||
}
|
||||
id := &testIDClient{}
|
||||
proc, err := newTestProc(t, func(p *Params) {
|
||||
p.EpochState = es
|
||||
p.MorphClient = m
|
||||
p.FrostFSIDClient = id
|
||||
})
|
||||
require.NoError(t, err, "failed to create processor")
|
||||
|
||||
p, err := keys.NewPrivateKey()
|
||||
require.NoError(t, err)
|
||||
|
||||
evUnbind := frostfsEvent.Unbind{
|
||||
BindCommon: frostfsEvent.BindCommon{
|
||||
UserValue: util.Uint160{49}.BytesBE(),
|
||||
KeysValue: [][]byte{
|
||||
p.PublicKey().Bytes(),
|
||||
},
|
||||
TxHashValue: util.Uint256{100},
|
||||
},
|
||||
}
|
||||
|
||||
proc.handleUnbind(evUnbind)
|
||||
|
||||
for proc.pool.Running() > 0 {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
|
||||
var userID user.ID
|
||||
userID.SetScriptHash(util.Uint160{49})
|
||||
|
||||
var expBind frostfsid.CommonBindPrm
|
||||
expBind.SetOwnerID(userID.WalletBytes())
|
||||
expBind.SetKeys(evUnbind.BindCommon.KeysValue)
|
||||
expBind.SetHash(evUnbind.BindCommon.TxHashValue)
|
||||
|
||||
var expNilSlice []frostfsid.CommonBindPrm
|
||||
|
||||
require.EqualValues(t, []frostfsid.CommonBindPrm{expBind}, id.remove, "invalid remove keys value")
|
||||
require.EqualValues(t, expNilSlice, id.add, "invalid add keys value")
|
||||
|
||||
evBind := frostfsEvent.Bind{
|
||||
BindCommon: frostfsEvent.BindCommon{
|
||||
UserValue: util.Uint160{49}.BytesBE(),
|
||||
KeysValue: [][]byte{
|
||||
p.PublicKey().Bytes(),
|
||||
},
|
||||
TxHashValue: util.Uint256{100},
|
||||
},
|
||||
}
|
||||
|
||||
proc.handleBind(evBind)
|
||||
|
||||
for proc.pool.Running() > 0 {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
|
||||
require.EqualValues(t, []frostfsid.CommonBindPrm{expBind}, id.remove, "invalid remove keys value")
|
||||
require.EqualValues(t, []frostfsid.CommonBindPrm{expBind}, id.add, "invalid add keys value")
|
||||
}
|
||||
|
||||
func newTestProc(t *testing.T, nonDefault func(p *Params)) (*Processor, error) {
|
||||
p := &Params{
|
||||
Log: test.NewLogger(t, true),
|
||||
PoolSize: 1,
|
||||
FrostFSContract: util.Uint160{0},
|
||||
FrostFSIDClient: &testIDClient{},
|
||||
BalanceClient: &testBalaceClient{},
|
||||
NetmapClient: &testNetmapClient{},
|
||||
MorphClient: &testMorphClient{},
|
||||
|
@ -358,18 +286,3 @@ func (c *testMorphClient) TransferGas(receiver util.Uint160, amount fixedn.Fixed
|
|||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
type testIDClient struct {
|
||||
add []frostfsid.CommonBindPrm
|
||||
remove []frostfsid.CommonBindPrm
|
||||
}
|
||||
|
||||
func (c *testIDClient) AddKeys(p frostfsid.CommonBindPrm) error {
|
||||
c.add = append(c.add, p)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *testIDClient) RemoveKeys(args frostfsid.CommonBindPrm) error {
|
||||
c.remove = append(c.remove, args)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue