diff --git a/qa/vagrant/src/test/resources/packaging/tests/20_tar_keystore.bats b/qa/vagrant/src/test/resources/packaging/tests/20_tar_keystore.bats new file mode 120000 index 00000000000..a3c545a63d0 --- /dev/null +++ b/qa/vagrant/src/test/resources/packaging/tests/20_tar_keystore.bats @@ -0,0 +1 @@ +keystore.bash \ No newline at end of file diff --git a/qa/vagrant/src/test/resources/packaging/tests/30_package_keystore.bats b/qa/vagrant/src/test/resources/packaging/tests/30_package_keystore.bats new file mode 120000 index 00000000000..a3c545a63d0 --- /dev/null +++ b/qa/vagrant/src/test/resources/packaging/tests/30_package_keystore.bats @@ -0,0 +1 @@ +keystore.bash \ No newline at end of file diff --git a/qa/vagrant/src/test/resources/packaging/tests/keystore.bash b/qa/vagrant/src/test/resources/packaging/tests/keystore.bash new file mode 100644 index 00000000000..d3fe102b7c1 --- /dev/null +++ b/qa/vagrant/src/test/resources/packaging/tests/keystore.bash @@ -0,0 +1,55 @@ +#!/usr/bin/env bats + +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License; +# you may not use this file except in compliance with the Elastic License. + +load $BATS_UTILS/utils.bash +load $BATS_UTILS/plugins.bash + +setup() { + if [ $BATS_TEST_NUMBER == 1 ]; then + clean_before_test + install + fi +} + +if [[ "$BATS_TEST_FILENAME" =~ 20_tar_keystore.bats$ ]]; then + load $BATS_UTILS/tar.bash + GROUP='TAR KEYSTORE' + install() { + install_archive + verify_archive_installation + } + export ESHOME=/tmp/elasticsearch + export_elasticsearch_paths + export ESPLUGIN_COMMAND_USER=elasticsearch +else + load $BATS_UTILS/packages.bash + if is_rpm; then + GROUP='RPM KEYSTORE' + elif is_dpkg; then + GROUP='DEB KEYSTORE' + fi + export_elasticsearch_paths + export ESPLUGIN_COMMAND_USER=root + install() { + install_package + verify_package_installation + } +fi + +@test "[$GROUP] keystore does not exist" { + assert_file_not_exist /etc/elasticsearch/elasticsearch.keystore +} + +@test "[$GROUP] keystore exists after install" { + install_and_check_plugin x pack x-pack-*.jar + if [[ "$BATS_TEST_FILENAME" =~ 20_tar_keystore.bats$ ]]; then + assert_file "$ESCONFIG/elasticsearch.keystore" f elasticsearch elasticsearch 660 + else + assert_file "$ESCONFIG/elasticsearch.keystore" f root elasticsearch 660 + fi +} + +