Rename Elasticsearch -> OpenSearch
Signed-off-by: Rushi Agrawal <rushi.agr@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
ARG PYTHON_VERSION=3.8
|
||||
FROM python:${PYTHON_VERSION}
|
||||
|
||||
WORKDIR /code/elasticsearch-py
|
||||
WORKDIR /code/opensearch-py
|
||||
COPY dev-requirements.txt .
|
||||
RUN python -m pip install \
|
||||
-U --no-cache-dir \
|
||||
|
||||
@@ -12,13 +12,16 @@ if [[ -z $es_node_name ]]; then
|
||||
export RUNSCRIPTS=${RUNSCRIPTS-}
|
||||
export DETACH=${DETACH-false}
|
||||
export CLEANUP=${CLEANUP-false}
|
||||
export ELASTICSEARCH_URL_EXTENSION=${ELASTICSEARCH_URL_EXTENSION-http}
|
||||
export OPENSEARCH_URL_EXTENSION=${OPENSEARCH_URL_EXTENSION-http}
|
||||
|
||||
export es_node_name=instance
|
||||
export elastic_password=changeme
|
||||
export opensearch_image=opensearchproject/opensearch
|
||||
if [[ "$CLUSTER" == "opendistro" ]]; then
|
||||
export opensearch_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 opensearch_url=$OPENSEARCH_URL_EXTENSION://${opensearch_node_name}:9200
|
||||
export external_opensearch_url=${opensearch_url/$opensearch_node_name/localhost}
|
||||
|
||||
export network_name=search-rest-test
|
||||
|
||||
|
||||
+5
-5
@@ -2,7 +2,7 @@
|
||||
|
||||
# ------------------------------------------------------- #
|
||||
#
|
||||
# Skeleton for common build entry script for all elastic
|
||||
# Skeleton for common build entry script for all opensearch
|
||||
# clients. Needs to be adapted to individual client usage.
|
||||
#
|
||||
# Must be called: ./.ci/make.sh <target> <params>
|
||||
@@ -35,7 +35,7 @@ VERSION=$2
|
||||
STACK_VERSION=$VERSION
|
||||
set -euo pipefail
|
||||
|
||||
product="elastic/elasticsearch-py"
|
||||
product="opensearch-project/opensearch-py"
|
||||
output_folder=".ci/output"
|
||||
codegen_folder=".ci/output"
|
||||
OUTPUT_DIR="$repo/${output_folder}"
|
||||
@@ -129,15 +129,15 @@ if [[ "$CMD" == "assemble" ]]; then
|
||||
|
||||
# Build dists into .ci/output
|
||||
docker run \
|
||||
--rm -v $repo/.ci/output:/code/elasticsearch-py/dist \
|
||||
--rm -v $repo/.ci/output:/code/opensearch-py/dist \
|
||||
$product \
|
||||
/bin/bash -c "python /code/elasticsearch-py/utils/build-dists.py $VERSION"
|
||||
/bin/bash -c "python /code/opensearch-py/utils/build-dists.py $VERSION"
|
||||
|
||||
# Verify that there are dists in .ci/output
|
||||
if compgen -G ".ci/output/*" > /dev/null; then
|
||||
|
||||
# Tarball everything up in .ci/output
|
||||
cd $repo/.ci/output && tar -czvf elasticsearch-py-$VERSION.tar.gz * && cd -
|
||||
cd $repo/.ci/output && tar -czvf opensearch-py-$VERSION.tar.gz * && cd -
|
||||
|
||||
echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m"
|
||||
exit 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Launch one or more Elasticsearch nodes via the Docker image,
|
||||
# Launch one or more OpenSearch nodes via the Docker image,
|
||||
# to form a cluster suitable for running the REST API tests.
|
||||
#
|
||||
# Export the STACK_VERSION variable, eg. '8.0.0-SNAPSHOT'.
|
||||
@@ -8,7 +8,7 @@
|
||||
# Export the NUMBER_OF_NODES variable to start more than 1 node
|
||||
|
||||
# Version 1.4.0
|
||||
# - Initial version of the run-elasticsearch.sh script
|
||||
# - Initial version of the run-opensearch.sh script
|
||||
# - Deleting the volume should not dependent on the container still running
|
||||
# - Fixed `ES_JAVA_OPTS` config
|
||||
# - Moved to STACK_VERSION and TEST_VERSION
|
||||
@@ -47,7 +47,7 @@ NUMBER_OF_NODES=${NUMBER_OF_NODES-1}
|
||||
http_port=9200
|
||||
for (( i=0; i<$NUMBER_OF_NODES; i++, http_port++ )); do
|
||||
node_name=${es_node_name}$i
|
||||
node_url=${external_elasticsearch_url/9200/${http_port}}$i
|
||||
node_url=${external_opensearch_url/9200/${http_port}}$i
|
||||
if [[ "$i" == "0" ]]; then node_name=$es_node_name; fi
|
||||
environment+=($(cat <<-END
|
||||
--env node.name=$node_name
|
||||
@@ -56,7 +56,7 @@ END
|
||||
echo "$i: $http_port $node_url "
|
||||
volume_name=${node_name}-rest-test-data
|
||||
volumes+=($(cat <<-END
|
||||
--volume $volume_name:/usr/share/elasticsearch/data${i}
|
||||
--volume $volume_name:/usr/share/opensearch/data${i}
|
||||
END
|
||||
))
|
||||
|
||||
@@ -84,7 +84,7 @@ END
|
||||
--ulimit nofile=65536:65536 \
|
||||
--ulimit memlock=-1:-1 \
|
||||
--detach="$local_detach" \
|
||||
--health-cmd="curl -vvv -s --fail $elasticsearch_url/_cluster/health || exit 1" \
|
||||
--health-cmd="curl -vvv -s --fail $opensearch_url/_cluster/health || exit 1" \
|
||||
--health-interval=2s \
|
||||
--health-retries=20 \
|
||||
--health-timeout=2s \
|
||||
+12
-12
@@ -1,43 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Called by entry point `run-test` use this script to add your repository specific test commands
|
||||
# Once called Elasticsearch is up and running and the following parameters are available to this script
|
||||
# Once called opensearch is up and running and the following parameters are available to this script
|
||||
|
||||
# ELASTICSEARCH_VERSION -- version e.g Major.Minor.Patch(-Prelease)
|
||||
# ELASTICSEARCH_URL -- The url at which elasticsearch is reachable
|
||||
# OPENSEARCH_VERSION -- version e.g Major.Minor.Patch(-Prelease)
|
||||
# OPENSEARCH_URL -- The url at which opensearch is reachable
|
||||
# network_name -- The docker network name
|
||||
# NODE_NAME -- The docker container name also used as Elasticsearch node name
|
||||
# NODE_NAME -- The docker container name also used as opensearch node name
|
||||
|
||||
# When run in CI the test-matrix is used to define additional variables
|
||||
# TEST_SUITE -- defaults to `oss` in `run-tests`
|
||||
|
||||
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 URL ${opensearch_url}\033[0m"
|
||||
echo -e "\033[34;1mINFO:\033[0m VERSION ${OPENSEARCH_VERSION}\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"
|
||||
|
||||
echo -e "\033[1m>>>>> Build [elastic/elasticsearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
echo -e "\033[1m>>>>> Build [opensearch-project/opensearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
|
||||
docker build \
|
||||
--file .ci/Dockerfile.client \
|
||||
--tag elastic/elasticsearch-py \
|
||||
--tag opensearch-project/opensearch-py \
|
||||
--build-arg PYTHON_VERSION=${PYTHON_VERSION} \
|
||||
.
|
||||
|
||||
echo -e "\033[1m>>>>> Run [elastic/elasticsearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
echo -e "\033[1m>>>>> Run [opensearch-project/opensearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
|
||||
mkdir -p junit
|
||||
docker run \
|
||||
--network=${network_name} \
|
||||
--env "STACK_VERSION=${STACK_VERSION}" \
|
||||
--env "ELASTICSEARCH_URL=${elasticsearch_url}" \
|
||||
--env "OPENSEARCH_URL=${opensearch_url}" \
|
||||
--env "TEST_SUITE=${TEST_SUITE}" \
|
||||
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
|
||||
--env "TEST_TYPE=server" \
|
||||
--name elasticsearch-py \
|
||||
--name opensearch-py \
|
||||
--rm \
|
||||
elastic/elasticsearch-py \
|
||||
opensearch-project/opensearch-py \
|
||||
python setup.py test
|
||||
|
||||
+3
-4
@@ -2,21 +2,20 @@
|
||||
#
|
||||
# Version 1.1
|
||||
# - Moved to .ci folder and seperated out `run-repository.sh`
|
||||
# - Add `$RUNSCRIPTS` env var for running Elasticsearch dependent products
|
||||
# - Add `$RUNSCRIPTS` env var for running opensearch dependent products
|
||||
|
||||
# Default environment variables
|
||||
export TEST_SUITE="${TEST_SUITE:=oss}"
|
||||
export PYTHON_VERSION="${PYTHON_VERSION:=3.9}"
|
||||
export PYTHON_CONNECTION_CLASS="${PYTHON_CONNECTION_CLASS:=Urllib3HttpConnection}"
|
||||
export ELASTICSEARCH_URL_EXTENSION="${ELASTICSEARCH_URL_EXTENSION:=http}"
|
||||
export OPENSEARCH_URL_EXTENSION="${OPENSEARCH_URL_EXTENSION:=http}"
|
||||
export CLUSTER="${1:=opensearch}"
|
||||
|
||||
script_path=$(dirname $(realpath -s $0))
|
||||
source $script_path/functions/imports.sh
|
||||
set -euo pipefail
|
||||
|
||||
echo -e "\033[1m>>>>> Start server container >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
DETACH=true bash .ci/run-elasticsearch.sh
|
||||
DETACH=true bash .ci/run-opensearch.sh
|
||||
|
||||
if [[ -n "$RUNSCRIPTS" ]]; then
|
||||
for RUNSCRIPT in ${RUNSCRIPTS//,/ } ; do
|
||||
|
||||
Reference in New Issue
Block a user