diff --git a/integration-tests/ccip-tests/Makefile b/integration-tests/ccip-tests/Makefile index 5af55f6c3a..a2a8531cb2 100644 --- a/integration-tests/ccip-tests/Makefile +++ b/integration-tests/ccip-tests/Makefile @@ -1,15 +1,15 @@ +include test-config.env ## To Override the default config, -# example usage: make override_config overridestring="" override_toml=../config/config.toml env=../.env +# example usage: make override_config override_toml=../config/config.toml env=../.env .PHONY: override_config override_config: cd ./testconfig/override && \ - go run . --overridewith=$(overridestring) --path=$(override_toml) --output=$(env) && \ + go run . --path=$(override_toml) --output=$(env) && \ cd ../.. # example usage: make test_load_ccip_simulated_k8 image=chainlink-ccip tag=latest testimage=chainlink-ccip-tests:latest testname=TestLoadCCIPStableRequestTriggeringWithNetworkChaos .PHONY: test_load_ccip -include test-config.env test_load_ccip: source ./testconfig/override/$(env) && \ CHAINLINK_IMAGE=$(image) \ @@ -21,9 +21,10 @@ test_load_ccip: go test -timeout 24h -count=1 -v -run ^$(testname)$$ ./load -# example usage: make test_smoke_ccip image=chainlink-ccip tag=latest testimage=chainlink-ccip-tests:latest testname=TestSmokeCCIPForBidirectionalLane overridestring="" override_toml=../config/config.toml env=test-config.env +# example usage: make test_smoke_ccip image=chainlink-ccip tag=latest testimage=chainlink-ccip-tests:latest testname=TestSmokeCCIPForBidirectionalLane override_toml=../config/config.toml env=test-config.env +# To run the test in besu simulated network, use the following command: +# example usage: make test_smoke_ccip image=chainlink-ccip tag=latest testimage="" testname=TestSmokeCCIPForBidirectionalLane override_toml="" env=test-config.env .PHONY: test_smoke_ccip -include test-config.env test_smoke_ccip: override_config source ./testconfig/override/$(env) && \ CHAINLINK_IMAGE=$(image) \ @@ -34,16 +35,6 @@ test_smoke_ccip: override_config DETACH_RUNNER=true \ go test -timeout 24h -count=1 -v -run ^$(testname)$$ ./smoke -# example usage: make test_smoke_ccip_simulated_local_besu image=chainlink-ccip tag=latest override_toml=../config/config.toml env=test-config.env -.PHONY: test_smoke_ccip_simulated_local_besu -include test-config.env -overridestring := "CCIP.Env.Networks = ['SIMULATED_BESU_NONDEV_1', 'SIMULATED_BESU_NONDEV_2']" -test_smoke_ccip_simulated_local_besu: override_config - source ./testconfig/override/$(env) && \ - CHAINLINK_IMAGE=$(image) \ - CHAINLINK_VERSION=$(tag) \ - ENV_JOB_IMAGE="" \ - go test -timeout 24h -count=1 -v -run ^TestSmokeCCIPForBidirectionalLane$$ ./smoke # image: the name for the chainlink image being built, example: image=chainlink # tag: the tag for the chainlink image being built, example: tag=latest diff --git a/integration-tests/ccip-tests/README.md b/integration-tests/ccip-tests/README.md index f0a194a11c..c75adf7ab1 100644 --- a/integration-tests/ccip-tests/README.md +++ b/integration-tests/ccip-tests/README.md @@ -20,13 +20,12 @@ Networks = ['AVALANCHE_FUJI', 'ARBITRUM_GOERLI'] ``` and then encode it using `base64` command and set the env var `BASE64_TEST_CONFIG_OVERRIDE` with the encoded content. ```bash -export BASE64_TEST_CONFIG_OVERRIDE=$(base64 -w 0 < path-to-toml-file) +export BASE64_TEST_CONFIG_OVERRIDE=$(base64 -i ) ``` Alternatively, you can also use the make command to invoke a go script to do the same. ```bash -## if overridestring is set, override_toml is ignored -make override_config overridestring="" override_toml="" env="<.env file with BASE64_TEST_CONFIG_OVERRIDE value>" +make override_config override_toml="" env="<.env file with BASE64_TEST_CONFIG_OVERRIDE value>" ``` In order to set the secrets, you need to set the env vars mentioned in [secrets.toml](./testconfig/secrets.env) file and source the file. @@ -60,9 +59,8 @@ You can use the following command to run the tests locally with your specific ch #### Smoke Tests ```bash -# if overridestring is set, override_toml is ignored # mark the testimage as empty for running the tests in local docker containers -make test_smoke_ccip image=chainlink-ccip tag=latest-dev testimage="" testname=TestSmokeCCIPForBidirectionalLane overridestring="" override_toml="" env="<.env file with BASE64_TEST_CONFIG_OVERRIDE value>" +make test_smoke_ccip image=chainlink-ccip tag=latest-dev testimage="" testname=TestSmokeCCIPForBidirectionalLane override_toml="" env="<.env file with BASE64_TEST_CONFIG_OVERRIDE value>" ``` Currently other types of tests like load and chaos can only be run using remote kubernetes cluster. diff --git a/integration-tests/ccip-tests/testconfig/override/main.go b/integration-tests/ccip-tests/testconfig/override/main.go index 65e147a927..03a1e79f7c 100644 --- a/integration-tests/ccip-tests/testconfig/override/main.go +++ b/integration-tests/ccip-tests/testconfig/override/main.go @@ -13,7 +13,7 @@ func main() { defaultOutputPath := "./.env" overrideconfigPath := flag.String("path", defaultPath, "config for overriding for default test config") outputPath := flag.String("output", defaultOutputPath, "output path for env file") - overrideconfig := flag.String("overridewith", "", "config for overriding for default test config") + flag.Parse() if *overrideconfigPath == "" { overrideconfigPath = &defaultPath @@ -21,18 +21,13 @@ func main() { if *outputPath == "" { outputPath = &defaultOutputPath } - var cData []byte - var err error - if *overrideconfig != "" { - fmt.Println("Using override config from command line") - cData = []byte(*overrideconfig) - } else { - cData, err = os.ReadFile(*overrideconfigPath) - if err != nil { - log.Println("unable to read the toml at ", *overrideconfigPath, "error - ", err) - os.Exit(1) - } + + cData, err := os.ReadFile(*overrideconfigPath) + if err != nil { + log.Println("unable to read the toml at ", *overrideconfigPath, "error - ", err) + os.Exit(1) } + // convert the data to Base64 encoded string encoded := base64.StdEncoding.EncodeToString(cData) // set the env var