Skip to content

Commit

Permalink
use new method in all smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Aug 8, 2024
1 parent 4d67508 commit 55549b2
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 23 deletions.
7 changes: 4 additions & 3 deletions integration-tests/actions/vrf/common/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"testing"
"time"

"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/go-resty/resty/v2"
Expand All @@ -19,7 +21,6 @@ import (

ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env"
"github.com/smartcontractkit/chainlink-testing-framework/utils/conversions"
seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
Expand Down Expand Up @@ -367,7 +368,7 @@ func BuildNewCLEnvForVRF(l zerolog.Logger, t *testing.T, envConfig VRFEnvConfig,
if err != nil {
return nil, nil, fmt.Errorf("%s, err: %w", "error getting first evm network", err)
}
sethClient, err := seth_utils.GetChainClient(envConfig.TestConfig, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, envConfig.TestConfig, evmNetwork)
if err != nil {
return nil, nil, fmt.Errorf("%s, err: %w", "error getting seth client", err)
}
Expand Down Expand Up @@ -403,7 +404,7 @@ func LoadExistingCLEnvForVRF(
if err != nil {
return nil, nil, err
}
sethClient, err := seth_utils.GetChainClient(envConfig.TestConfig, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, envConfig.TestConfig, evmNetwork)
if err != nil {
return nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/smoke/automation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"testing"
"time"

seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
Expand Down Expand Up @@ -1427,7 +1427,7 @@ func setupAutomationTestDocker(
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClient(automationTestConfig, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, automationTestConfig, evmNetwork)
require.NoError(t, err, "Error getting seth client")

err = actions.FundChainlinkNodesFromRootAddress(l, sethClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(*automationTestConfig.GetCommonConfig().ChainlinkNodeFunding))
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/smoke/flux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import (
"testing"
"time"

"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/ethereum/go-ethereum/common"
"github.com/google/uuid"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
Expand Down Expand Up @@ -49,7 +50,7 @@ func TestFluxBasic(t *testing.T) {
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClient(config, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, config, evmNetwork)
require.NoError(t, err, "Error getting seth client")

adapterUUID := uuid.NewString()
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/smoke/forwarder_ocr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestForwarderOCRBasic(t *testing.T) {
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClient(config, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, config, evmNetwork)
require.NoError(t, err, "Error getting seth client")

err = actions.FundChainlinkNodesFromRootAddress(l, sethClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(*config.Common.ChainlinkNodeFunding))
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/smoke/forwarders_ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -50,7 +50,7 @@ func TestForwarderOCR2Basic(t *testing.T) {
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClient(config, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, config, evmNetwork)
require.NoError(t, err, "Error getting seth client")

err = actions.FundChainlinkNodesFromRootAddress(l, sethClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(*config.Common.ChainlinkNodeFunding))
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/smoke/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/ethereum/go-ethereum/common"
"github.com/onsi/gomega"
Expand Down Expand Up @@ -1243,7 +1243,7 @@ func setupKeeperTest(l zerolog.Logger, t *testing.T, config *tc.TestConfig) (
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClient(config, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, config, evmNetwork)
require.NoError(t, err, "Error getting seth client")

err = actions.FundChainlinkNodesFromRootAddress(l, sethClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(*config.Common.ChainlinkNodeFunding))
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/ethereum/go-ethereum/common"
"github.com/rs/zerolog"
Expand Down Expand Up @@ -163,7 +163,7 @@ func prepareORCv2SmokeTestEnv(t *testing.T, testData ocr2test, l zerolog.Logger,
evmNetwork, err := testEnv.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClient(config, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, config, evmNetwork)
require.NoError(t, err, "Error getting seth client")

nodeClients := testEnv.ClCluster.NodeAPIs()
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/smoke/ocr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
Expand Down Expand Up @@ -99,7 +98,7 @@ func prepareORCv1SmokeTestEnv(t *testing.T, l zerolog.Logger, firstRoundResult i
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClientWithConfigFunction(config, *evmNetwork, utils.DynamicArtifactDirConfigFn(t))
sethClient, err := utils.TestAwareSethClient(t, config, evmNetwork)
require.NoError(t, err, "Error getting seth client")

nodeClients := env.ClCluster.NodeAPIs()
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/smoke/runlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/google/uuid"
"github.com/onsi/gomega"
Expand Down Expand Up @@ -47,7 +47,7 @@ func TestRunLogBasic(t *testing.T) {
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClient(config, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, config, evmNetwork)
require.NoError(t, err, "Error getting seth client")

err = actions.FundChainlinkNodesFromRootAddress(l, sethClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(*config.Common.ChainlinkNodeFunding))
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/smoke/vrf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import (
"testing"
"time"

"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/google/uuid"
"github.com/onsi/gomega"
"github.com/rs/zerolog"
"github.com/smartcontractkit/seth"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
Expand Down Expand Up @@ -204,7 +205,7 @@ func prepareVRFtestEnv(t *testing.T, l zerolog.Logger) (*test_env.CLClusterTestE
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

sethClient, err := seth_utils.GetChainClient(config, *evmNetwork)
sethClient, err := utils.TestAwareSethClient(t, config, evmNetwork)
require.NoError(t, err, "Error getting seth client")

err = actions.FundChainlinkNodesFromRootAddress(l, sethClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(*config.Common.ChainlinkNodeFunding))
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/universal/log_poller/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"testing"
"time"

"github.com/smartcontractkit/chainlink/integration-tests/utils"

"github.com/jmoiron/sqlx"
"github.com/smartcontractkit/seth"
"github.com/smartcontractkit/wasp"
Expand All @@ -30,7 +32,6 @@ import (
ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env"
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/networks"
seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
Expand Down Expand Up @@ -1059,7 +1060,7 @@ func SetupLogPollerTestDocker(
evmNetwork, err := env.GetFirstEvmNetwork()
require.NoError(t, err, "Error getting first evm network")

chainClient, err := seth_utils.GetChainClient(testConfig, *evmNetwork)
chainClient, err := utils.TestAwareSethClient(t, testConfig, evmNetwork)
require.NoError(t, err, "Error getting seth client")

err = actions.FundChainlinkNodesFromRootAddress(l, chainClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(chainlinkNodeFunding))
Expand Down
9 changes: 9 additions & 0 deletions integration-tests/utils/seth.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import (
"testing"

pkg_seth "github.com/smartcontractkit/seth"

"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
ctf_config "github.com/smartcontractkit/chainlink-testing-framework/config"
seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"
)

// DynamicArtifactDirConfigFn returns a function that sets Seth's artifacts directory to a unique directory for the test
Expand All @@ -14,3 +18,8 @@ func DynamicArtifactDirConfigFn(t *testing.T) func(*pkg_seth.Config) error {
return nil
}
}

// TestAwareSethClient returns a Seth client with the artifacts directory set to a unique directory for the test
func TestAwareSethClient(t *testing.T, sethConfig ctf_config.SethConfig, evmNetwork *blockchain.EVMNetwork) (*pkg_seth.Client, error) {
return seth_utils.GetChainClientWithConfigFunction(sethConfig, *evmNetwork, DynamicArtifactDirConfigFn(t))
}

0 comments on commit 55549b2

Please sign in to comment.