Logging: Skip test if it'd fail

If we're running on a platform where we can't install syscall filters
Elasticsearch logs a message before it reads the data directory to get
the node name. Because that log message doesn't have a node name this
test will fail. Since we mostly run the test on OSes where we *can*
install the syscall filters we can fairly safely skip the test on OSes
where we can't install the syscall filters.

Closes #33540
This commit is contained in:
Nik Everett 2018-09-07 21:42:58 -04:00
parent 0b62d6bb9d
commit 97736ac46a
1 changed files with 3 additions and 0 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.unconfigured_node_name; package org.elasticsearch.unconfigured_node_name;
import org.elasticsearch.bootstrap.BootstrapInfo;
import org.elasticsearch.common.logging.NodeNameInLogsIntegTestCase; import org.elasticsearch.common.logging.NodeNameInLogsIntegTestCase;
import java.io.IOException; import java.io.IOException;
@ -32,6 +33,8 @@ import java.security.PrivilegedAction;
public class NodeNameInLogsIT extends NodeNameInLogsIntegTestCase { public class NodeNameInLogsIT extends NodeNameInLogsIntegTestCase {
@Override @Override
protected BufferedReader openReader(Path logFile) throws IOException { protected BufferedReader openReader(Path logFile) throws IOException {
assumeTrue("We log a line without the node name if we can't install the seccomp filters",
BootstrapInfo.isSystemCallFilterInstalled());
return AccessController.doPrivileged((PrivilegedAction<BufferedReader>) () -> { return AccessController.doPrivileged((PrivilegedAction<BufferedReader>) () -> {
try { try {
return Files.newBufferedReader(logFile, StandardCharsets.UTF_8); return Files.newBufferedReader(logFile, StandardCharsets.UTF_8);