Skip to content

Commit 453045f

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.
1 parent 1afc9af commit 453045f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,20 @@ setup() {
219219

220220
systemctl unmask systemd-sysctl.service
221221
}
222+
223+
@test "[SYSTEMD] service file sets limits" {
224+
clean_before_test
225+
install_package
226+
systemctl start elasticsearch.service
227+
wait_for_elasticsearch_status
228+
local pid=$(cat /var/run/elasticsearch/elasticsearch.pid)
229+
local max_file_size=$(cat /proc/$pid/limits | grep "Max file size" | awk '{ print $4 }')
230+
[ "$max_file_size" == "unlimited" ]
231+
local max_processes=$(cat /proc/$pid/limits | grep "Max processes" | awk '{ print $3 }')
232+
[ "$max_processes" == "4096" ]
233+
local max_open_files=$(cat /proc/$pid/limits | grep "Max open files" | awk '{ print $4 }')
234+
[ "$max_open_files" == "65536" ]
235+
local max_address_space=$(cat /proc/$pid/limits | grep "Max address space" | awk '{ print $4 }')
236+
[ "$max_address_space" == "unlimited" ]
237+
systemctl stop elasticsearch.service
238+
}

0 commit comments

Comments
 (0)