From 88e73a04d779f00de7f20c5601058e3578edb7fa Mon Sep 17 00:00:00 2001 From: alexvanin Date: Wed, 27 May 2020 15:26:57 +0300 Subject: [PATCH] Remove inner ring update test This test runs in neofs-node repository because it uses internal neofs-node structures. It will be reworked later. --- README.md | 6 ----- neofs_contract_test.go | 57 ------------------------------------------ 2 files changed, 63 deletions(-) diff --git a/README.md b/README.md index 859698e..9e579b4 100644 --- a/README.md +++ b/README.md @@ -91,12 +91,6 @@ PASS ok github.com/nspcc-dev/neofs-contract 0.453s ``` -### Skipped tests - -Some tests might be skipped for now. These tests used `neofs-node` -structures, that are not publicly available yet, e.g. cheque for -`InnerRingUpdate` call. - ## License This project is licensed under the GPLv3 License - see the diff --git a/neofs_contract_test.go b/neofs_contract_test.go index d1cd41b..34bc316 100644 --- a/neofs_contract_test.go +++ b/neofs_contract_test.go @@ -11,7 +11,6 @@ import ( "os" "testing" - "github.com/multiformats/go-multiaddr" "github.com/nspcc-dev/neo-go/pkg/compiler" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/io" @@ -145,48 +144,6 @@ func TestContract(t *testing.T) { require.NoError(t, v.Run()) require.False(t, bytes.Contains(plug.mem["InnerRingCandidates"], key)) }) - - t.Run("InnerRingUpdate", func(t *testing.T) { - t.Skip("implement getIRExcludeCheque without neofs-node dependency") - - pubKey := &test.DecodeKey(4).PublicKey - key := crypto.MarshalPublicKey(pubKey) - plug.setCGASBalance(key, 4000) - - var pubs []*ecdsa.PublicKey - for i := 0; i < len(contract.privs)-1; i++ { - pubs = append(pubs, &contract.privs[i].PublicKey) - } - pubs = append(pubs, pubKey) - cheque := getIRExcludeCheque(t, contract, pubs, 777) - - t.Run("Try without candidate", func(t *testing.T) { - v := initVM(contract, plug) - loadArg(t, v, "InnerRingUpdate", []interface{}{cheque}) - require.Error(t, v.Run()) - }) - - v := initVM(contract, plug) - loadArg(t, v, "InnerRingCandidateAdd", []interface{}{"addrX", key}) - require.NoError(t, v.Run()) - - v = initVM(contract, plug) - loadArg(t, v, "InnerRingUpdate", []interface{}{cheque}) - require.NoError(t, v.Run()) - - for i := 0; i < len(contract.privs)-1; i++ { - require.True(t, bytes.Contains(plug.mem["InnerRingList"], - crypto.MarshalPublicKey(&contract.privs[i].PublicKey))) - } - require.True(t, bytes.Contains(plug.mem["InnerRingList"], key)) - - t.Run("Double InnerRingUpdate", func(t *testing.T) { - newCheque := getIRExcludeCheque(t, contract, pubs, 777) - v = initVM(contract, plug) - loadArg(t, v, "InnerRingUpdate", []interface{}{newCheque}) - require.Error(t, v.Run()) - }) - }) } func getCheque(t *testing.T, c *contract, amount int64) (refs.OwnerID, []byte) { @@ -244,20 +201,6 @@ func getKeys(t *testing.T, n int) []*ecdsa.PrivateKey { return privs } -func getAddrs(t *testing.T, n int) []multiaddr.Multiaddr { - const template = "/dns4/10.120.14.%d/tcp/8080" - - addrs := make([]multiaddr.Multiaddr, n) - for i := range addrs { - var err error - - addrs[i], err = multiaddr.NewMultiaddr(fmt.Sprintf(template, i)) - require.NoError(t, err) - } - - return addrs -} - func mustHex(s string) []byte { result, err := hex.DecodeString(s) if err != nil {