From 90cf2a78e7a69f3999d2cf56c3541619b29b2625 Mon Sep 17 00:00:00 2001 From: Rushi Agrawal Date: Wed, 18 Aug 2021 00:28:35 +0530 Subject: [PATCH] [CI] Remove unused variables and logic elasticsearch_container, elasticsearch_image vars were not being used, so removed them. Also, cleaned up other variables which depended on them (mostly hardcoded them instead of deriving from these removed variables) Signed-off-by: Rushi Agrawal --- .ci/functions/cleanup.sh | 4 ++-- .ci/functions/imports.sh | 9 +-------- .ci/run-elasticsearch.sh | 15 ++------------- .ci/run-repository.sh | 4 +--- 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/.ci/functions/cleanup.sh b/.ci/functions/cleanup.sh index 4c25166f..d9eaa352 100755 --- a/.ci/functions/cleanup.sh +++ b/.ci/functions/cleanup.sh @@ -25,8 +25,8 @@ function cleanup_node { (docker container rm --force --volumes "$1") || true fi if [[ -n "$1" ]]; then - echo -e "\033[34;1mINFO:\033[0m Removing volume $1-${suffix}-data\033[0m" - cleanup_volume "$1-${suffix}-data" + echo -e "\033[34;1mINFO:\033[0m Removing volume $1-rest-test-data\033[0m" + cleanup_volume "$1-rest-test-data" fi } function cleanup_network { diff --git a/.ci/functions/imports.sh b/.ci/functions/imports.sh index d86c3cb5..6d4e0fa4 100755 --- a/.ci/functions/imports.sh +++ b/.ci/functions/imports.sh @@ -16,18 +16,11 @@ if [[ -z $es_node_name ]]; then export es_node_name=instance export elastic_password=changeme - export elasticsearch_image=opensearchproject/opensearch - if [[ "$CLUSTER" == "opendistro" ]]; then - export elasticsearch_image=amazon/opendistro-for-elasticsearch - fi export elasticsearch_url=$ELASTICSEARCH_URL_EXTENSION://${es_node_name}:9200 export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost} - export elasticsearch_container="${elasticsearch_image}:latest" - export suffix=rest-test - export moniker=$(echo "$elasticsearch_container" | tr -C "[:alnum:]" '-') - export network_name=${moniker}${suffix} + export network_name=search-rest-test export ssl_cert="${script_path}/certs/testnode.crt" export ssl_key="${script_path}/certs/testnode.key" diff --git a/.ci/run-elasticsearch.sh b/.ci/run-elasticsearch.sh index d16e8ce4..f9c08fdb 100755 --- a/.ci/run-elasticsearch.sh +++ b/.ci/run-elasticsearch.sh @@ -26,7 +26,7 @@ echo -e "\033[34;1mINFO:\033[0m Take down node if called twice with the same arg cleanup_node $es_node_name master_node_name=${es_node_name} -cluster_name=${moniker}${suffix} +cluster_name=search-rest-test declare -a volumes environment=($(cat <<-END @@ -43,17 +43,6 @@ environment=($(cat <<-END END )) -# Pull the container, retry on failures up to 5 times with -# short delays between each attempt. Fixes most transient network errors. -docker_pull_attempts=0 -until [ "$docker_pull_attempts" -ge 5 ] -do - docker pull "$elasticsearch_container" && break - docker_pull_attempts=$((docker_pull_attempts+1)) - echo "Failed to pull image, retrying in 10 seconds (retry $docker_pull_attempts/5)..." - sleep 10 -done - NUMBER_OF_NODES=${NUMBER_OF_NODES-1} http_port=9200 for (( i=0; i<$NUMBER_OF_NODES; i++, http_port++ )); do @@ -65,7 +54,7 @@ for (( i=0; i<$NUMBER_OF_NODES; i++, http_port++ )); do END )) echo "$i: $http_port $node_url " - volume_name=${node_name}-${suffix}-data + volume_name=${node_name}-rest-test-data volumes+=($(cat <<-END --volume $volume_name:/usr/share/elasticsearch/data${i} END diff --git a/.ci/run-repository.sh b/.ci/run-repository.sh index f43b2123..feb4e4f6 100755 --- a/.ci/run-repository.sh +++ b/.ci/run-repository.sh @@ -4,9 +4,8 @@ # Once called Elasticsearch is up and running and the following parameters are available to this script # ELASTICSEARCH_VERSION -- version e.g Major.Minor.Patch(-Prelease) -# ELASTICSEARCH_CONTAINER -- the docker moniker as a reference to know which docker image distribution is used # ELASTICSEARCH_URL -- The url at which elasticsearch is reachable -# NETWORK_NAME -- The docker network name +# network_name -- The docker network name # NODE_NAME -- The docker container name also used as Elasticsearch node name # When run in CI the test-matrix is used to define additional variables @@ -16,7 +15,6 @@ set -e echo -e "\033[34;1mINFO:\033[0m URL ${elasticsearch_url}\033[0m" echo -e "\033[34;1mINFO:\033[0m VERSION ${ELASTICSEARCH_VERSION}\033[0m" -echo -e "\033[34;1mINFO:\033[0m CONTAINER ${ELASTICSEARCH_CONTAINER}\033[0m" echo -e "\033[34;1mINFO:\033[0m TEST_SUITE ${TEST_SUITE}\033[0m" echo -e "\033[34;1mINFO:\033[0m PYTHON_VERSION ${PYTHON_VERSION}\033[0m" echo -e "\033[34;1mINFO:\033[0m PYTHON_CONNECTION_CLASS ${PYTHON_CONNECTION_CLASS}\033[0m"