Skip to content

Commit

Permalink
[AUTO-6713] Remove additional funding step from smoke tests and make …
Browse files Browse the repository at this point in the history
…it configurable (#11004)

* Remove additional funding step from smoke tests and make it configurable

* use envconfig and fix for mercury subtest

* set default funding to 1

---------

Co-authored-by: anirudhwarrier <[email protected]>
  • Loading branch information
anirudhwarrier and anirudhwarrier authored Oct 19, 2023
1 parent 231f2ff commit c097c2c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions integration-tests/smoke/automation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/kelseyhightower/envconfig"
"math/big"
"net/http"
"os"
Expand Down Expand Up @@ -999,6 +1000,10 @@ func TestUpdateCheckData(t *testing.T) {
}
}

type TestConfig struct {
ChainlinkNodeFunding float64 `envconfig:"CHAINLINK_NODE_FUNDING" default:"1"`
}

func setupAutomationTestDocker(
t *testing.T,
testName string,
Expand Down Expand Up @@ -1038,15 +1043,20 @@ func setupAutomationTestDocker(
//launch the environment
var env *test_env.CLClusterTestEnv
var err error
var testConfig TestConfig
err = envconfig.Process("AUTOMATION", &testConfig)
require.NoError(t, err)
l.Debug().Msgf("Funding amount: %f", testConfig.ChainlinkNodeFunding)
clNodesCount := 5
if isMercuryV02 || isMercuryV03 {
env, err = test_env.NewCLTestEnvBuilder().
WithTestLogger(t).
WithGeth().
WithMockAdapter().
WithFunding(big.NewFloat(.5)).
WithFunding(big.NewFloat(testConfig.ChainlinkNodeFunding)).
Build()
require.NoError(t, err, "Error deploying test environment for Mercury")
env.ParallelTransactions(true)

secretsConfig := `
[Mercury.Credentials.cred1]
Expand All @@ -1070,6 +1080,8 @@ func setupAutomationTestDocker(

err = env.StartClCluster(clNodeConfig, clNodesCount, secretsConfig)
require.NoError(t, err, "Error starting CL nodes test environment for Mercury")
err = env.FundChainlinkNodes(big.NewFloat(testConfig.ChainlinkNodeFunding))
require.NoError(t, err, "Error funding CL nodes")

if isMercuryV02 {
output := `{"chainlinkBlob":"0x0001c38d71fed6c320b90e84b6f559459814d068e2a1700adc931ca9717d4fe70000000000000000000000000000000000000000000000000000000001a80b52b4bf1233f9cb71144a253a1791b202113c4ab4a92fa1b176d684b4959666ff8200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001004254432d5553442d415242495452554d2d544553544e4554000000000000000000000000000000000000000000000000000000000000000000000000645570be000000000000000000000000000000000000000000000000000002af2b818dc5000000000000000000000000000000000000000000000000000002af2426faf3000000000000000000000000000000000000000000000000000002af32dc209700000000000000000000000000000000000000000000000000000000012130f8df0a9745bb6ad5e2df605e158ba8ad8a33ef8a0acf9851f0f01668a3a3f2b68600000000000000000000000000000000000000000000000000000000012130f60000000000000000000000000000000000000000000000000000000000000002c4a7958dce105089cf5edb68dad7dcfe8618d7784eb397f97d5a5fade78c11a58275aebda478968e545f7e3657aba9dcbe8d44605e4c6fde3e24edd5e22c94270000000000000000000000000000000000000000000000000000000000000002459c12d33986018a8959566d145225f0c4a4e61a9a3f50361ccff397899314f0018162cf10cd89897635a0bb62a822355bd199d09f4abe76e4d05261bb44733d"}`
Expand All @@ -1086,16 +1098,14 @@ func setupAutomationTestDocker(
WithMockAdapter().
WithCLNodes(clNodesCount).
WithCLNodeConfig(clNodeConfig).
WithFunding(big.NewFloat(.5)).
WithFunding(big.NewFloat(testConfig.ChainlinkNodeFunding)).
Build()
require.NoError(t, err, "Error deploying test environment")
}

env.ParallelTransactions(true)
nodeClients := env.ClCluster.NodeAPIs()
workerNodes := nodeClients[1:]
err = actions.FundChainlinkNodesLocal(workerNodes, env.EVMClient, big.NewFloat(1.0))
require.NoError(t, err, "Error funding Chainlink nodes")

linkToken, err := env.ContractDeployer.DeployLinkTokenContract()
require.NoError(t, err, "Error deploying LINK token")
Expand Down

0 comments on commit c097c2c

Please sign in to comment.