Skip to content

Commit

Permalink
Fix make commands (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnieeG authored Oct 26, 2023
1 parent dc383c3 commit 8f6b610
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 32 deletions.
21 changes: 6 additions & 15 deletions integration-tests/ccip-tests/Makefile
Original file line number Diff line number Diff line change
@@ -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) \
Expand All @@ -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) \
Expand All @@ -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
Expand Down
8 changes: 3 additions & 5 deletions integration-tests/ccip-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <path-to-toml-file>)
```

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="<overridden config string>" override_toml="<the toml file with overridden config string>" env="<.env file with BASE64_TEST_CONFIG_OVERRIDE value>"
make override_config override_toml="<the toml file with overridden config>" 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.
Expand Down Expand Up @@ -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="<overridden config string>" override_toml="<the toml file with overridden config string>" env="<.env file with BASE64_TEST_CONFIG_OVERRIDE value>"
make test_smoke_ccip image=chainlink-ccip tag=latest-dev testimage="" testname=TestSmokeCCIPForBidirectionalLane override_toml="<the toml file with overridden config string>" 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.

Expand Down
19 changes: 7 additions & 12 deletions integration-tests/ccip-tests/testconfig/override/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,21 @@ 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
}
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
Expand Down

0 comments on commit 8f6b610

Please sign in to comment.