HADOOP-15947. Fix ITestDynamoDBMetadataStore test error issues. Contributed by Gabor Bota.
This commit is contained in:
parent
e148c3ff09
commit
085f10e75d
|
@ -633,7 +633,7 @@ public class DynamoDBMetadataStore implements MetadataStore {
|
||||||
LOG.trace("Listing table {} in region {} for {} returning {}",
|
LOG.trace("Listing table {} in region {} for {} returning {}",
|
||||||
tableName, region, path, metas);
|
tableName, region, path, metas);
|
||||||
|
|
||||||
return (metas.isEmpty() || dirPathMeta == null)
|
return (metas.isEmpty() && dirPathMeta == null)
|
||||||
? null
|
? null
|
||||||
: new DirListingMetadata(path, metas, isAuthoritative,
|
: new DirListingMetadata(path, metas, isAuthoritative,
|
||||||
dirPathMeta.getLastUpdated());
|
dirPathMeta.getLastUpdated());
|
||||||
|
|
|
@ -80,6 +80,11 @@ import static org.apache.hadoop.test.LambdaTestUtils.*;
|
||||||
* A table will be created and shared between the tests,
|
* A table will be created and shared between the tests,
|
||||||
*/
|
*/
|
||||||
public class ITestDynamoDBMetadataStore extends MetadataStoreTestBase {
|
public class ITestDynamoDBMetadataStore extends MetadataStoreTestBase {
|
||||||
|
|
||||||
|
public ITestDynamoDBMetadataStore() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
LoggerFactory.getLogger(ITestDynamoDBMetadataStore.class);
|
LoggerFactory.getLogger(ITestDynamoDBMetadataStore.class);
|
||||||
public static final PrimaryKey
|
public static final PrimaryKey
|
||||||
|
@ -574,8 +579,8 @@ public class ITestDynamoDBMetadataStore extends MetadataStoreTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProvisionTable() throws IOException {
|
public void testProvisionTable() throws Exception {
|
||||||
final String tableName = "testProvisionTable";
|
final String tableName = "testProvisionTable-" + UUID.randomUUID();
|
||||||
Configuration conf = getFileSystem().getConf();
|
Configuration conf = getFileSystem().getConf();
|
||||||
conf.set(S3GUARD_DDB_TABLE_NAME_KEY, tableName);
|
conf.set(S3GUARD_DDB_TABLE_NAME_KEY, tableName);
|
||||||
|
|
||||||
|
@ -587,13 +592,18 @@ public class ITestDynamoDBMetadataStore extends MetadataStoreTestBase {
|
||||||
ddbms.provisionTable(oldProvision.getReadCapacityUnits() * 2,
|
ddbms.provisionTable(oldProvision.getReadCapacityUnits() * 2,
|
||||||
oldProvision.getWriteCapacityUnits() * 2);
|
oldProvision.getWriteCapacityUnits() * 2);
|
||||||
ddbms.initTable();
|
ddbms.initTable();
|
||||||
|
// we have to wait until the provisioning settings are applied,
|
||||||
|
// so until the table is ACTIVE again and not in UPDATING
|
||||||
|
ddbms.getTable().waitForActive();
|
||||||
final ProvisionedThroughputDescription newProvision =
|
final ProvisionedThroughputDescription newProvision =
|
||||||
dynamoDB.getTable(tableName).describe().getProvisionedThroughput();
|
dynamoDB.getTable(tableName).describe().getProvisionedThroughput();
|
||||||
LOG.info("Old provision = {}, new provision = {}", oldProvision,
|
LOG.info("Old provision = {}, new provision = {}", oldProvision,
|
||||||
newProvision);
|
newProvision);
|
||||||
assertEquals(oldProvision.getReadCapacityUnits() * 2,
|
assertEquals("Check newly provisioned table read capacity units.",
|
||||||
|
oldProvision.getReadCapacityUnits() * 2,
|
||||||
newProvision.getReadCapacityUnits().longValue());
|
newProvision.getReadCapacityUnits().longValue());
|
||||||
assertEquals(oldProvision.getWriteCapacityUnits() * 2,
|
assertEquals("Check newly provisioned table write capacity units.",
|
||||||
|
oldProvision.getWriteCapacityUnits() * 2,
|
||||||
newProvision.getWriteCapacityUnits().longValue());
|
newProvision.getWriteCapacityUnits().longValue());
|
||||||
ddbms.destroy();
|
ddbms.destroy();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue