|
@@ -116,7 +116,7 @@ public class ITestDynamoDBMetadataStore extends MetadataStoreTestBase {
|
|
@Override
|
|
@Override
|
|
public void setUp() throws Exception {
|
|
public void setUp() throws Exception {
|
|
Configuration conf = prepareTestConfiguration(new Configuration());
|
|
Configuration conf = prepareTestConfiguration(new Configuration());
|
|
- assertThatDynamoMetadataStoreImpl(conf);
|
|
|
|
|
|
+ assumeThatDynamoMetadataStoreImpl(conf);
|
|
Assume.assumeTrue("Test DynamoDB table name should be set to run "
|
|
Assume.assumeTrue("Test DynamoDB table name should be set to run "
|
|
+ "integration tests.", testDynamoDBTableName != null);
|
|
+ "integration tests.", testDynamoDBTableName != null);
|
|
conf.set(S3GUARD_DDB_TABLE_NAME_KEY, testDynamoDBTableName);
|
|
conf.set(S3GUARD_DDB_TABLE_NAME_KEY, testDynamoDBTableName);
|
|
@@ -144,10 +144,24 @@ public class ITestDynamoDBMetadataStore extends MetadataStoreTestBase {
|
|
@BeforeClass
|
|
@BeforeClass
|
|
public static void beforeClassSetup() throws IOException {
|
|
public static void beforeClassSetup() throws IOException {
|
|
Configuration conf = prepareTestConfiguration(new Configuration());
|
|
Configuration conf = prepareTestConfiguration(new Configuration());
|
|
- assertThatDynamoMetadataStoreImpl(conf);
|
|
|
|
|
|
+ assumeThatDynamoMetadataStoreImpl(conf);
|
|
testDynamoDBTableName = conf.get(S3GUARD_DDB_TEST_TABLE_NAME_KEY);
|
|
testDynamoDBTableName = conf.get(S3GUARD_DDB_TEST_TABLE_NAME_KEY);
|
|
- Assume.assumeTrue("Test DynamoDB table name should be set to run "
|
|
|
|
|
|
+
|
|
|
|
+ // We should assert that the table name is configured, so the test should
|
|
|
|
+ // fail if it's not configured.
|
|
|
|
+ assertTrue("Test DynamoDB table name '"
|
|
|
|
+ + S3GUARD_DDB_TEST_TABLE_NAME_KEY + "' should be set to run "
|
|
+ "integration tests.", testDynamoDBTableName != null);
|
|
+ "integration tests.", testDynamoDBTableName != null);
|
|
|
|
+
|
|
|
|
+ // We should assert that the test table is not the same as the production
|
|
|
|
+ // table, as the test table could be modified and destroyed multiple
|
|
|
|
+ // times during the test.
|
|
|
|
+ assertTrue("Test DynamoDB table name: '"
|
|
|
|
+ + S3GUARD_DDB_TEST_TABLE_NAME_KEY + "' and production table name: '"
|
|
|
|
+ + S3GUARD_DDB_TABLE_NAME_KEY + "' can not be the same.",
|
|
|
|
+ !conf.get(S3GUARD_DDB_TABLE_NAME_KEY).equals(testDynamoDBTableName));
|
|
|
|
+
|
|
|
|
+ // We can use that table in the test if these assertions are valid
|
|
conf.set(S3GUARD_DDB_TABLE_NAME_KEY, testDynamoDBTableName);
|
|
conf.set(S3GUARD_DDB_TABLE_NAME_KEY, testDynamoDBTableName);
|
|
|
|
|
|
LOG.debug("Creating static ddbms which will be shared between tests.");
|
|
LOG.debug("Creating static ddbms which will be shared between tests.");
|
|
@@ -169,7 +183,7 @@ public class ITestDynamoDBMetadataStore extends MetadataStoreTestBase {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private static void assertThatDynamoMetadataStoreImpl(Configuration conf){
|
|
|
|
|
|
+ private static void assumeThatDynamoMetadataStoreImpl(Configuration conf){
|
|
Assume.assumeTrue("Test only applies when DynamoDB is used for S3Guard",
|
|
Assume.assumeTrue("Test only applies when DynamoDB is used for S3Guard",
|
|
conf.get(Constants.S3_METADATA_STORE_IMPL).equals(
|
|
conf.get(Constants.S3_METADATA_STORE_IMPL).equals(
|
|
Constants.S3GUARD_METASTORE_DYNAMO));
|
|
Constants.S3GUARD_METASTORE_DYNAMO));
|