Index: src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java (revision 1574173) +++ src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java (working copy) @@ -66,6 +66,7 @@ public class SnapshotTestingUtils { private static final Log LOG = LogFactory.getLog(SnapshotTestingUtils.class); + private static byte[] KEYS = Bytes.toBytes("0123456789"); /** * Assert that we don't have any snapshots lists @@ -421,14 +422,13 @@ HColumnDescriptor hcd = new HColumnDescriptor(family); htd.addFamily(hcd); } - byte[][] splitKeys = new byte[14][]; - byte[] hex = Bytes.toBytes("123456789abcde"); + byte[][] splitKeys = new byte[KEYS.length-2][]; for (int i = 0; i < splitKeys.length; ++i) { - splitKeys[i] = new byte[] { hex[i] }; + splitKeys[i] = new byte[] { KEYS[i+1] }; } util.getHBaseAdmin().createTable(htd, splitKeys); waitForTableToBeOnline(util, tableName); - assertEquals(15, util.getHBaseAdmin().getTableRegions(tableName).size()); + assertEquals(KEYS.length-1, util.getHBaseAdmin().getTableRegions(tableName).size()); } public static void loadData(final HBaseTestingUtility util, final byte[] tableName, int rows, @@ -441,8 +441,8 @@ table.setAutoFlush(false); // Ensure one row per region - assertTrue(rows >= 16); - for (byte k0: Bytes.toBytes("0123456789abcdef")) { + assertTrue(rows >= KEYS.length); + for (byte k0: KEYS) { byte[] k = new byte[] { k0 }; byte[] value = Bytes.add(Bytes.toBytes(System.currentTimeMillis()), k); byte[] key = Bytes.add(k, Bytes.toBytes(MD5Hash.getMD5AsHex(value))); Index: src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java (revision 1574173) +++ src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java (working copy) @@ -121,13 +121,6 @@ admin.enableTable(tableName); SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY); snapshot1Rows = TEST_UTIL.countRows(table); - admin.disableTable(tableName); - - // take a snapshot of the updated table - admin.snapshot(snapshotName1, tableName); - - // re-enable table - admin.enableTable(tableName); table.close(); } @@ -141,9 +134,9 @@ @Test public void testRestoreSnapshot() throws IOException { SnapshotTestingUtils.verifyRowCount(TEST_UTIL, tableName, snapshot1Rows); - - // Restore from snapshot-0 admin.disableTable(tableName); + admin.snapshot(snapshotName1, tableName); + // Restore from snapshot-0 admin.restoreSnapshot(snapshotName0); admin.enableTable(tableName); SnapshotTestingUtils.verifyRowCount(TEST_UTIL, tableName, snapshot0Rows);