diff --git a/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java b/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java index cfb10c3..64ee68e 100644 --- a/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java +++ b/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudComputeService.java @@ -20,6 +20,7 @@ import java.util.Collections; import java.util.Properties; +import java.util.Map; import java.util.Set; import org.jclouds.Constants; @@ -53,12 +54,13 @@ private final String mImageId; private final String mkeyPair; private final String mSecurityGroup; + private final Map mUserMetadata; /** * JClouds requests on-demand instances when null */ private final Float mMaxBid; public CloudComputeService(String apiKey, String accessKey, String instanceType, String groupName, - String imageId, String keyPair, String securityGroup, Float maxBid) { + String imageId, String keyPair, String securityGroup, Float maxBid, Map userMetadata) { mInstanceType = instanceType; mGroupName = groupName; mImageId = imageId; @@ -66,6 +68,7 @@ public CloudComputeService(String apiKey, String accessKey, String instanceType, mSecurityGroup = securityGroup; mMaxBid = maxBid; mGroupTag = "group=" + mGroupName; + mUserMetadata = userMetadata; Properties overrides = new Properties(); overrides.put(ComputeServiceProperties.POLL_INITIAL_PERIOD, String.valueOf(60L * 1000L)); overrides.put(ComputeServiceProperties.POLL_MAX_PERIOD, String.valueOf(600L * 1000L)); @@ -84,7 +87,8 @@ public CloudComputeService(String apiKey, String accessKey, String instanceType, .hardwareId(mInstanceType).imageId(mImageId).build(); template.getOptions().as(AWSEC2TemplateOptions.class).keyPair(mkeyPair) .securityGroupIds(mSecurityGroup).blockOnPort(22, 60) - .spotPrice(mMaxBid).tags(Collections.singletonList(mGroupTag)); + .spotPrice(mMaxBid).tags(Collections.singletonList(mGroupTag)) + .userMetadata(mUserMetadata); result.addAll(mComputeService.createNodesInGroup(mGroupName, count, template)); return result; } diff --git a/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java b/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java index e7a5752..8e5d6de 100644 --- a/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java +++ b/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java @@ -69,6 +69,7 @@ public static final String USERNAME = "user"; public static final String INSTANCE_TYPE = "instanceType"; public static final String NUM_THREADS = "numThreads"; + public static final String USER_METADATA = "userMetadata"; private final RandomAccessFile mHostLog; private final String mPrivateKey; @@ -449,7 +450,7 @@ private static CloudExecutionContextProvider create(Context context, Integer numThreads = context.getInteger(NUM_THREADS, 3); String instanceType = context.getString(INSTANCE_TYPE, "c1.xlarge"); CloudComputeService cloudComputeService = new CloudComputeService(apiKey, accessKey, - instanceType, groupName, imageId, keyPair, securityGroup, maxBid); + instanceType, groupName, imageId, keyPair, securityGroup, maxBid, context.getSubProperties(USER_METADATA)); CloudExecutionContextProvider service = new CloudExecutionContextProvider( dataDir, numHosts, cloudComputeService, new SSHCommandExecutor(LOG), workingDirectory, privateKey, user, localDirs, numThreads, 60, maxHostsPerCreateRequest); diff --git a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt index 07d99ab..0ae4fc2 100644 --- a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt +++ b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt @@ -85,7 +85,7 @@ fi echo $pid >> batch.pid wait $pid ret=$? -find ./ -type f -name hive.log | \ +find ./ -type f -name hive.log -o -name spark.log | \ xargs -I {} sh -c 'f=$(basename {}); test -f /some/log/dir/$f && f=$f-$(uuidgen); mv {} /some/log/dir/$f' find ./ -type f -name 'TEST-*.xml' | \ xargs -I {} sh -c 'f=TEST-batch-1-$(basename {}); test -f /some/log/dir/$f && f=$f-$(uuidgen); mv {} /some/log/dir/$f' diff --git a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt index b6e8e14..c6c524c 100644 --- a/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt +++ b/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt @@ -85,7 +85,7 @@ fi echo $pid >> batch.pid wait $pid ret=$? -find ./ -type f -name hive.log | \ +find ./ -type f -name hive.log -o -name spark.log | \ xargs -I {} sh -c 'f=$(basename {}); test -f /some/log/dir/$f && f=$f-$(uuidgen); mv {} /some/log/dir/$f' find ./ -type f -name 'TEST-*.xml' | \ xargs -I {} sh -c 'f=TEST-batch-1-$(basename {}); test -f /some/log/dir/$f && f=$f-$(uuidgen); mv {} /some/log/dir/$f'