From c0511882b24b140cda9ed0b6e6f59d599c803855 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Mon, 31 Jul 2017 21:53:16 +0900 Subject: [PATCH] Add test for limits on systemd We set some limits in the service file for Elasticsearch when installed as a service on systemd-based systems. This commit adds a packaging test that these limits are indeed set correctly. Relates #25976 --- .../resources/packaging/tests/60_systemd.bats | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats b/qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats index 269fcfd6f6d..97087b0ae2e 100644 --- a/qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats +++ b/qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats @@ -219,3 +219,20 @@ setup() { systemctl unmask systemd-sysctl.service } + +@test "[SYSTEMD] service file sets limits" { + clean_before_test + install_package + systemctl start elasticsearch.service + wait_for_elasticsearch_status + local pid=$(cat /var/run/elasticsearch/elasticsearch.pid) + local max_file_size=$(cat /proc/$pid/limits | grep "Max file size" | awk '{ print $4 }') + [ "$max_file_size" == "unlimited" ] + local max_processes=$(cat /proc/$pid/limits | grep "Max processes" | awk '{ print $3 }') + [ "$max_processes" == "4096" ] + local max_open_files=$(cat /proc/$pid/limits | grep "Max open files" | awk '{ print $4 }') + [ "$max_open_files" == "65536" ] + local max_address_space=$(cat /proc/$pid/limits | grep "Max address space" | awk '{ print $4 }') + [ "$max_address_space" == "unlimited" ] + systemctl stop elasticsearch.service +}