From 12ff0e6dabfd52333bf4ebdc3f1725f5c4172ba7 Mon Sep 17 00:00:00 2001 From: Lukasz <120112546+lukaszcl@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:42:05 +0200 Subject: [PATCH] Update CTF and SELECTED_NETWORKS env in E2E tests (#11103) * Update CTF and SELECTED_NETWORKS env * Update go mod --- integration-tests/benchmark/keeper_test.go | 2 +- integration-tests/chaos/automation_chaos_test.go | 11 ++++++----- integration-tests/chaos/ocr2vrf_chaos_test.go | 4 ++-- integration-tests/chaos/ocr_chaos_test.go | 2 +- integration-tests/docker/test_env/test_env_builder.go | 2 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/functions/setup.go | 2 +- integration-tests/performance/cron_test.go | 2 +- integration-tests/performance/directrequest_test.go | 2 +- integration-tests/performance/flux_test.go | 2 +- integration-tests/performance/keeper_test.go | 2 +- integration-tests/performance/ocr_test.go | 2 +- integration-tests/performance/vrf_test.go | 2 +- integration-tests/reorg/automation_reorg_test.go | 4 ++-- integration-tests/smoke/automation_test.go | 8 ++++---- integration-tests/smoke/ocr2_test.go | 2 +- integration-tests/smoke/ocr2vrf_test.go | 2 +- integration-tests/testsetups/ocr.go | 8 ++++---- 19 files changed, 33 insertions(+), 32 deletions(-) diff --git a/integration-tests/benchmark/keeper_test.go b/integration-tests/benchmark/keeper_test.go index 7178ab854ea..ed26caf4704 100644 --- a/integration-tests/benchmark/keeper_test.go +++ b/integration-tests/benchmark/keeper_test.go @@ -299,7 +299,7 @@ func getEnv(key, fallback string) string { func SetupAutomationBenchmarkEnv(t *testing.T) (*environment.Environment, blockchain.EVMNetwork) { l := logging.GetTestLogger(t) - testNetwork := networks.SelectedNetwork // Environment currently being used to run benchmark test on + testNetwork := networks.MustGetSelectedNetworksFromEnv()[0] // Environment currently being used to run benchmark test on blockTime := "1" networkDetailTOML := `MinIncomingConfirmations = 1` diff --git a/integration-tests/chaos/automation_chaos_test.go b/integration-tests/chaos/automation_chaos_test.go index 244f6c36ea9..62f85d3256d 100644 --- a/integration-tests/chaos/automation_chaos_test.go +++ b/integration-tests/chaos/automation_chaos_test.go @@ -43,7 +43,7 @@ ListenAddresses = ["0.0.0.0:6690"]` defaultAutomationSettings = map[string]interface{}{ "replicas": 6, - "toml": client.AddNetworksConfig(baseTOML, networks.SelectedNetwork), + "toml": client.AddNetworksConfig(baseTOML, networks.MustGetSelectedNetworksFromEnv()[0]), "db": map[string]interface{}{ "stateful": true, "capacity": "1Gi", @@ -61,9 +61,10 @@ ListenAddresses = ["0.0.0.0:6690"]` } defaultEthereumSettings = ðereum.Props{ - NetworkName: networks.SelectedNetwork.Name, - Simulated: networks.SelectedNetwork.Simulated, - WsURLs: networks.SelectedNetwork.URLs, + // utils.MustGetSelectedNetworksFromEnv() + NetworkName: networks.MustGetSelectedNetworksFromEnv()[0].Name, + Simulated: networks.MustGetSelectedNetworksFromEnv()[0].Simulated, + WsURLs: networks.MustGetSelectedNetworksFromEnv()[0].URLs, Values: map[string]interface{}{ "resources": map[string]interface{}{ "requests": map[string]interface{}{ @@ -182,7 +183,7 @@ func TestAutomationChaos(t *testing.T) { testCase := tst t.Run(fmt.Sprintf("Automation_%s", name), func(t *testing.T) { t.Parallel() - network := networks.SelectedNetwork // Need a new copy of the network for each test + network := networks.MustGetSelectedNetworksFromEnv()[0] // Need a new copy of the network for each test testEnvironment := environment. New(&environment.Config{ diff --git a/integration-tests/chaos/ocr2vrf_chaos_test.go b/integration-tests/chaos/ocr2vrf_chaos_test.go index 1d7f61f783c..cbab1bf9e78 100644 --- a/integration-tests/chaos/ocr2vrf_chaos_test.go +++ b/integration-tests/chaos/ocr2vrf_chaos_test.go @@ -31,7 +31,7 @@ import ( func TestOCR2VRFChaos(t *testing.T) { t.Parallel() l := logging.GetTestLogger(t) - loadedNetwork := networks.SelectedNetwork + loadedNetwork := networks.MustGetSelectedNetworksFromEnv()[0] defaultOCR2VRFSettings := map[string]interface{}{ "replicas": 6, @@ -119,7 +119,7 @@ func TestOCR2VRFChaos(t *testing.T) { testCase := tc t.Run(fmt.Sprintf("OCR2VRF_%s", testCaseName), func(t *testing.T) { t.Parallel() - testNetwork := networks.SelectedNetwork // Need a new copy of the network for each test + testNetwork := networks.MustGetSelectedNetworksFromEnv()[0] // Need a new copy of the network for each test testEnvironment := environment. New(&environment.Config{ NamespacePrefix: fmt.Sprintf( diff --git a/integration-tests/chaos/ocr_chaos_test.go b/integration-tests/chaos/ocr_chaos_test.go index f3ee12046fb..0d72e3932e7 100644 --- a/integration-tests/chaos/ocr_chaos_test.go +++ b/integration-tests/chaos/ocr_chaos_test.go @@ -53,7 +53,7 @@ var ( ) func TestMain(m *testing.M) { - defaultOCRSettings["toml"] = client.AddNetworksConfig(config.BaseOCRP2PV1Config, networks.SelectedNetwork) + defaultOCRSettings["toml"] = client.AddNetworksConfig(config.BaseOCRP2PV1Config, networks.MustGetSelectedNetworksFromEnv()[0]) os.Exit(m.Run()) } diff --git a/integration-tests/docker/test_env/test_env_builder.go b/integration-tests/docker/test_env/test_env_builder.go index 072728321bf..d1550240500 100644 --- a/integration-tests/docker/test_env/test_env_builder.go +++ b/integration-tests/docker/test_env/test_env_builder.go @@ -238,7 +238,7 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { } return b.te, nil } - networkConfig := networks.SelectedNetwork + networkConfig := networks.MustGetSelectedNetworksFromEnv()[0] var internalDockerUrls test_env.InternalDockerUrls if b.hasGeth && networkConfig.Simulated { networkConfig, internalDockerUrls, err = b.te.StartGeth() diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 7dd2d017785..7683a966920 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -21,7 +21,7 @@ require ( github.com/segmentio/ksuid v1.0.4 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-env v0.38.3 - github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231018101901-23824db88d36 + github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231027132403-4898f11e80b6 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20231020123319-d255366a6545 github.com/smartcontractkit/ocr2keepers v0.7.27 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 3be74077277..d280310b9f2 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2370,8 +2370,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab0 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05/go.mod h1:o0Pn1pbaUluboaK6/yhf8xf7TiFCkyFl6WUOdwqamuU= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231024133459-1ef3a11319eb h1:HiluOfEVGOQTM6BTDImOqYdMZZ7qq7fkZ3TJdmItNr8= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231024133459-1ef3a11319eb/go.mod h1:/30flFG4L/iCYAFeA3DUzR0xuHSxAMONiWTzyzvsNwo= -github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231018101901-23824db88d36 h1:ow84QG8vEHMvfjGg0RF8HNYh80WcHci6PIenXyY6K8Y= -github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231018101901-23824db88d36/go.mod h1:RWlmjwnjIGbQAnRfKwe02Ife82nNI3rZmdI0zgkfbyk= +github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231027132403-4898f11e80b6 h1:f1nUQ/1eUTMwNbOZK0P7P6OHvTDGQSn2KE+LtwY0rXA= +github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231027132403-4898f11e80b6/go.mod h1:RWlmjwnjIGbQAnRfKwe02Ife82nNI3rZmdI0zgkfbyk= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= diff --git a/integration-tests/load/functions/setup.go b/integration-tests/load/functions/setup.go index 5d44cbc698e..5253c531eee 100644 --- a/integration-tests/load/functions/setup.go +++ b/integration-tests/load/functions/setup.go @@ -50,7 +50,7 @@ type S4SecretsCfg struct { } func SetupLocalLoadTestEnv(cfg *PerformanceConfig) (*FunctionsTest, error) { - bc, err := blockchain.NewEVMClientFromNetwork(networks.SelectedNetwork, log.Logger) + bc, err := blockchain.NewEVMClientFromNetwork(networks.MustGetSelectedNetworksFromEnv()[0], log.Logger) if err != nil { return nil, err } diff --git a/integration-tests/performance/cron_test.go b/integration-tests/performance/cron_test.go index 959cb0fa3e1..84a49646474 100644 --- a/integration-tests/performance/cron_test.go +++ b/integration-tests/performance/cron_test.go @@ -109,7 +109,7 @@ func TestCronPerformance(t *testing.T) { func setupCronTest(t *testing.T) (testEnvironment *environment.Environment) { logging.Init() - network := networks.SelectedNetwork + network := networks.MustGetSelectedNetworksFromEnv()[0] evmConfig := ethereum.New(nil) if !network.Simulated { evmConfig = ethereum.New(ðereum.Props{ diff --git a/integration-tests/performance/directrequest_test.go b/integration-tests/performance/directrequest_test.go index 4ff2b856195..faaac5910d2 100644 --- a/integration-tests/performance/directrequest_test.go +++ b/integration-tests/performance/directrequest_test.go @@ -129,7 +129,7 @@ func TestDirectRequestPerformance(t *testing.T) { } func setupDirectRequestTest(t *testing.T) (testEnvironment *environment.Environment) { - network := networks.SelectedNetwork + network := networks.MustGetSelectedNetworksFromEnv()[0] evmConfig := ethereum.New(nil) if !network.Simulated { evmConfig = ethereum.New(ðereum.Props{ diff --git a/integration-tests/performance/flux_test.go b/integration-tests/performance/flux_test.go index 3f9db27c106..df3022003e1 100644 --- a/integration-tests/performance/flux_test.go +++ b/integration-tests/performance/flux_test.go @@ -173,7 +173,7 @@ func TestFluxPerformance(t *testing.T) { } func setupFluxTest(t *testing.T) (testEnvironment *environment.Environment, testNetwork blockchain.EVMNetwork) { - testNetwork = networks.SelectedNetwork + testNetwork = networks.MustGetSelectedNetworksFromEnv()[0] evmConf := ethereum.New(nil) if !testNetwork.Simulated { evmConf = ethereum.New(ðereum.Props{ diff --git a/integration-tests/performance/keeper_test.go b/integration-tests/performance/keeper_test.go index 08ea95b4340..7a2cc933de2 100644 --- a/integration-tests/performance/keeper_test.go +++ b/integration-tests/performance/keeper_test.go @@ -134,7 +134,7 @@ func setupKeeperTest( contracts.ContractDeployer, contracts.LinkToken, ) { - network := networks.SelectedNetwork + network := networks.MustGetSelectedNetworksFromEnv()[0] evmConfig := eth.New(nil) if !network.Simulated { evmConfig = eth.New(ð.Props{ diff --git a/integration-tests/performance/ocr_test.go b/integration-tests/performance/ocr_test.go index b18d7f1f791..1db030f1cce 100644 --- a/integration-tests/performance/ocr_test.go +++ b/integration-tests/performance/ocr_test.go @@ -90,7 +90,7 @@ func TestOCRBasic(t *testing.T) { } func setupOCRTest(t *testing.T) (testEnvironment *environment.Environment, testNetwork blockchain.EVMNetwork) { - testNetwork = networks.SelectedNetwork + testNetwork = networks.MustGetSelectedNetworksFromEnv()[0] evmConfig := ethereum.New(nil) if !testNetwork.Simulated { evmConfig = ethereum.New(ðereum.Props{ diff --git a/integration-tests/performance/vrf_test.go b/integration-tests/performance/vrf_test.go index 510e378eb82..c715641692d 100644 --- a/integration-tests/performance/vrf_test.go +++ b/integration-tests/performance/vrf_test.go @@ -135,7 +135,7 @@ func TestVRFBasic(t *testing.T) { } func setupVRFTest(t *testing.T) (testEnvironment *environment.Environment, testNetwork blockchain.EVMNetwork) { - testNetwork = networks.SelectedNetwork + testNetwork = networks.MustGetSelectedNetworksFromEnv()[0] evmConfig := ethereum.New(nil) if !testNetwork.Simulated { evmConfig = ethereum.New(ðereum.Props{ diff --git a/integration-tests/reorg/automation_reorg_test.go b/integration-tests/reorg/automation_reorg_test.go index e94e5c28538..a1260cc37ac 100644 --- a/integration-tests/reorg/automation_reorg_test.go +++ b/integration-tests/reorg/automation_reorg_test.go @@ -48,7 +48,7 @@ HistoryDepth = 400 [EVM.GasEstimator] Mode = 'FixedPrice' LimitDefault = 5_000_000` - activeEVMNetwork = networks.SelectedNetwork + activeEVMNetwork = networks.MustGetSelectedNetworksFromEnv()[0] defaultAutomationSettings = map[string]interface{}{ "toml": client.AddNetworkDetailedConfig(baseTOML, networkTOML, activeEVMNetwork), "db": map[string]interface{}{ @@ -135,7 +135,7 @@ func TestAutomationReorg(t *testing.T) { for name, registryVersion := range registryVersions { t.Run(name, func(t *testing.T) { t.Parallel() - network := networks.SelectedNetwork + network := networks.MustGetSelectedNetworksFromEnv()[0] defaultAutomationSettings["replicas"] = numberOfNodes cd := chainlink.New(0, defaultAutomationSettings) diff --git a/integration-tests/smoke/automation_test.go b/integration-tests/smoke/automation_test.go index 834de5ce481..3addac1b9d1 100644 --- a/integration-tests/smoke/automation_test.go +++ b/integration-tests/smoke/automation_test.go @@ -79,9 +79,9 @@ var ( func TestMain(m *testing.M) { logging.Init() - fmt.Printf("Running Smoke Test on %s\n", networks.SelectedNetwork.Name) // Print to get around disabled logging - fmt.Printf("Chainlink Image %s\n", os.Getenv("CHAINLINK_IMAGE")) // Print to get around disabled logging - fmt.Printf("Chainlink Version %s\n", os.Getenv("CHAINLINK_VERSION")) // Print to get around disabled logging + fmt.Printf("Running Smoke Test on %s\n", networks.MustGetSelectedNetworksFromEnv()[0].Name) // Print to get around disabled logging + fmt.Printf("Chainlink Image %s\n", os.Getenv("CHAINLINK_IMAGE")) // Print to get around disabled logging + fmt.Printf("Chainlink Version %s\n", os.Getenv("CHAINLINK_VERSION")) // Print to get around disabled logging os.Exit(m.Run()) } @@ -1028,7 +1028,7 @@ func setupAutomationTestDocker( l := logging.GetTestLogger(t) // Add registry version to config registryConfig.RegistryVersion = registryVersion - network := networks.SelectedNetwork + network := networks.MustGetSelectedNetworksFromEnv()[0] // build the node config clNodeConfig := node.NewConfig(node.NewBaseConfig()) diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index d82d84a2072..582ca17f7b6 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -107,7 +107,7 @@ func setupOCR2Test(t *testing.T, forwardersEnabled bool) ( testEnvironment *environment.Environment, testNetwork blockchain.EVMNetwork, ) { - testNetwork = networks.SelectedNetwork + testNetwork = networks.MustGetSelectedNetworksFromEnv()[0] evmConfig := ethereum.New(nil) if !testNetwork.Simulated { evmConfig = ethereum.New(ðereum.Props{ diff --git a/integration-tests/smoke/ocr2vrf_test.go b/integration-tests/smoke/ocr2vrf_test.go index 81488639187..8c102f6fd21 100644 --- a/integration-tests/smoke/ocr2vrf_test.go +++ b/integration-tests/smoke/ocr2vrf_test.go @@ -149,7 +149,7 @@ func TestOCR2VRFFulfillmentModel(t *testing.T) { } func setupOCR2VRFEnvironment(t *testing.T) (testEnvironment *environment.Environment, testNetwork blockchain.EVMNetwork) { - testNetwork = networks.SelectedNetwork + testNetwork = networks.MustGetSelectedNetworksFromEnv()[0] evmConfig := eth.New(nil) if !testNetwork.Simulated { evmConfig = eth.New(ð.Props{ diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index 048f3124ad9..c4b1fc7ab1e 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -126,7 +126,7 @@ func NewOCRSoakTest(t *testing.T, forwarderFlow bool) (*OCRSoakTest, error) { // DeployEnvironment deploys the test environment, starting all Chainlink nodes and other components for the test func (o *OCRSoakTest) DeployEnvironment(customChainlinkNetworkTOML string) { - network := networks.SelectedNetwork // Environment currently being used to soak test on + network := networks.MustGetSelectedNetworksFromEnv()[0] // Environment currently being used to soak test on nsPre := "soak-ocr-" if o.OperatorForwarderFlow { nsPre = fmt.Sprintf("%sforwarder-", nsPre) @@ -165,7 +165,7 @@ func (o *OCRSoakTest) DeployEnvironment(customChainlinkNetworkTOML string) { // LoadEnvironment loads an existing test environment using the provided URLs func (o *OCRSoakTest) LoadEnvironment(chainlinkURLs []string, chainURL, mockServerURL string) { var ( - network = networks.SelectedNetwork + network = networks.MustGetSelectedNetworksFromEnv()[0] err error ) o.chainClient, err = blockchain.ConnectEVMClient(network, o.log) @@ -185,7 +185,7 @@ func (o *OCRSoakTest) Environment() *environment.Environment { func (o *OCRSoakTest) Setup() { var ( err error - network = networks.SelectedNetwork + network = networks.MustGetSelectedNetworksFromEnv()[0] ) // Environment currently being used to soak test on @@ -387,7 +387,7 @@ func (o *OCRSoakTest) LoadState() error { o.startTime = testState.StartTime o.startingBlockNum = testState.StartingBlockNum - network := networks.SelectedNetwork + network := networks.MustGetSelectedNetworksFromEnv()[0] o.chainClient, err = blockchain.ConnectEVMClient(network, o.log) if err != nil { return err