HBASE-15034 IntegrationTestDDLMasterFailover does not clean created namespaces.
Signed-off-by: Matteo Bertozzi <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0bdd6e48 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0bdd6e48 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0bdd6e48 Branch: refs/heads/hbase-12439 Commit: 0bdd6e487fa89ff614593cd3a32e690c1d380e22 Parents: 6fc2596 Author: Samir Ahmic <[email protected]> Authored: Wed Dec 23 23:30:26 2015 +0100 Committer: Matteo Bertozzi <[email protected]> Committed: Thu Dec 24 04:53:20 2015 -0800 ---------------------------------------------------------------------- .../hbase/IntegrationTestDDLMasterFailover.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/0bdd6e48/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java ---------------------------------------------------------------------- diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java index d9c7caa..4b75ce2 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java @@ -103,7 +103,7 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { protected static final int DEFAULT_NUM_REGIONS = 50; // number of regions in pre-split tables - private boolean keepTableAtTheEnd = false; + private boolean keepObjectsAtTheEnd = false; protected HBaseCluster cluster; protected Connection connection; @@ -144,11 +144,19 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { @Override public void cleanUpCluster() throws Exception { - if (!keepTableAtTheEnd) { - Admin admin = util.getHBaseAdmin(); + if (!keepObjectsAtTheEnd) { + Admin admin = util.getAdmin(); admin.disableTables("ittable-\\d+"); admin.deleteTables("ittable-\\d+"); + NamespaceDescriptor [] nsds = admin.listNamespaceDescriptors(); + for(NamespaceDescriptor nsd:nsds ) { + if(nsd.getName().matches("itnamespace\\d+")) { + LOG.info("Removing namespace="+nsd.getName()); + admin.deleteNamespace(nsd.getName()); + } + } } + enabledTables.clear(); disabledTables.clear(); deletedTables.clear(); @@ -938,9 +946,9 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase { LOG.info("Running hbck"); hbck = HbckTestingUtil.doFsck(util.getConfiguration(), false); if (HbckTestingUtil.inconsistencyFound(hbck)) { - // Find the inconsistency during HBCK. Leave table undropped so that + // Find the inconsistency during HBCK. Leave table and namespace undropped so that // we can check outside the test. - keepTableAtTheEnd = true; + keepObjectsAtTheEnd = true; } HbckTestingUtil.assertNoErrors(hbck); LOG.info("Finished hbck");
