@Test
  @ExtendWith(LlapDaemonExtension.class)
  @ExtendWith(DoNothingTCPServerExtension.class)
  void testQueryRoutingNoLeakFileDescriptors(LlapDaemon daemon, DoNothingTCPServer amMockServer)
      throws IOException, InterruptedException {
    final int amPort = amMockServer.port();
    Credentials credentials = validSessionCredentials();
    String appId = "application_1540489363818_0021";
    for (int i = 0; i < 10; i++) {
      String queryId = "query" + i;
      int dagId = 1000 + i;
      daemon.registerDag(LlapDaemonTestUtils.buildRegisterDagRequest(appId, dagId, credentials));
      daemon.submitWork(LlapDaemonTestUtils.buildSubmitProtoRequest(appId, dagId, queryId, amPort, credentials));
      daemon.queryComplete(LlapDaemonTestUtils.buildQueryCompleteRequest(appId, dagId));
    }
    // Busy wait till all daemon tasks are treated 
    while (!daemon.getExecutorsStatus().isEmpty()) {
      Thread.sleep(100);
    }
    // The IdlePurgePolicy used should close appenders after 5 seconds of inactivity.
    // Wait for 8 sec to give some margin. 
    Thread.sleep(8000);
    Pattern pn = Pattern.compile("query\\d++-dag_1540489363818_0021_\\d{4}\\.log");
    assertEquals(0, findOpenFileDescriptors(pn).count());
  }
Tests for the log4j configuration of the LLAP daemons.
llap-server/src/test/org/apache/hadoop/hive/llap/daemon/impl/TestLlapDaemonLogging.java