Class JsonLogsIntegTestCase

java.lang.Object
org.junit.Assert
org.apache.lucene.util.LuceneTestCase
org.elasticsearch.test.ESTestCase
org.elasticsearch.test.rest.ESRestTestCase
org.elasticsearch.common.logging.JsonLogsIntegTestCase

public abstract class JsonLogsIntegTestCase extends ESRestTestCase
Tests that extend this class verify that all json layout fields appear in the first few log lines after startup Fields available upon process startup: type, timestamp, level, component, message, node.name, cluster.name. Whereas node.id and cluster.uuid are available later once the first clusterState has been received. node.name, cluster.name, node.id, cluster.uuid should not change across all log lines Note that this won't pass for nodes in clusters that don't have the node name defined in elasticsearch.yml and start with DEBUG or TRACE level logging. Those nodes log a few lines before the node.name is set by LogConfigurator.setNodeName.
  • Constructor Details

    • JsonLogsIntegTestCase

      public JsonLogsIntegTestCase()
  • Method Details

    • nodeNameMatcher

      protected abstract org.hamcrest.Matcher<String> nodeNameMatcher()
      The node name to expect in the log file.
    • openReader

      protected abstract BufferedReader openReader(Path logFile)
      Open the log file. This is delegated to subclasses because the test framework doesn't have permission to read from the log file but subclasses can grant themselves that permission.
    • testElementsPresentOnAllLinesOfLog

      public void testElementsPresentOnAllLinesOfLog() throws IOException
      Throws:
      IOException
    • testNodeIdAndClusterIdConsistentOnceAvailable

      public void testNodeIdAndClusterIdConsistentOnceAvailable() throws IOException
      Throws:
      IOException
    • getLogFileName

      protected String getLogFileName()
    • getParser

      protected org.elasticsearch.xcontent.ObjectParser<JsonLogLine,Void> getParser()