Skip to content

Commit

Permalink
[TT-1387] log warning if any custom network config for CL node is pre…
Browse files Browse the repository at this point in the history
…sent (#13775)

* log warning if any custom network config for CL node is present

* Update integration-tests/testconfig/testconfig.go

Co-authored-by: Adam Hamrick <[email protected]>

---------

Co-authored-by: Adam Hamrick <[email protected]>
  • Loading branch information
Tofel and kalverra authored Jul 8, 2024
1 parent 5f3d58b commit 858ae91
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
4 changes: 1 addition & 3 deletions integration-tests/smoke/ocr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ func TestOCRJobReplacement(t *testing.T) {

func prepareORCv1SmokeTestEnv(t *testing.T, l zerolog.Logger, firstRoundResult int64) (*test_env.CLClusterTestEnv, []contracts.OffchainAggregator, *seth.Client) {
config, err := tc.GetConfig([]string{"Smoke"}, tc.OCR)
if err != nil {
t.Fatal(err)
}
require.NoError(t, err, "Error getting config")

network, err := actions.EthereumNetworkConfigFromConfig(l, &config)
require.NoError(t, err, "Error building ethereum network config")
Expand Down
38 changes: 30 additions & 8 deletions integration-tests/testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/google/uuid"
"github.com/pelletier/go-toml/v2"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"golang.org/x/text/cases"
"golang.org/x/text/language"

Expand All @@ -21,8 +22,10 @@ import (
ctf_config "github.com/smartcontractkit/chainlink-testing-framework/config"
k8s_config "github.com/smartcontractkit/chainlink-testing-framework/k8s/config"
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/networks"
"github.com/smartcontractkit/chainlink-testing-framework/utils/conversions"
"github.com/smartcontractkit/chainlink-testing-framework/utils/osutil"

a_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/automation"
f_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/functions"
keeper_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/keeper"
Expand Down Expand Up @@ -386,27 +389,34 @@ func GetConfig(configurationNames []string, product Product) (TestConfig, error)
testConfig.Common = &Common{}
}

testConfig.logRiskySettings(logger)

logger.Debug().Msg("Correct test config constructed successfully")
return testConfig, nil
}

func (c *TestConfig) logRiskySettings(logger zerolog.Logger) {
isAnySimulated := false
for _, network := range testConfig.Network.SelectedNetworks {
for _, network := range c.Network.SelectedNetworks {
if strings.Contains(strings.ToUpper(network), "SIMULATED") {
isAnySimulated = true
break
}
}

if testConfig.Seth != nil && !isAnySimulated && (testConfig.Seth.EphemeralAddrs != nil && *testConfig.Seth.EphemeralAddrs != 0) {
testConfig.Seth.EphemeralAddrs = new(int64)
if c.Seth != nil && !isAnySimulated && (c.Seth.EphemeralAddrs != nil && *c.Seth.EphemeralAddrs != 0) {
c.Seth.EphemeralAddrs = new(int64)
logger.Warn().
Msg("Ephemeral addresses were enabled, but test was setup to run on a live network. Ephemeral addresses will be disabled.")
}

if testConfig.Seth != nil && (testConfig.Seth.EphemeralAddrs != nil && *testConfig.Seth.EphemeralAddrs != 0) {
rootBuffer := testConfig.Seth.RootKeyFundsBuffer
if c.Seth != nil && (c.Seth.EphemeralAddrs != nil && *c.Seth.EphemeralAddrs != 0) {
rootBuffer := c.Seth.RootKeyFundsBuffer
zero := int64(0)
if rootBuffer == nil {
rootBuffer = &zero
}
clNodeFunding := testConfig.Common.ChainlinkNodeFunding
clNodeFunding := c.Common.ChainlinkNodeFunding
if clNodeFunding == nil {
zero := 0.0
clNodeFunding = &zero
Expand All @@ -433,8 +443,20 @@ root_key_funds_buffer = 1_000
}
}

logger.Debug().Msg("Correct test config constructed successfully")
return testConfig, nil
var customChainSettings []string
for _, network := range networks.MustGetSelectedNetworkConfig(c.Network) {
if c.NodeConfig != nil && len(c.NodeConfig.ChainConfigTOMLByChainID) > 0 {
if _, ok := c.NodeConfig.ChainConfigTOMLByChainID[fmt.Sprint(network.ChainID)]; ok {
logger.Warn().Msgf("You have provided custom Chainlink Node configuration for network '%s' (chain id: %d). Chainlink Node's default settings won't be used", network.Name, network.ChainID)
customChainSettings = append(customChainSettings, fmt.Sprint(network.ChainID))
}
}
}

if len(customChainSettings) == 0 && c.NodeConfig != nil && c.NodeConfig.CommonChainConfigTOML != "" {
logger.Warn().Msg("***** You have provided your own default Chainlink Node configuration for all networks. Chainlink Node's default settings for selected networks won't be used *****")
}

}

func (c *TestConfig) readNetworkConfiguration() error {
Expand Down

0 comments on commit 858ae91

Please sign in to comment.