Skip to content

Commit

Permalink
Revert "[TT-1209] use the same CL node config in k8s as in docker (#1…
Browse files Browse the repository at this point in the history
…3411)"

This reverts commit e61d256.
  • Loading branch information
ferglor committed Jul 4, 2024
1 parent 145fe5e commit c319432
Show file tree
Hide file tree
Showing 28 changed files with 357 additions and 672 deletions.
31 changes: 10 additions & 21 deletions integration-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,35 +143,20 @@ test_node_migrations_simulated_verbose:
go test -timeout 1h -count=1 -v $(args) ./migration

# Soak
.PHONY: test_soak_ocr1
test_soak_ocr1:
.PHONY: test_soak_ocr
test_soak_ocr:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run TestOCRv1Soak ./soak

.PHONY: test_soak_ocr2
test_soak_ocr2:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run TestOCRv2Soak ./soak

.PHONY: test_soak_forwarder_ocr1
test_soak_forwarder_ocr1:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run TestForwarderOCRv1Soak ./soak

.PHONY: test_soak_forwarder_ocr2
test_soak_forwarder_ocr2:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run TestForwarderOCRv2Soak ./soak
go test -v -count=1 -run ^TestOCRSoak$$ ./soak

.PHONY: test_soak_ocr_reorg_1
test_soak_ocr_reorg_1:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run ^TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled$$ ./soak
go test -v -count=1 -run ^TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled$$ ./soak

.PHONY: test_soak_ocr_reorg_2
test_soak_ocr_reorg_2:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run ^TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled$$ ./soak
go test -v -count=1 -run ^TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled$$ ./soak

.PHONY: test_soak_ocr_gas_spike
test_soak_ocr_gas_spike:
Expand All @@ -193,6 +178,10 @@ test_soak_ocr_rpc_down_half_cl_nodes:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run ^TestOCRSoak_RPCDownForHalfCLNodes$$ ./soak

.PHONY: test_soak_forwarder_ocr
test_soak_forwarder_ocr:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run TestForwarderOCRSoak ./soak

.PHONY: test_soak_automation
test_soak_automation:
Expand Down Expand Up @@ -237,4 +226,4 @@ run_test_with_local_image: build_docker_image
# removes all occurrences of .run.id file in current folder and it's subdirectories
# before making any changes lists all file locations and awaits user confirmation
remove_test_execution_artefacts:
./scripts/search_and_delete.sh .run.id
./scripts/search_and_delete.sh .run.id
39 changes: 3 additions & 36 deletions integration-tests/actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"testing"
"time"

"github.com/pelletier/go-toml/v2"

