@Test(timeout = 30000)
public void testTriggerBlockReport() throws Exception {

  redirectStream();
  final DFSAdmin dfsAdmin = new DFSAdmin(conf);
  final DataNode dn = cluster.getDataNodes().get(0);
  final NameNode nn = cluster.getNameNode();
  final String dnAddr = String.format(
      "%s:%d",
      dn.getXferAddress().getHostString(),
      dn.getIpcPort());
  final String nnAddr = nn.getHostAndPort();
  resetStream();
  final List<String> outs = Lists.newArrayList();
  final int ret = ToolRunner.run(dfsAdmin,
      new String[]{"-triggerBlockReport", dnAddr, "-incremental", "-namenode", nnAddr});
  assertEquals(0, ret);
  scanIntoList(out, outs);
  assertEquals(1, outs.size());
  assertThat(outs.get(0),
      is(allOf(containsString("Triggering an incremental block report on "),
          containsString(" to namenode "))));
}