Skip to content

Commit

Permalink
fix test ports (#1642)
Browse files Browse the repository at this point in the history
* fix test ports

* lint

* pr comments
  • Loading branch information
otherview authored Nov 14, 2023
1 parent 991a2d6 commit 8248878
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions integration/contractdeployer/contract_deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const (
erc20ParamThree = "1000000000000000000"
testLogs = "../.build/noderunner/"
receiptTimeout = 30 * time.Second // The time to wait for a receipt for a transaction.
_portOffset = 1000
)

func init() { //nolint:gochecknoinits
Expand Down Expand Up @@ -82,7 +81,7 @@ func TestCanDeployLayer2ERC20Contract(t *testing.T) {
}

func TestFaucetSendsFundsOnlyIfNeeded(t *testing.T) {
startPort := integration.StartPortContractDeployerTest + _portOffset
startPort := integration.StartPortContractDeployerTest
hostWSPort := startPort + integration.DefaultHostRPCWSOffset
createObscuroNetwork(t, startPort)

Expand Down
13 changes: 7 additions & 6 deletions integration/faucet/faucet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/obscuronet/go-obscuro/tools/faucet/container"
"github.com/obscuronet/go-obscuro/tools/faucet/faucet"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func init() { //nolint:gochecknoinits
Expand Down Expand Up @@ -62,25 +63,25 @@ func TestFaucet(t *testing.T) {
assert.NoError(t, err)

initialFaucetBal, err := getFaucetBalance(faucetConfig.ServerPort)
assert.NoError(t, err)
assert.NotZero(t, initialFaucetBal)
require.NoError(t, err)
require.NotZero(t, initialFaucetBal)

rndWallet := datagenerator.RandomWallet(integration.ObscuroChainID)
err = fundWallet(faucetConfig.ServerPort, rndWallet)
assert.NoError(t, err)
require.NoError(t, err)

obsClient, err := obsclient.DialWithAuth(fmt.Sprintf("http://%s:%d", network.Localhost, startPort+integration.DefaultHostRPCHTTPOffset), rndWallet, testlog.Logger())
assert.NoError(t, err)
require.NoError(t, err)

currentBalance, err := obsClient.BalanceAt(context.Background(), nil)
assert.NoError(t, err)
require.NoError(t, err)

if currentBalance.Cmp(big.NewInt(0)) <= 0 {
t.Fatalf("Unexpected balance, got: %d, expected > 0", currentBalance.Int64())
}

endFaucetBal, err := getFaucetBalance(faucetConfig.ServerPort)
assert.NoError(t, err)
require.NoError(t, err)
assert.NotZero(t, endFaucetBal)
// faucet balance should have decreased
assert.Less(t, endFaucetBal.Cmp(initialFaucetBal), 0)
Expand Down

0 comments on commit 8248878

Please sign in to comment.