From 4ae38ca7f04b1565d31ba77501fc8897e268d624 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Wed, 18 Aug 2021 17:47:23 +0200 Subject: [PATCH] Update integration test scripts (#1525) * Updated scripts * Update runner --- .ci/functions/imports.sh | 5 +++-- .ci/run-elasticsearch.sh | 5 +++-- .ci/run-repository.sh | 1 + test/integration/index.js | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.ci/functions/imports.sh b/.ci/functions/imports.sh index 3fb28cc38..c05f36826 100644 --- a/.ci/functions/imports.sh +++ b/.ci/functions/imports.sh @@ -26,10 +26,11 @@ if [[ -z $es_node_name ]]; then export es_node_name=instance export elastic_password=changeme export elasticsearch_image=elasticsearch - export elasticsearch_url=https://elastic:${elastic_password}@${es_node_name}:9200 + export elasticsearch_scheme="https" if [[ $TEST_SUITE != "platinum" ]]; then - export elasticsearch_url=http://${es_node_name}:9200 + export elasticsearch_scheme="http" fi + export elasticsearch_url=${elasticsearch_scheme}://elastic:${elastic_password}@${es_node_name}:9200 export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost} export elasticsearch_container="${elasticsearch_image}:${STACK_VERSION}" diff --git a/.ci/run-elasticsearch.sh b/.ci/run-elasticsearch.sh index 0c27e9b75..89bce8cbd 100755 --- a/.ci/run-elasticsearch.sh +++ b/.ci/run-elasticsearch.sh @@ -7,7 +7,7 @@ # Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'. # Export the NUMBER_OF_NODES variable to start more than 1 node -# Version 1.4.0 +# Version 1.5.0 # - Initial version of the run-elasticsearch.sh script # - Deleting the volume should not dependent on the container still running # - Fixed `ES_JAVA_OPTS` config @@ -18,6 +18,7 @@ # - Added flags to make local CCR configurations work # - Added action.destructive_requires_name=false as the default will be true in v8 # - Added ingest.geoip.downloader.enabled=false as it causes false positives in testing +# - Moved ELASTIC_PASSWORD to the base arguments for "Security On by default" script_path=$(dirname $(realpath -s $0)) source $script_path/functions/imports.sh @@ -31,6 +32,7 @@ cluster_name=${moniker}${suffix} declare -a volumes environment=($(cat <<-END + --env ELASTIC_PASSWORD=$elastic_password --env node.name=$es_node_name --env cluster.name=$cluster_name --env cluster.initial_master_nodes=$master_node_name @@ -46,7 +48,6 @@ END )) if [[ "$TEST_SUITE" == "platinum" ]]; then environment+=($(cat <<-END - --env ELASTIC_PASSWORD=$elastic_password --env xpack.license.self_generated.type=trial --env xpack.security.enabled=true --env xpack.security.http.ssl.enabled=true diff --git a/.ci/run-repository.sh b/.ci/run-repository.sh index b64c38d96..026595fdf 100755 --- a/.ci/run-repository.sh +++ b/.ci/run-repository.sh @@ -38,6 +38,7 @@ fi docker run \ --network=${network_name} \ --env "TEST_ES_SERVER=${ELASTICSEARCH_URL}" \ + --env "TEST_SUITE=${TEST_SUITE}" \ --volume $repo:/usr/src/app \ --volume /usr/src/app/node_modules \ --name elasticsearch-js \ diff --git a/test/integration/index.js b/test/integration/index.js index 833b7b3ea..098b52073 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -337,10 +337,10 @@ function generateJunitXmlReport (junit, suite) { } if (require.main === module) { - const node = process.env.TEST_ES_SERVER || 'http://localhost:9200' + const node = process.env.TEST_ES_SERVER || 'https://elastic:changeme@localhost:9200' const opts = { node, - isXPack: node.indexOf('@') > -1 + isXPack: process.env.TEST_SUITE !== 'free' } runner(opts) }