diff --git a/.changeset/chilly-stingrays-press.md b/.changeset/chilly-stingrays-press.md new file mode 100644 index 00000000000..1fe2e80f2b0 --- /dev/null +++ b/.changeset/chilly-stingrays-press.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +Removing ccip-tests/\* dependencies and moving ccip tests under a directory in smoke diff --git a/.github/e2e-tests.yml b/.github/e2e-tests.yml index a3947c61f75..d6eec77b534 100644 --- a/.github/e2e-tests.yml +++ b/.github/e2e-tests.yml @@ -935,8 +935,8 @@ runner-test-matrix: # START: CCIPv1.6 tests - - id: smoke/ccip_test.go:* - path: integration-tests/smoke/ccip_test.go + - id: smoke/ccip/ccip_test.go:* + path: integration-tests/smoke/ccip/ccip_test.go test_env_type: docker runs_on: ubuntu-latest triggers: @@ -949,8 +949,8 @@ runner-test-matrix: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 E2E_JD_VERSION: 0.6.0 - - id: smoke/ccip_messaging_test.go:* - path: integration-tests/smoke/ccip_messaging_test.go + - id: smoke/ccip/ccip_messaging_test.go:* + path: integration-tests/smoke/ccip/ccip_messaging_test.go test_env_type: docker runs_on: ubuntu-latest triggers: @@ -963,8 +963,8 @@ runner-test-matrix: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 E2E_JD_VERSION: 0.4.0 - - id: smoke/ccip_usdc_test.go:* - path: integration-tests/smoke/ccip_usdc_test.go + - id: smoke/ccip/ccip_usdc_test.go:* + path: integration-tests/smoke/ccip/ccip_usdc_test.go test_env_type: docker runs_on: ubuntu-latest triggers: @@ -977,29 +977,29 @@ runner-test-matrix: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 E2E_JD_VERSION: 0.4.0 - - id: smoke/fee_boosting_test.go:* - path: integration-tests/smoke/fee_boosting_test.go + - id: smoke/ccip/fee_boosting_test.go:* + path: integration-tests/smoke/ccip/fee_boosting_test.go test_env_type: docker runs_on: ubuntu-latest triggers: - PR E2E Core Tests - Merge Queue E2E Core Tests - Nightly E2E Tests - test_cmd: cd integration-tests/ && go test smoke/fee_boosting_test.go -timeout 15m -test.parallel=1 -count=1 -json + test_cmd: cd integration-tests/smoke/ccip && go test fee_boosting_test.go -timeout 15m -test.parallel=1 -count=1 -json pyroscope_env: ci-smoke-ccipv1_6-evm-simulated test_env_vars: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 E2E_JD_VERSION: 0.4.0 - - id: smoke/ccip_rmn_test.go:^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$ - path: integration-tests/smoke/ccip_rmn_test.go + - id: smoke/ccip/ccip_rmn_test.go:^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$ + path: integration-tests/smoke/ccip/ccip_rmn_test.go test_env_type: docker runs_on: ubuntu-latest triggers: - PR E2E Core Tests - Merge Queue E2E Core Tests - Nightly E2E Tests - test_cmd: cd integration-tests/smoke && go test -test.run ^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$ -timeout 12m -test.parallel=1 -count=1 -json + test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_TwoMessagesOnTwoLanesIncludingBatching$ -timeout 12m -test.parallel=1 -count=1 -json pyroscope_env: ci-smoke-ccipv1_6-evm-simulated test_env_vars: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 @@ -1007,15 +1007,15 @@ runner-test-matrix: E2E_RMN_RAGEPROXY_VERSION: master-5208d09 E2E_RMN_AFN2PROXY_VERSION: master-5208d09 - - id: smoke/ccip_rmn_test.go:^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$ - path: integration-tests/smoke/ccip_rmn_test.go + - id: smoke/ccip/ccip_rmn_test.go:^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$ + path: integration-tests/smoke/ccip/ccip_rmn_test.go test_env_type: docker runs_on: ubuntu-latest triggers: - PR E2E Core Tests - Merge Queue E2E Core Tests - Nightly E2E Tests - test_cmd: cd integration-tests/smoke && go test -test.run ^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$ -timeout 12m -test.parallel=1 -count=1 -json + test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_MultipleMessagesOnOneLaneNoWaitForExec$ -timeout 12m -test.parallel=1 -count=1 -json pyroscope_env: ci-smoke-ccipv1_6-evm-simulated test_env_vars: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 @@ -1024,15 +1024,15 @@ runner-test-matrix: E2E_RMN_AFN2PROXY_VERSION: master-5208d09 # Enable after flaking issue is resolved -# - id: smoke/ccip_rmn_test.go:^TestRMN_NotEnoughObservers$ -# path: integration-tests/smoke/ccip_rmn_test.go +# - id: smoke/ccip/ccip_rmn_test.go:^TestRMN_NotEnoughObservers$ +# path: integration-tests/smoke/ccip/ccip_rmn_test.go # test_env_type: docker # runs_on: ubuntu-latest # triggers: # - PR E2E Core Tests # - Merge Queue E2E Core Tests # - Nightly E2E Tests -# test_cmd: cd integration-tests/smoke && go test -test.run ^TestRMN_NotEnoughObservers$ -timeout 12m -test.parallel=1 -count=1 -json +# test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_NotEnoughObservers$ -timeout 12m -test.parallel=1 -count=1 -json # pyroscope_env: ci-smoke-ccipv1_6-evm-simulated # test_env_vars: # E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 @@ -1040,15 +1040,15 @@ runner-test-matrix: # E2E_RMN_RAGEPROXY_VERSION: master-5208d09 # E2E_RMN_AFN2PROXY_VERSION: master-5208d09 - - id: smoke/ccip_rmn_test.go:^TestRMN_DifferentSigners$ - path: integration-tests/smoke/ccip_rmn_test.go + - id: smoke/ccip/ccip_rmn_test.go:^TestRMN_DifferentSigners$ + path: integration-tests/smoke/ccip/ccip_rmn_test.go test_env_type: docker runs_on: ubuntu-latest triggers: - PR E2E Core Tests - Merge Queue E2E Core Tests - Nightly E2E Tests - test_cmd: cd integration-tests/smoke && go test -test.run ^TestRMN_DifferentSigners$ -timeout 12m -test.parallel=1 -count=1 -json + test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_DifferentSigners$ -timeout 12m -test.parallel=1 -count=1 -json pyroscope_env: ci-smoke-ccipv1_6-evm-simulated test_env_vars: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 @@ -1057,15 +1057,15 @@ runner-test-matrix: E2E_RMN_AFN2PROXY_VERSION: master-5208d09 # Enable after flaking issue is resolved -# - id: smoke/ccip_rmn_test.go:^TestRMN_NotEnoughSigners$ -# path: integration-tests/smoke/ccip_rmn_test.go +# - id: smoke/ccip/ccip_rmn_test.go:^TestRMN_NotEnoughSigners$ +# path: integration-tests/smoke/ccip/ccip_rmn_test.go # test_env_type: docker # runs_on: ubuntu-latest # triggers: # - PR E2E Core Tests # - Merge Queue E2E Core Tests # - Nightly E2E Tests -# test_cmd: cd integration-tests/smoke && go test -test.run ^TestRMN_NotEnoughSigners$ -timeout 12m -test.parallel=1 -count=1 -json +# test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_NotEnoughSigners$ -timeout 12m -test.parallel=1 -count=1 -json # pyroscope_env: ci-smoke-ccipv1_6-evm-simulated # test_env_vars: # E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 @@ -1074,15 +1074,15 @@ runner-test-matrix: # E2E_RMN_AFN2PROXY_VERSION: master-5208d09 - - id: smoke/ccip_rmn_test.go:^TestRMN_DifferentRmnNodesForDifferentChains$ - path: integration-tests/smoke/ccip_rmn_test.go + - id: smoke/ccip/ccip_rmn_test.go:^TestRMN_DifferentRmnNodesForDifferentChains$ + path: integration-tests/smoke/ccip/ccip_rmn_test.go test_env_type: docker runs_on: ubuntu-latest triggers: - PR E2E Core Tests - Merge Queue E2E Core Tests - Nightly E2E Tests - test_cmd: cd integration-tests/smoke/ && go test -test.run ^TestRMN_DifferentRmnNodesForDifferentChains$ -timeout 12m -test.parallel=1 -count=1 -json + test_cmd: cd integration-tests/smoke/ccip && go test -test.run ^TestRMN_DifferentRmnNodesForDifferentChains$ -timeout 12m -test.parallel=1 -count=1 -json pyroscope_env: ci-smoke-ccipv1_6-evm-simulated test_env_vars: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 diff --git a/integration-tests/actions/ccip_helpers.go b/integration-tests/actions/ccip_helpers.go new file mode 100644 index 00000000000..e7f0bb2b5ea --- /dev/null +++ b/integration-tests/actions/ccip_helpers.go @@ -0,0 +1,44 @@ +package actions + +import ( + "fmt" + "github.com/rs/zerolog/log" + "net/http" + + ctfClient "github.com/smartcontractkit/chainlink-testing-framework/lib/client" + ctftestenv "github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env" +) + +// SetMockServerWithUSDCAttestation responds with a mock attestation for any msgHash +// The path is set with regex to match any path that starts with /v1/attestations +func SetMockServerWithUSDCAttestation( + killGrave *ctftestenv.Killgrave, + mockserver *ctfClient.MockserverClient, +) error { + path := "/v1/attestations" + response := struct { + Status string `json:"status"` + Attestation string `json:"attestation"` + Error string `json:"error"` + }{ + Status: "complete", + Attestation: "0x9049623e91719ef2aa63c55f357be2529b0e7122ae552c18aff8db58b4633c4d3920ff03d3a6d1ddf11f06bf64d7fd60d45447ac81f527ba628877dc5ca759651b08ffae25a6d3b1411749765244f0a1c131cbfe04430d687a2e12fd9d2e6dc08e118ad95d94ad832332cf3c4f7a4f3da0baa803b7be024b02db81951c0f0714de1b", + } + if killGrave == nil && mockserver == nil { + return fmt.Errorf("both killgrave and mockserver are nil") + } + log.Info().Str("path", path).Msg("setting attestation-api response for any msgHash") + if killGrave != nil { + err := killGrave.SetAnyValueResponse(fmt.Sprintf("%s/{_hash:.*}", path), []string{http.MethodGet}, response) + if err != nil { + return fmt.Errorf("failed to set killgrave server value: %w", err) + } + } + if mockserver != nil { + err := mockserver.SetAnyValueResponse(fmt.Sprintf("%s/.*", path), response) + if err != nil { + return fmt.Errorf("failed to set mockserver value: %w URL = %s", err, fmt.Sprintf("%s/%s/.*", mockserver.LocalURL(), path)) + } + } + return nil +} diff --git a/integration-tests/smoke/ccip_messaging_test.go b/integration-tests/smoke/ccip/ccip_messaging_test.go similarity index 98% rename from integration-tests/smoke/ccip_messaging_test.go rename to integration-tests/smoke/ccip/ccip_messaging_test.go index 4aa9ba34229..c13a48e2410 100644 --- a/integration-tests/smoke/ccip_messaging_test.go +++ b/integration-tests/smoke/ccip/ccip_messaging_test.go @@ -1,4 +1,4 @@ -package smoke +package ccip import ( "context" @@ -16,11 +16,11 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/merklemulti" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" jobv1 "github.com/smartcontractkit/chainlink-protos/job-distributor/v1/job" + "github.com/smartcontractkit/chainlink/integration-tests/testsetups" "github.com/smartcontractkit/chainlink/deployment" ccdeploy "github.com/smartcontractkit/chainlink/deployment/ccip" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testsetups" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" @@ -110,9 +110,9 @@ func Test_CCIPMessaging(t *testing.T) { var ( replayed bool nonce uint64 - sender = common.LeftPadBytes(e.Env.Chains[sourceChain].DeployerKey.From.Bytes(), 32) - out messagingTestCaseOutput - setup = testCaseSetup{ + sender = common.LeftPadBytes(e.Env.Chains[sourceChain].DeployerKey.From.Bytes(), 32) + out messagingTestCaseOutput + setup = testCaseSetup{ t: t, sender: sender, deployedEnv: e, diff --git a/integration-tests/smoke/ccip_rmn_test.go b/integration-tests/smoke/ccip/ccip_rmn_test.go similarity index 98% rename from integration-tests/smoke/ccip_rmn_test.go rename to integration-tests/smoke/ccip/ccip_rmn_test.go index e8e81688239..a4fbfb9ba1a 100644 --- a/integration-tests/smoke/ccip_rmn_test.go +++ b/integration-tests/smoke/ccip/ccip_rmn_test.go @@ -1,4 +1,4 @@ -package smoke +package ccip import ( "math/big" @@ -16,6 +16,7 @@ import ( jobv1 "github.com/smartcontractkit/chainlink-protos/job-distributor/v1/job" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/osutil" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" + "github.com/smartcontractkit/chainlink/integration-tests/testsetups" "github.com/smartcontractkit/chainlink/deployment" ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip" @@ -23,7 +24,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_remote" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" - "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testsetups" "github.com/smartcontractkit/chainlink/v2/core/logger" ) @@ -446,9 +446,9 @@ type rmnTestCase struct { // If set to 0, the test will wait for commit reports. // If set to a positive value, the test will wait for that duration and will assert that commit report was not delivered. passIfNoCommitAfter time.Duration - waitForExec bool - homeChainConfig homeChainConfig - remoteChainsConfig []remoteChainConfig - rmnNodes []rmnNode - messagesToSend []messageToSend + waitForExec bool + homeChainConfig homeChainConfig + remoteChainsConfig []remoteChainConfig + rmnNodes []rmnNode + messagesToSend []messageToSend } diff --git a/integration-tests/smoke/ccip_test.go b/integration-tests/smoke/ccip/ccip_test.go similarity index 98% rename from integration-tests/smoke/ccip_test.go rename to integration-tests/smoke/ccip/ccip_test.go index 007a3c37e52..a2adf51358c 100644 --- a/integration-tests/smoke/ccip_test.go +++ b/integration-tests/smoke/ccip/ccip_test.go @@ -1,4 +1,4 @@ -package smoke +package ccip import ( "math/big" @@ -9,11 +9,11 @@ import ( jobv1 "github.com/smartcontractkit/chainlink-protos/job-distributor/v1/job" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" + "github.com/smartcontractkit/chainlink/integration-tests/testsetups" "github.com/smartcontractkit/chainlink/deployment" ccdeploy "github.com/smartcontractkit/chainlink/deployment/ccip" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testsetups" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" "github.com/smartcontractkit/chainlink/v2/core/logger" ) diff --git a/integration-tests/smoke/ccip_usdc_test.go b/integration-tests/smoke/ccip/ccip_usdc_test.go similarity index 98% rename from integration-tests/smoke/ccip_usdc_test.go rename to integration-tests/smoke/ccip/ccip_usdc_test.go index 091912b26fb..0be7edbc0c6 100644 --- a/integration-tests/smoke/ccip_usdc_test.go +++ b/integration-tests/smoke/ccip/ccip_usdc_test.go @@ -1,4 +1,4 @@ -package smoke +package ccip import ( "math/big" @@ -22,8 +22,8 @@ import ( "github.com/smartcontractkit/chainlink/deployment" ccdeploy "github.com/smartcontractkit/chainlink/deployment/ccip" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testsetups" + "github.com/smartcontractkit/chainlink/integration-tests/actions" + "github.com/smartcontractkit/chainlink/integration-tests/testsetups" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" diff --git a/integration-tests/smoke/fee_boosting_test.go b/integration-tests/smoke/ccip/fee_boosting_test.go similarity index 98% rename from integration-tests/smoke/fee_boosting_test.go rename to integration-tests/smoke/ccip/fee_boosting_test.go index 625200360e8..760018e0a29 100644 --- a/integration-tests/smoke/fee_boosting_test.go +++ b/integration-tests/smoke/ccip/fee_boosting_test.go @@ -1,4 +1,4 @@ -package smoke +package ccip import ( "math/big" @@ -13,7 +13,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" ccdeploy "github.com/smartcontractkit/chainlink/deployment/ccip" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" - "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testsetups" + "github.com/smartcontractkit/chainlink/integration-tests/testsetups" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" "github.com/smartcontractkit/chainlink/v2/core/logger" ) diff --git a/integration-tests/ccip-tests/testsetups/test_helpers.go b/integration-tests/testsetups/test_helpers.go similarity index 93% rename from integration-tests/ccip-tests/testsetups/test_helpers.go rename to integration-tests/testsetups/test_helpers.go index 4a480cdaa40..8e13757f983 100644 --- a/integration-tests/ccip-tests/testsetups/test_helpers.go +++ b/integration-tests/testsetups/test_helpers.go @@ -1,6 +1,7 @@ package testsetups import ( + "bytes" "fmt" "math/big" "os" @@ -9,6 +10,7 @@ import ( chainsel "github.com/smartcontractkit/chain-selectors" + "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" ctfconfig "github.com/smartcontractkit/chainlink-testing-framework/lib/config" ctftestenv "github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env" @@ -18,6 +20,9 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/ptr" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" "github.com/smartcontractkit/chainlink-testing-framework/seth" + integrationnodes "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" + evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + corechainlink "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/deployment" ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip" @@ -587,3 +592,40 @@ func CreateChainConfigFromNetworks( } return chains } + +func SetNodeConfig(nets []blockchain.EVMNetwork, nodeConfig, commonChain string, configByChain map[string]string) (*corechainlink.Config, string, error) { + var tomlCfg *corechainlink.Config + var err error + var commonChainConfig *evmcfg.Chain + if commonChain != "" { + err = config.DecodeTOML(bytes.NewReader([]byte(commonChain)), &commonChainConfig) + if err != nil { + return nil, "", err + } + } + configByChainMap := make(map[int64]evmcfg.Chain) + for k, v := range configByChain { + var chain evmcfg.Chain + err = config.DecodeTOML(bytes.NewReader([]byte(v)), &chain) + if err != nil { + return nil, "", err + } + chainId, err := strconv.ParseInt(k, 10, 64) + if err != nil { + return nil, "", err + } + configByChainMap[chainId] = chain + } + if nodeConfig == "" { + tomlCfg = integrationnodes.NewConfig( + integrationnodes.NewBaseConfig(), + integrationnodes.WithPrivateEVMs(nets, commonChainConfig, configByChainMap)) + } else { + tomlCfg, err = integrationnodes.NewConfigFromToml([]byte(nodeConfig), integrationnodes.WithPrivateEVMs(nets, commonChainConfig, configByChainMap)) + if err != nil { + return nil, "", err + } + } + tomlStr, err := tomlCfg.TOMLString() + return tomlCfg, tomlStr, err +}