@Test
public void testHelp() throws Exception {

  ClusterCLI cli = createAndGetClusterCLI();
  int rc =
      cli.run(new String[] { "cluster", "--help" });
  assertEquals(0, rc);
  
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  PrintWriter pw = new PrintWriter(baos);
  pw.println("usage: yarn cluster");
  pw.println(" -dnl,--directly-access-node-label-store   This is DEPRECATED, will be");
  pw.println("                                           removed in future releases.");
  pw.println("                                           Directly access node label");
  pw.println("                                           store, with this option, all");
  pw.println("                                           node label related operations");
  pw.println("                                           will NOT connect RM. Instead,");
  pw.println("                                           they will access/modify stored");
  pw.println("                                           node labels directly. By");
  pw.println("                                           default, it is false (access");
  pw.println("                                           via RM). AND PLEASE NOTE: if");
  pw.println("                                           you configured");
  pw.println("                                           yarn.node-labels.fs-store.root-");
  pw.println("                                           dir to a local directory");
  pw.println("                                           (instead of NFS or HDFS), this");
  pw.println("                                           option will only work when the");
  pw.println("                                           command run on the machine");
  pw.println("                                           where RM is running. Also, this");
  pw.println("                                           option is UNSTABLE, could be");
  pw.println("                                           removed in future releases.");
  pw.println(" -h,--help                                 Displays help for all commands.");
  pw.println(" -lna,--list-node-attributes               List cluster node-attribute");
  pw.println("                                           collection");
  pw.println(" -lnl,--list-node-labels                   List cluster node-label");
  pw.println("                                           collection");
  pw.close();
  verify(sysOut).println(baos.toString("UTF-8"));
}