Class 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 Detail

      • JsonLogsIntegTestCase

        public JsonLogsIntegTestCase()
    • Method Detail

      • nodeNameMatcher

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

        protected abstract java.io.BufferedReader openReader​(java.nio.file.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 java.io.IOException
        Throws:
        java.io.IOException
      • testNodeIdAndClusterIdConsistentOnceAvailable

        public void testNodeIdAndClusterIdConsistentOnceAvailable()
                                                           throws java.io.IOException
        Throws:
        java.io.IOException