Skip to content

Commit 5721eb9

Browse files
committed
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
1 parent 993955a commit 5721eb9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

qa/vagrant/src/test/resources/packaging/tests/10_systemd.bats renamed to qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,21 @@ setup() {
200200

201201
systemctl unmask systemd-sysctl.service
202202
}
203+
204+
@test "[SYSTEMD] service file sets limits" {
205+
clean_before_test
206+
install_package
207+
systemctl start elasticsearch.service
208+
wait_for_elasticsearch_status
209+
local pid=$(cat /var/run/elasticsearch/elasticsearch.pid)
210+
local max_file_size=$(cat /proc/$pid/limits | grep "Max file size" | awk '{ print $4 }')
211+
[ "$max_file_size" == "unlimited" ]
212+
local max_processes=$(cat /proc/$pid/limits | grep "Max processes" | awk '{ print $3 }')
213+
[ "$max_processes" == "4096" ]
214+
local max_open_files=$(cat /proc/$pid/limits | grep "Max open files" | awk '{ print $4 }')
215+
[ "$max_open_files" == "65536" ]
216+
local max_address_space=$(cat /proc/$pid/limits | grep "Max address space" | awk '{ print $4 }')
217+
[ "$max_address_space" == "unlimited" ]
218+
systemctl stop elasticsearch.service
219+
}
220+

0 commit comments

Comments
 (0)