Apache Solr open-source search software
SOLR-17458: Remove prometheus exporter integration tests (bats & docker)
David Smiley0a84fa5f07c5
diff --git a/solr/docker/tests/cases/prometheus-exporter-cloud/test.sh b/solr/docker/tests/cases/prometheus-exporter-cloud/test.shdeleted file mode 100755index 137207a8f22..00000000000--- a/solr/docker/tests/cases/prometheus-exporter-cloud/test.sh+++ /dev/null@@ -1,51 +0,0 @@-#!/bin/bash-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.--set -euo pipefail--TEST_DIR="${TEST_DIR:-$(dirname -- "${BASH_SOURCE[0]}")}"-source "${TEST_DIR}/../../shared.sh"--container_cleanup "${container_name}-solr"--echo "Running $container_name"-docker run --name "${container_name}-solr" -d "$tag" solr-fg--wait_for_container_and_solr "${container_name}-solr"--solr_ip=$(docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" "${container_name}-solr")--docker run --name "$container_name" -d \- --env "ZK_HOST=${solr_ip}:9983" \- --env "SCRAPE_INTERVAL=1" \- --env "CLUSTER_ID=myCluster" \- "$tag" "solr-exporter"--wait_for_container_and_solr_exporter "${container_name}"--echo "Checking prometheus data"-data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8989/metrics')--if ! grep -E -q "solr_collections_live_nodes{zk_host=\"${solr_ip}:9983\",cluster_id=\"myCluster\",} 1.0" <<<"$data"; then- echo "Test $TEST_NAME $tag failed; did not find correct data"- echo "$data"- exit 1-fi--container_cleanup "${container_name}-solr"-container_cleanup "$container_name"--echo "Test $TEST_NAME $tag succeeded"diff --git a/solr/docker/tests/cases/prometheus-exporter-standalone/test.sh b/solr/docker/tests/cases/prometheus-exporter-standalone/test.shdeleted file mode 100755index d964453170b..00000000000--- a/solr/docker/tests/cases/prometheus-exporter-standalone/test.sh+++ /dev/null@@ -1,54 +0,0 @@-#!/bin/bash-# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.--set -euo pipefail--TEST_DIR="${TEST_DIR:-$(dirname -- "${BASH_SOURCE[0]}")}"-source "${TEST_DIR}/../../shared.sh"--container_cleanup "${container_name}-solr"--echo "Running $container_name"-docker run --name "${container_name}-solr" -d "$tag" "solr-demo"--wait_for_container_and_solr "${container_name}-solr"--solr_ip=$(docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" "${container_name}-solr")--docker run --name "$container_name" --add-host "solr-host:${solr_ip}" -d \- --env "SOLR_URL=http://solr-host:8983/solr" \- --env "SCRAPE_INTERVAL=1" \- --env "CLUSTER_ID=myCluster" \- "$tag" "solr-exporter"--wait_for_container_and_solr_exporter "${container_name}"--echo "Submitting Solr query"-docker exec --user=solr "${container_name}-solr" wget -q -O - 'http://localhost:8983/solr/demo/select?q=id%3Adell' > /dev/null--echo "Checking prometheus data"-data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8989/metrics')--if ! grep -E -q 'solr_metrics_core_query_requests_total{category="QUERY",searchHandler="/select",internal="false",core="demo",base_url="http://solr-host:8983/solr",cluster_id="myCluster",} [0-9]+.0' <<<"$data"; then- echo "Test $TEST_NAME $tag failed; did not find correct data"- echo "$data"- exit 1-fi--container_cleanup "${container_name}-solr"-container_cleanup "$container_name"--echo "Test $TEST_NAME $tag succeeded"diff --git a/solr/docker/tests/shared.sh b/solr/docker/tests/shared.shindex a0dd04c3c9b..08ead0273d8 100755--- a/solr/docker/tests/shared.sh+++ b/solr/docker/tests/shared.sh@@ -51,25 +51,6 @@ function wait_for_container_and_solr {sleep 4}-function wait_for_container_and_solr_exporter {- local container_name- container_name=$1- wait_for_server_started "$container_name" 0 'org.apache.solr.prometheus.exporter.SolrExporter; Solr Prometheus Exporter is running'-- printf '\nWaiting for Solr Prometheus Exporter...\n'- local status- status=$(docker exec --env SOLR_PORT=8989 "$container_name" wait-for-solr.sh --max-attempts 15 --wait-seconds 1)-# echo "Got status from Solr Prometheus Exporter: $status"- if ! grep -E -i -q 'Solr is running' <<<"$status"; then- echo "Solr Prometheus Exporter did not start"- container_cleanup "$container_name"- exit 1- else- echo "Solr Prometheus Exporter is running"- fi- sleep 4-}-function wait_for_server_started {local container_namecontainer_name=$1diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradleindex 21f765322b6..2c21f928d0b 100644--- a/solr/packaging/build.gradle+++ b/solr/packaging/build.gradle@@ -267,7 +267,6 @@ task integrationTests(type: BatsTask) {environment SOLR2_PORT: solrPort + 1environment SOLR3_PORT: solrPort + 2environment ZK_PORT: solrPort + 1000- environment SOLR_EXPORTER_PORT: solrPort + 100environment SOLR_LOGS_DIR: "$solrHome/logs"environment TEST_OUTPUT_DIR: integrationTestOutputenvironment TEST_FAILURE_DIR: solrTestFailuresDirdiff --git a/solr/packaging/test/bats_helper.bash b/solr/packaging/test/bats_helper.bashindex 23c3629bea6..97c4424821d 100644--- a/solr/packaging/test/bats_helper.bash+++ b/solr/packaging/test/bats_helper.bash@@ -62,13 +62,6 @@ shutdown_all() {solr stop --all >/dev/null 2>&1}-shutdown_exporter(){- EXPORTER_PID=$(ps auxww | grep org.apache.solr.prometheus.exporter.SolrExporter | awk "/-classpath/"' {print $2}' | sort -r)- if [[ -n $EXPORTER_PID ]]; then- kill -9 $EXPORTER_PID- fi-}-delete_all_collections() {local collection_list="$(solr zk ls /collections -z localhost:${ZK_PORT})"for collection in $collection_list; dodiff --git a/solr/packaging/test/test_prometheus.bats b/solr/packaging/test/test_prometheus.batsdeleted file mode 100644index 3dd39c9ccf3..00000000000--- a/solr/packaging/test/test_prometheus.bats+++ /dev/null@@ -1,56 +0,0 @@-#!/usr/bin/env bats--# Licensed to the Apache Software Foundation (ASF) under one or more-# contributor license agreements. See the NOTICE file distributed with-# this work for additional information regarding copyright ownership.-# The ASF licenses this file to You under the Apache License, Version 2.0-# (the "License"); you may not use this file except in compliance with-# the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.--load bats_helper--setup() {- common_clean_setup-}--teardown() {- # save a snapshot of SOLR_HOME for failed tests- save_home_on_failure-- solr stop --all >/dev/null 2>&1-- shutdown_exporter-}--@test "should start solr prometheus exporter that scrapes solr for metrics" {- solr start --user-managed- solr assert --started http://localhost:${SOLR_PORT} --timeout 5000-- run solr create -c COLL_NAME- assert_output --partial "Created new core 'COLL_NAME'"-- # echo "# starting solr-exporter on ${SOLR_EXPORTER_PORT}" >&3- run solr-exporter --cluster-id bats-test -p $SOLR_EXPORTER_PORT --solr-url http://localhost:${SOLR_PORT}/solr >&3 &-- sleep 5-- run curl "http:/localhost:$SOLR_EXPORTER_PORT/"-- assert_output --partial 'solr_metrics_core_query_requests_total'- assert_output --partial 'core="COLL_NAME"'- assert_output --partial 'bats-test'-}--@test "unrecognized option logging" {- run ! solr-exporter --unknown-option unknown-option-- assert_output --partial 'Unrecognized option: --unknown-option'-}