Skip to content

Commit

Permalink
[BCF-2705] Randomize addresses in EVM forwarders tests (#11018)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-cordenier authored Oct 20, 2023
1 parent 71e7de3 commit 849e6b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions core/cmd/forwarders_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/urfave/cli"
Expand All @@ -23,7 +22,7 @@ func TestEVMForwarderPresenter_RenderTable(t *testing.T) {

var (
id = "1"
address = common.HexToAddress("0x5431F5F973781809D18643b87B44921b11355d81")
address = utils.RandomAddress()
evmChainID = utils.NewBigI(4)
createdAt = time.Now()
updatedAt = time.Now().Add(time.Second)
Expand Down Expand Up @@ -76,7 +75,7 @@ func TestShell_TrackEVMForwarder(t *testing.T) {
set := flag.NewFlagSet("test", 0)
cltest.FlagSetApplyFromAction(client.TrackForwarder, set, "")

require.NoError(t, set.Set("address", "0x5431F5F973781809D18643b87B44921b11355d81"))
require.NoError(t, set.Set("address", utils.RandomAddress().Hex()))
require.NoError(t, set.Set("evm-chain-id", id.String()))

err := client.TrackForwarder(cli.NewContext(nil, set, nil))
Expand Down
7 changes: 3 additions & 4 deletions core/web/evm_forwarders_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net/http"
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/manyminds/api2go/jsonapi"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -51,7 +50,7 @@ func Test_EVMForwardersController_Track(t *testing.T) {
})

// Build EVMForwarderRequest
address := common.HexToAddress("0x5431F5F973781809D18643b87B44921b11355d81")
address := utils.RandomAddress()
body, err := json.Marshal(web.TrackEVMForwarderRequest{
EVMChainID: chainId,
Address: address,
Expand Down Expand Up @@ -91,11 +90,11 @@ func Test_EVMForwardersController_Index(t *testing.T) {
fwdrs := []web.TrackEVMForwarderRequest{
{
EVMChainID: chainId,
Address: common.HexToAddress("0x5431F5F973781809D18643b87B44921b11355d81"),
Address: utils.RandomAddress(),
},
{
EVMChainID: chainId,
Address: common.HexToAddress("0x5431F5F973781809D18643b87B44921b11355d82"),
Address: utils.RandomAddress(),
},
}
for _, fwdr := range fwdrs {
Expand Down

0 comments on commit 849e6b9

Please sign in to comment.