geth "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/rpc"
Expand All @@ -25,13 +23,12 @@ import (
"github.com/smartcontractkit/chainlink-testing-framework/testreporters"
"github.com/smartcontractkit/chainlink-testing-framework/utils/conversions"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
ethContracts "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum"
"github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum"

"github.com/ethereum/go-ethereum/accounts/abi"

"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"

"github.com/rs/zerolog"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -42,11 +39,8 @@ import (
"github.com/pkg/errors"
"github.com/test-go/testify/require"

ctfconfig "github.com/smartcontractkit/chainlink-testing-framework/config"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"

"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/types/config/node"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/operator_factory"
)
Expand Down Expand Up @@ -1075,7 +1069,7 @@ func SendLinkFundsToDeploymentAddresses(

// GenerateUpkeepReport generates a report of performed, successful, reverted and stale upkeeps for a given registry contract based on transaction logs. In case of test failure it can help us
// to triage the issue by providing more context.
func GenerateUpkeepReport(t *testing.T, chainClient *seth.Client, startBlock, endBlock *big.Int, instance contracts.KeeperRegistry, registryVersion ethContracts.KeeperRegistryVersion) (performedUpkeeps, successfulUpkeeps, revertedUpkeeps, staleUpkeeps int, err error) {
func GenerateUpkeepReport(t *testing.T, chainClient *seth.Client, startBlock, endBlock *big.Int, instance contracts.KeeperRegistry, registryVersion ethereum.KeeperRegistryVersion) (performedUpkeeps, successfulUpkeeps, revertedUpkeeps, staleUpkeeps int, err error) {
registryLogs := []gethtypes.Log{}
l := logging.GetTestLogger(t)

Expand Down Expand Up @@ -1156,7 +1150,7 @@ func GenerateUpkeepReport(t *testing.T, chainClient *seth.Client, startBlock, en
return
}

func GetStalenessReportCleanupFn(t *testing.T, logger zerolog.Logger, chainClient *seth.Client, startBlock uint64, registry contracts.KeeperRegistry, registryVersion ethContracts.KeeperRegistryVersion) func() {
func GetStalenessReportCleanupFn(t *testing.T, logger zerolog.Logger, chainClient *seth.Client, startBlock uint64, registry contracts.KeeperRegistry, registryVersion ethereum.KeeperRegistryVersion) func() {
return func() {
if t.Failed() {
endBlock, err := chainClient.Client.BlockNumber(context.Background())
Expand All @@ -1172,30 +1166,3 @@ func GetStalenessReportCleanupFn(t *testing.T, logger zerolog.Logger, chainClien
}
}
}

func BuildTOMLNodeConfigForK8s(testConfig ctfconfig.GlobalTestConfig, testNetwork blockchain.EVMNetwork) (string, error) {
nodeConfigInToml := testConfig.GetNodeConfig()

nodeConfig, _, err := node.BuildChainlinkNodeConfig(
[]blockchain.EVMNetwork{testNetwork},
nodeConfigInToml.BaseConfigTOML,
nodeConfigInToml.CommonChainConfigTOML,
nodeConfigInToml.ChainConfigTOMLByChainID,
)

if err != nil {
return "", err
}

if testConfig.GetPyroscopeConfig() != nil && *testConfig.GetPyroscopeConfig().Enabled {
nodeConfig.Pyroscope.Environment = testConfig.GetPyroscopeConfig().Environment
nodeConfig.Pyroscope.ServerAddress = testConfig.GetPyroscopeConfig().ServerUrl
}

asStr, err := toml.Marshal(nodeConfig)
if err != nil {
return "", err
}

return string(asStr), nil
}
8 changes: 5 additions & 3 deletions integration-tests/actions/vrf/common/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ import (
"testing"
"time"

"github.com/ethereum/go-ethereum/common"
seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/go-resty/resty/v2"

"github.com/ethereum/go-ethereum/common"
"github.com/google/uuid"
"github.com/rs/zerolog"

"github.com/smartcontractkit/seth"

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/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
Expand Down
36 changes: 32 additions & 4 deletions integration-tests/benchmark/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,34 @@ import (
)

var (
keeperBenchmarkBaseTOML = `[Feature]
LogPoller = true
[OCR2]
Enabled = true
[P2P]
[P2P.V2]
Enabled = true
AnnounceAddresses = ["0.0.0.0:6690"]
ListenAddresses = ["0.0.0.0:6690"]
[Keeper]
TurnLookBack = 0
[WebServer]
HTTPWriteTimeout = '1h'`

simulatedEVMNonDevTOML = `
Enabled = true
FinalityDepth = 50
LogPollInterval = '1s'
[EVM.HeadTracker]
HistoryDepth = 100
[EVM.GasEstimator]
Mode = 'FixedPrice'
LimitDefault = 5_000_000`

performanceChainlinkResources = map[string]interface{}{
"resources": map[string]interface{}{
"requests": map[string]interface{}{
Expand Down Expand Up @@ -294,6 +322,8 @@ func SetupAutomationBenchmarkEnv(t *testing.T, keeperTestConfig types.KeeperBenc
l := logging.GetTestLogger(t)
testNetwork := networks.MustGetSelectedNetworkConfig(keeperTestConfig.GetNetworkConfig())[0] // Environment currently being used to run benchmark test on
blockTime := "1"
networkDetailTOML := `MinIncomingConfirmations = 1`

numberOfNodes := *keeperTestConfig.GetKeeperConfig().Common.NumberOfNodes

if strings.Contains(*keeperTestConfig.GetKeeperConfig().Common.RegistryToTest, "2_") {
Expand Down Expand Up @@ -325,6 +355,7 @@ func SetupAutomationBenchmarkEnv(t *testing.T, keeperTestConfig types.KeeperBenc

// Test can run on simulated, simulated-non-dev, testnets
if testNetwork.Name == networks.SimulatedEVMNonDev.Name {
networkDetailTOML = simulatedEVMNonDevTOML
testEnvironment.
AddHelm(reorg.New(&reorg.Props{
NetworkName: testNetwork.Name,
Expand Down Expand Up @@ -416,11 +447,8 @@ func SetupAutomationBenchmarkEnv(t *testing.T, keeperTestConfig types.KeeperBenc
ctf_config.MightConfigOverridePyroscopeKey(keeperTestConfig.GetPyroscopeConfig(), target)
}

tomlConfig, err := actions.BuildTOMLNodeConfigForK8s(keeperTestConfig, testNetwork)
require.NoError(t, err, "Error building TOML config")

cd := chainlink.NewWithOverride(i, map[string]any{
"toml": tomlConfig,
"toml": networks.AddNetworkDetailedConfig(keeperBenchmarkBaseTOML, keeperTestConfig.GetPyroscopeConfig(), networkDetailTOML, testNetwork),
"chainlink": chainlinkResources,
"db": dbResources,
}, keeperTestConfig.GetChainlinkImageConfig(), overrideFn)
Expand Down
25 changes: 14 additions & 11 deletions integration-tests/chaos/ocr2vrf_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/config"
tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig"
)

Expand All @@ -37,14 +38,16 @@ func TestOCR2VRFChaos(t *testing.T) {
t.Fatal(err)
}

loadedNetwork := networks.MustGetSelectedNetworkConfig(testConfig.Network)[0]

tomlConfig, err := actions.BuildTOMLNodeConfigForK8s(&testConfig, loadedNetwork)
require.NoError(t, err, "Error building TOML config")
loadedNetwork := networks.MustGetSelectedNetworkConfig(testconfig.Network)[0]

defaultOCR2VRFSettings := map[string]interface{}{
"replicas": 6,
"toml": tomlConfig,
"toml": networks.AddNetworkDetailedConfig(
config.BaseOCR2Config,
testconfig.Pyroscope,
config.DefaultOCR2VRFNetworkDetailTomlConfig,
loadedNetwork,
),
}

defaultOCR2VRFEthereumSettings := &ethereum.Props{
Expand All @@ -54,11 +57,11 @@ func TestOCR2VRFChaos(t *testing.T) {
}

var overrideFn = func(_ interface{}, target interface{}) {
ctf_config.MustConfigOverrideChainlinkVersion(testConfig.GetChainlinkImageConfig(), target)
ctf_config.MightConfigOverridePyroscopeKey(testConfig.GetPyroscopeConfig(), target)
ctf_config.MustConfigOverrideChainlinkVersion(testconfig.GetChainlinkImageConfig(), target)
ctf_config.MightConfigOverridePyroscopeKey(testconfig.GetPyroscopeConfig(), target)
}

chainlinkCfg := chainlink.NewWithOverride(0, defaultOCR2VRFSettings, testConfig.ChainlinkImage, overrideFn)
chainlinkCfg := chainlink.NewWithOverride(0, defaultOCR2VRFSettings, testconfig.ChainlinkImage, overrideFn)

testCases := map[string]struct {
networkChart environment.ConnectedChart
Expand Down Expand Up @@ -131,7 +134,7 @@ func TestOCR2VRFChaos(t *testing.T) {
testCase := tc
t.Run(fmt.Sprintf("OCR2VRF_%s", testCaseName), func(t *testing.T) {
t.Parallel()
testNetwork := networks.MustGetSelectedNetworkConfig(testConfig.Network)[0] // Need a new copy of the network for each test
testNetwork := networks.MustGetSelectedNetworkConfig(testconfig.Network)[0] // Need a new copy of the network for each test
testEnvironment := environment.
New(&environment.Config{
NamespacePrefix: fmt.Sprintf(
Expand All @@ -153,7 +156,7 @@ func TestOCR2VRFChaos(t *testing.T) {
require.NoError(t, err)

testNetwork = seth_utils.MustReplaceSimulatedNetworkUrlWithK8(l, testNetwork, *testEnvironment)
chainClient, err := seth_utils.GetChainClientWithConfigFunction(testConfig, testNetwork, seth_utils.OneEphemeralKeysLiveTestnetCheckFn)
chainClient, err := seth_utils.GetChainClientWithConfigFunction(testconfig, testNetwork, seth_utils.OneEphemeralKeysLiveTestnetCheckFn)
require.NoError(t, err, "Error creating seth client")

chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment)
Expand All @@ -162,7 +165,7 @@ func TestOCR2VRFChaos(t *testing.T) {
require.NoError(t, err, "Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail")

t.Cleanup(func() {
err := actions.TeardownSuite(t, chainClient, testEnvironment, chainlinkNodes, nil, zapcore.PanicLevel, &testConfig)
err := actions.TeardownSuite(t, chainClient, testEnvironment, chainlinkNodes, nil, zapcore.PanicLevel, &testconfig)
require.NoError(t, err, "Error tearing down environment")
})

Expand Down
12 changes: 6 additions & 6 deletions integration-tests/chaos/ocr_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ var (
chaosEndRound int64 = 4
)

func getDefaultOcrSettings(config *tc.TestConfig) map[string]interface{} {
defaultOCRSettings["toml"] = networks.AddNetworksConfig(baseTOML, config.Pyroscope, networks.MustGetSelectedNetworkConfig(config.Network)[0])
return defaultAutomationSettings
}

func TestOCRChaos(t *testing.T) {
t.Parallel()
l := logging.GetTestLogger(t)
Expand All @@ -62,12 +67,7 @@ func TestOCRChaos(t *testing.T) {
ctf_config.MightConfigOverridePyroscopeKey(config.GetPyroscopeConfig(), target)
}

tomlConfig, err := actions.BuildTOMLNodeConfigForK8s(&config, networks.MustGetSelectedNetworkConfig(config.Network)[0])
require.NoError(t, err, "Error building TOML config")

defaultOCRSettings["toml"] = tomlConfig

chainlinkCfg := chainlink.NewWithOverride(0, defaultOCRSettings, config.ChainlinkImage, overrideFn)
chainlinkCfg := chainlink.NewWithOverride(0, getDefaultOcrSettings(&config), config.ChainlinkImage, overrideFn)

testCases := map[string]struct {
networkChart environment.ConnectedChart
Expand Down
Loading

0 comments on commit c319432

Please sign in to comment.