|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the "Elastic License |
| 4 | + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side |
| 5 | + * Public License v 1"; you may not use this file except in compliance with, at |
| 6 | + * your election, the "Elastic License 2.0", the "GNU Affero General Public |
| 7 | + * License v3.0 only", or the "Server Side Public License, v 1". |
| 8 | + */ |
| 9 | + |
| 10 | +package org.elasticsearch.packaging.test; |
| 11 | + |
| 12 | +import org.elasticsearch.packaging.util.Platforms; |
| 13 | +import org.elasticsearch.packaging.util.ProcessInfo; |
| 14 | +import org.junit.BeforeClass; |
| 15 | + |
| 16 | +import java.util.List; |
| 17 | + |
| 18 | +import static com.carrotsearch.randomizedtesting.RandomizedTest.assumeTrue; |
| 19 | +import static org.hamcrest.Matchers.equalTo; |
| 20 | + |
| 21 | +// tests for how the linux distro interacts with the OS |
| 22 | +public class LinuxSystemTests extends PackagingTestCase { |
| 23 | + |
| 24 | + @BeforeClass |
| 25 | + public static void ensureLinux() { |
| 26 | + assumeTrue(Platforms.LINUX); |
| 27 | + } |
| 28 | + |
| 29 | + public void test10Install() throws Exception { |
| 30 | + install(); |
| 31 | + } |
| 32 | + |
| 33 | + public void test20CoredumpFilter() throws Exception { |
| 34 | + startElasticsearch(); |
| 35 | + |
| 36 | + // find the Elasticsearch process |
| 37 | + int esPid = -1; |
| 38 | + List<ProcessInfo> procs = ProcessInfo.getProcessInfo(sh, "java"); |
| 39 | + for (ProcessInfo proc : procs) { |
| 40 | + if (proc.commandLine().contains("org.elasticsearch.bootstrap.Elasticsearch")) { |
| 41 | + esPid = proc.pid(); |
| 42 | + } |
| 43 | + } |
| 44 | + if (esPid == -1) { |
| 45 | + fail("Could not find Elasticsearch process, existing processes:\n" + procs); |
| 46 | + } |
| 47 | + |
| 48 | + // check the coredump filter was set correctly |
| 49 | + String coredumpFilter = sh.run("cat /proc/" + esPid + "/coredump_filter").stdout().trim(); |
| 50 | + assertThat(coredumpFilter, equalTo("00000023")); |
| 51 | + } |
| 52 | + |
| 53 | + |
| 54 | +} |
0 commit comments