@Test public void testCheckpointSignature() throws IOException { MiniDFSCluster cluster = null; Configuration conf = new HdfsConfiguration(); SecondaryNameNode secondary = null; try { cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDatanodes) .format(true).build(); NameNode nn = cluster.getNameNode(); NamenodeProtocols nnRpc = nn.getRpcServer(); secondary = startSecondaryNameNode(conf); // prepare checkpoint image secondary.doCheckpoint(); CheckpointSignature sig = nnRpc.rollEditLog(); // manipulate the CheckpointSignature fields sig.setBlockpoolID("somerandomebpid"); sig.clusterID = "somerandomcid"; try { sig.validateStorageInfo(nn.getFSImage()); // this should fail assertTrue("This test is expected to fail.", false); } catch (Exception ignored) { } } finally { cleanup(secondary); secondary = null; cleanup(cluster); cluster = null; } }