@Test public void testSnapshotFailsOnNonExistantTable() throws Exception { // make sure we don't fail on listing snapshots SnapshotTestingUtils.assertNoSnapshots(admin); TableName tableName = TableName.valueOf("_not_a_table"); // make sure the table doesn't exist boolean fail = false; do { try { admin.getTableDescriptor(tableName); fail = true; LOG.error("Table:" + tableName + " already exists, checking a new name"); tableName = TableName.valueOf(tableName+"!"); } catch (TableNotFoundException e) { fail = false; } } while (fail); // snapshot the non-existant table try { admin.snapshot("fail", tableName, SnapshotType.FLUSH); fail("Snapshot succeeded even though there is not table."); } catch (SnapshotCreationException e) { LOG.info("Correctly failed to snapshot a non-existant table:" + e.getMessage()); } }
@Test public void testSnapshotFailsOnNonExistantTable() throws Exception { Admin admin = UTIL.getAdmin(); // make sure we don't fail on listing snapshots SnapshotTestingUtils.assertNoSnapshots(admin); String tableName = "_not_a_table"; // make sure the table doesn't exist boolean fail = false; do { try { admin.getTableDescriptor(TableName.valueOf(tableName)); fail = true; LOG.error("Table:" + tableName + " already exists, checking a new name"); tableName = tableName+"!"; } catch (TableNotFoundException e) { fail = false; } } while (fail); // snapshot the non-existant table try { admin.snapshot("fail", TableName.valueOf(tableName)); fail("Snapshot succeeded even though there is not table."); } catch (SnapshotCreationException e) { LOG.info("Correctly failed to snapshot a non-existant table:" + e.getMessage()); } }
@Test public void testSnapshotFailsOnNonExistantTable() throws Exception { // make sure we don't fail on listing snapshots SnapshotTestingUtils.assertNoSnapshots(admin); TableName tableName = TableName.valueOf("_not_a_table"); // make sure the table doesn't exist boolean fail = false; do { try { admin.getTableDescriptor(tableName); fail = true; LOG.error("Table:" + tableName + " already exists, checking a new name"); tableName = TableName.valueOf(tableName+"!"); } catch (TableNotFoundException e) { fail = false; } } while (fail); // snapshot the non-existant table try { admin.snapshot("fail", tableName, SnapshotType.FLUSH); fail("Snapshot succeeded even though there is not table."); } catch (SnapshotCreationException e) { LOG.info("Correctly failed to snapshot a non-existant table:" + e.getMessage()); } }
@Test public void testSnapshotFailsOnNonExistantTable() throws Exception { Admin admin = UTIL.getAdmin(); // make sure we don't fail on listing snapshots SnapshotTestingUtils.assertNoSnapshots(admin); String tableName = "_not_a_table"; // make sure the table doesn't exist boolean fail = false; do { try { admin.getTableDescriptor(TableName.valueOf(tableName)); fail = true; LOG.error("Table:" + tableName + " already exists, checking a new name"); tableName = tableName+"!"; } catch (TableNotFoundException e) { fail = false; } } while (fail); // snapshot the non-existant table try { admin.snapshot("fail", TableName.valueOf(tableName)); fail("Snapshot succeeded even though there is not table."); } catch (SnapshotCreationException e) { LOG.info("Correctly failed to snapshot a non-existant table:" + e.getMessage()); } }