From e901161254f6e57ee400f9514c77ae2dbbf31f98 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 13 Feb 2024 12:07:13 -0300 Subject: [PATCH] use simple bash script to set BASE64 env var --- integration-tests/Makefile | 18 +++------- .../scripts/check_base64_env_var.sh | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+), 13 deletions(-) create mode 100755 integration-tests/scripts/check_base64_env_var.sh diff --git a/integration-tests/Makefile b/integration-tests/Makefile index 8415c00f9cd..2d887e97baf 100644 --- a/integration-tests/Makefile +++ b/integration-tests/Makefile @@ -130,7 +130,7 @@ test_node_migrations: install_gotestfmt ## Run all node migration tests. go test -timeout 1h -count=1 -json $(args) ./migration 2>&1 | tee /tmp/gotest.log | gotestfmt .PHONY: test_node_migrations_simulated -test_node_migrations_simulated: install_gotestfmt +test_node_migrations_simulated: install_gotestfmt TEST_LOG_LEVEL="disabled" \ go test -timeout 1h -count=1 -json $(args) ./migration 2>&1 | tee /tmp/gotest.log | gotestfmt @@ -145,30 +145,22 @@ test_node_migrations_simulated_verbose: # Soak .PHONY: test_soak_ocr test_soak_ocr: - go test -v -count=1 -run TestOCRSoak ./soak - -.PHONY: test_soak_ocr_simulated -test_soak_ocr_simulated: + . ./scripts/check_base64_env_var.sh go test -v -count=1 -run TestOCRSoak ./soak .PHONY: test_soak_forwarder_ocr test_soak_forwarder_ocr: - go test -v -count=1 -run TestForwarderOCRSoak ./soak - -.PHONY: test_soak_forwarder_ocr_simulated -test_soak_forwarder_ocr_simulated: + . ./scripts/check_base64_env_var.sh go test -v -count=1 -run TestForwarderOCRSoak ./soak .PHONY: test_soak_automation test_soak_automation: - go test -v -run ^TestAutomationBenchmark$$ ./benchmark -count=1 - -.PHONY: test_soak_automation_simulated -test_soak_automation_simulated: + . ./scripts/check_base64_env_var.sh go test -v -run ^TestAutomationBenchmark$$ ./benchmark -count=1 .PHONY: test_benchmark_automation test_benchmark_automation: ## Run the automation benchmark tests + . ./scripts/check_base64_env_var.sh go test -timeout 30m -v -run ^TestAutomationBenchmark$$ ./benchmark -count=1 .PHONY: test_reorg_automation diff --git a/integration-tests/scripts/check_base64_env_var.sh b/integration-tests/scripts/check_base64_env_var.sh new file mode 100755 index 00000000000..f1bd4632da5 --- /dev/null +++ b/integration-tests/scripts/check_base64_env_var.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +WHITE='\033[0;37m' +NC='\033[0m' # No Color + +echo +if [ ! -z "$BASE64_CONFIG_OVERRIDE" ]; then + echo "${GREEN}BASE64_CONFIG_OVERRIDE is set, it will be used.${NC}" + echo "Decoded content:" + echo + echo "$BASE64_CONFIG_OVERRIDE" | base64 --decode + echo + echo + echo "${GREEN}Press RETURN to confirm and continue...${NC} ${RED}or CTRL+C to exit${NC}" + read -r -n 1 key +else + echo "${YELLOW}BASE64_CONFIG_OVERRIDE is not set, checking for overrides.toml file...${NC}" + if [ -f "testconfig/overrides.toml" ]; then + echo "${GREEN}Found testconfig/overrides.toml file. Here's its content:${NC}" + echo + cat "testconfig/overrides.toml" + echo + echo + echo "${GREEN}Press RETURN to base64-encode it and run the test...${NC} ${RED}or CTRL+C to exit${NC}" + read -r -n 1 key + if [[ $key = "" ]]; then + export BASE64_CONFIG_OVERRIDE=$(cat testconfig/overrides.toml | base64) + fi + else + echo "${RED}testconfig/overrides.toml file does not exist. Please create it or set BASE64_CONFIG_OVERRIDE manually.${NC}" + echo + fi +fi \ No newline at end of file