HBASE-16889 Proc-V2: verifyTables in the IntegrationTestDDLMasterFailover test after each table DDL is incorrect (Stephen Yuan Jiang)

This commit is contained in:
Stephen Yuan Jiang 2016-10-20 18:21:23 -07:00
parent f1691e3d0d
commit d3decaab8e
1 changed files with 33 additions and 21 deletions

View File

@ -294,15 +294,14 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
admin.createNamespace(nsd);
NamespaceDescriptor freshNamespaceDesc = admin.getNamespaceDescriptor(nsd.getName());
Assert.assertTrue("Namespace: " + nsd + " was not created", freshNamespaceDesc != null);
LOG.info("Created namespace:" + freshNamespaceDesc);
namespaceMap.put(nsd.getName(), freshNamespaceDesc);
LOG.info("Created namespace:" + freshNamespaceDesc);
} catch (Exception e){
LOG.warn("Caught exception in action: " + this.getClass());
throw e;
} finally {
admin.close();
}
verifyNamespaces();
}
private NamespaceDescriptor createNamespaceDesc() {
@ -340,15 +339,17 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
Assert.assertTrue(
"Namespace: " + selected + " was not modified",
freshNamespaceDesc.getConfigurationValue(nsTestConfigKey).equals(nsValueNew));
LOG.info("Modified namespace :" + freshNamespaceDesc);
Assert.assertTrue(
"Namespace: " + namespaceName + " does not exist",
admin.getNamespaceDescriptor(namespaceName) != null);
namespaceMap.put(namespaceName, freshNamespaceDesc);
LOG.info("Modified namespace :" + freshNamespaceDesc);
} catch (Exception e){
LOG.warn("Caught exception in action: " + this.getClass());
throw e;
} finally {
admin.close();
}
verifyNamespaces();
}
}
@ -382,7 +383,6 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
} finally {
admin.close();
}
verifyNamespaces();
}
}
@ -425,6 +425,8 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
admin.createTable(htd, startKey, endKey, numRegions);
Assert.assertTrue("Table: " + htd + " was not created", admin.tableExists(tableName));
HTableDescriptor freshTableDesc = admin.getTableDescriptor(tableName);
Assert.assertTrue(
"After create, Table: " + tableName + " in not enabled", admin.isTableEnabled(tableName));
enabledTables.put(tableName, freshTableDesc);
LOG.info("Created table:" + freshTableDesc);
} catch (Exception e) {
@ -433,7 +435,6 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
} finally {
admin.close();
}
verifyTables();
}
private HTableDescriptor createTableDesc() {
@ -465,6 +466,9 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
Assert.assertTrue("Table: " + selected + " was not disabled",
admin.isTableDisabled(tableName));
HTableDescriptor freshTableDesc = admin.getTableDescriptor(tableName);
Assert.assertTrue(
"After disable, Table: " + tableName + " is not disabled",
admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Disabled table :" + freshTableDesc);
} catch (Exception e){
@ -490,7 +494,6 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
} finally {
admin.close();
}
verifyTables();
}
}
@ -512,6 +515,8 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
Assert.assertTrue("Table: " + selected + " was not enabled",
admin.isTableEnabled(tableName));
HTableDescriptor freshTableDesc = admin.getTableDescriptor(tableName);
Assert.assertTrue(
"After enable, Table: " + tableName + " in not enabled", admin.isTableEnabled(tableName));
enabledTables.put(tableName, freshTableDesc);
LOG.info("Enabled table :" + freshTableDesc);
} catch (Exception e){
@ -537,7 +542,6 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
} finally {
admin.close();
}
verifyTables();
}
}
@ -566,7 +570,6 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
} finally {
admin.close();
}
verifyTables();
}
}
@ -611,15 +614,17 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
HTableDescriptor freshTableDesc = admin.getTableDescriptor(tableName);
Assert.assertTrue("Column family: " + cfd + " was not added",
freshTableDesc.hasFamily(cfd.getName()));
LOG.info("Added column family: " + cfd + " to table: " + tableName);
Assert.assertTrue(
"After add column family, Table: " + tableName + " is not disabled",
admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Added column family: " + cfd + " to table: " + tableName);
} catch (Exception e) {
LOG.warn("Caught exception in action: " + this.getClass());
throw e;
} finally {
admin.close();
}
verifyTables();
}
private HColumnDescriptor createFamilyDesc() {
@ -658,16 +663,18 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
freshColumnDesc.getMaxVersions(), versions);
Assert.assertEquals("Column family: " + freshColumnDesc + " was not altered",
freshColumnDesc.getMinVersions(), versions);
Assert.assertTrue(
"After alter versions of column family, Table: " + tableName + " is not disabled",
admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Altered versions of column family: " + columnDesc + " to: " + versions +
" in table: " + tableName);
disabledTables.put(tableName, freshTableDesc);
} catch (Exception e) {
LOG.warn("Caught exception in action: " + this.getClass());
throw e;
} finally {
admin.close();
}
verifyTables();
}
}
@ -699,16 +706,18 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
HColumnDescriptor freshColumnDesc = freshTableDesc.getFamily(columnDesc.getName());
Assert.assertEquals("Encoding of column family: " + columnDesc + " was not altered",
freshColumnDesc.getDataBlockEncoding().getId(), id);
Assert.assertTrue(
"After alter encoding of column family, Table: " + tableName + " is not disabled",
admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Altered encoding of column family: " + freshColumnDesc + " to: " + id +
" in table: " + tableName);
disabledTables.put(tableName, freshTableDesc);
} catch (Exception e) {
LOG.warn("Caught exception in action: " + this.getClass());
throw e;
} finally {
admin.close();
}
verifyTables();
}
}
@ -735,15 +744,17 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
HTableDescriptor freshTableDesc = admin.getTableDescriptor(tableName);
Assert.assertFalse("Column family: " + cfd + " was not added",
freshTableDesc.hasFamily(cfd.getName()));
LOG.info("Deleted column family: " + cfd + " from table: " + tableName);
Assert.assertTrue(
"After delete column family, Table: " + tableName + " is not disabled",
admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Deleted column family: " + cfd + " from table: " + tableName);
} catch (Exception e) {
LOG.warn("Caught exception in action: " + this.getClass());
throw e;
} finally {
admin.close();
}
verifyTables();
}
}
@ -782,6 +793,8 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
table.put(put);
}
HTableDescriptor freshTableDesc = admin.getTableDescriptor(tableName);
Assert.assertTrue(
"After insert, Table: " + tableName + " in not enabled", admin.isTableEnabled(tableName));
enabledTables.put(tableName, freshTableDesc);
LOG.info("Added " + numRows + " rows to table: " + selected);
} catch (Exception e) {
@ -790,7 +803,6 @@ public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
} finally {
admin.close();
}
verifyTables();
}
}