SLIDER-875 fix more funtest failures

Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/50db94ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/50db94ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/50db94ce

Branch: refs/heads/develop
Commit: 50db94ce41e566b278ecb9c5079e97f7881fac63
Parents: 937b45b
Author: Billie Rinaldi <billie.rina...@gmail.com>
Authored: Wed Aug 10 13:24:02 2016 -0700
Committer: Billie Rinaldi <billie.rina...@gmail.com>
Committed: Thu Aug 11 10:07:40 2016 -0700

----------------------------------------------------------------------
 .../funtest/accumulo/AccumuloBasicIT.groovy       |  3 +++
 .../funtest/accumulo/AccumuloReadWriteIT.groovy   |  2 +-
 .../accumulo/AccumuloReadWriteSSLIT.groovy        |  2 +-
 .../funtest/accumulo/AccumuloScriptIT.groovy      |  2 +-
 .../funtest/accumulo/AccumuloScriptSSLIT.groovy   |  2 +-
 .../providers/agent/AgentProviderService.java     | 18 ++++++++++++++++++
 .../test_min_pkg/sleep_cmd/resources.json         |  2 +-
 7 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/50db94ce/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
----------------------------------------------------------------------
diff --git 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
index 81d290a..260743f 100644
--- 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
+++ 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
@@ -47,6 +47,7 @@ import static 
org.apache.hadoop.registry.client.binding.RegistryUtils.servicePat
 class AccumuloBasicIT extends AccumuloAgentCommandTestBase {
   protected static final String PROVIDER_PROPERTY = "site.accumulo-site." +
     Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS
+  protected static final String INSTANCE_PROPERTY = "site.client.instance.name"
   protected static final String KEY_PASS = "keypass"
   protected static final String TRUST_PASS = "trustpass"
   protected ConfTree tree
@@ -115,6 +116,8 @@ class AccumuloBasicIT extends AccumuloAgentCommandTestBase {
     provider.flush()
     assert clusterFS.exists(jksPath), "jks $jks not created"
     log.info("Created credential provider $jks for test")
+    tree.global.put(INSTANCE_PROPERTY, tree.global.get(INSTANCE_PROPERTY)
+      .replaceAll(Pattern.quote('${CLUSTER_NAME}'), clusterName))
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/50db94ce/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy
----------------------------------------------------------------------
diff --git 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy
 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy
index 0ecf210..d5c85bc 100644
--- 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy
+++ 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy
@@ -55,7 +55,7 @@ class AccumuloReadWriteIT extends AccumuloBasicIT {
 
       ClientConfiguration configuration = new ClientConfiguration()
       
configuration.setProperty(ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST, 
zookeepers)
-      
configuration.setProperty(ClientConfiguration.ClientProperty.INSTANCE_NAME, 
tree.global.get("site.client.instance.name"))
+      
configuration.setProperty(ClientConfiguration.ClientProperty.INSTANCE_NAME, 
tree.global.get(INSTANCE_PROPERTY))
 
       ZooKeeperInstance instance = new ZooKeeperInstance(configuration)
       Connector connector = instance.getConnector(USER, new 
PasswordToken(PASSWORD))

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/50db94ce/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteSSLIT.groovy
----------------------------------------------------------------------
diff --git 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteSSLIT.groovy
 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteSSLIT.groovy
index b67cd5c..90f5fa1 100644
--- 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteSSLIT.groovy
+++ 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteSSLIT.groovy
@@ -50,7 +50,7 @@ class AccumuloReadWriteSSLIT extends AccumuloSSLTestBase {
         RegistryConstants.KEY_REGISTRY_ZK_QUORUM,
       FuntestProperties.DEFAULT_SLIDER_ZK_HOSTS)
     ClientConfiguration conf = new ClientConfiguration()
-      .withInstance(tree.global.get("site.client.instance.name"))
+      .withInstance(tree.global.get(INSTANCE_PROPERTY))
       .withZkHosts(zookeepers)
       .withSsl(true)
       .withKeystore(clientKeyStoreFile.toString(), KEY_PASS, STORE_TYPE)

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/50db94ce/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptIT.groovy
----------------------------------------------------------------------
diff --git 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptIT.groovy
 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptIT.groovy
index 24b6e22..8307104 100644
--- 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptIT.groovy
+++ 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptIT.groovy
@@ -140,7 +140,7 @@ class AccumuloScriptIT extends AccumuloBasicIT {
     String zookeepers = SLIDER_CONFIG.get(
       RegistryConstants.KEY_REGISTRY_ZK_QUORUM,
       FuntestProperties.DEFAULT_SLIDER_ZK_HOSTS)
-    String instance = tree.global.get("site.client.instance.name")
+    String instance = tree.global.get(INSTANCE_PROPERTY)
     accumulo("shell -u $USER -p $PASSWORD -e \"createtable test1\"")
     accumulo(InsertWithBatchWriter.class.getName() + " -i $instance -z " +
       "$zookeepers -u $USER -p $PASSWORD -t test1")

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/50db94ce/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptSSLIT.groovy
----------------------------------------------------------------------
diff --git 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptSSLIT.groovy
 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptSSLIT.groovy
index 710812d..66ce13e 100644
--- 
a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptSSLIT.groovy
+++ 
b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloScriptSSLIT.groovy
@@ -141,7 +141,7 @@ class AccumuloScriptSSLIT extends AccumuloSSLTestBase {
     String zookeepers = SLIDER_CONFIG.get(
       RegistryConstants.KEY_REGISTRY_ZK_QUORUM,
       FuntestProperties.DEFAULT_SLIDER_ZK_HOSTS)
-    String instance = tree.global.get("site.client.instance.name")
+    String instance = tree.global.get(INSTANCE_PROPERTY)
     accumulo("shell -u $USER -p $PASSWORD -e \"createtable test2\"")
     accumulo(InsertWithBatchWriter.class.getName() + " -i $instance -z " +
       "$zookeepers -u $USER -p $PASSWORD -t test2")

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/50db94ce/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
 
b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
index 4d68ba2..7594d51 100644
--- 
a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
+++ 
b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
@@ -129,6 +129,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Scanner;
 import java.util.Set;
 import java.util.TreeMap;
@@ -136,6 +137,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Pattern;
 
 import static org.apache.slider.api.RoleKeys.ROLE_PREFIX;
 import static 
org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_AGENTS;
@@ -663,6 +665,22 @@ public class AgentProviderService extends 
AbstractProviderService implements
                                                AggregateConf 
instanceDefinition,
                                                MapOperations compOps)
       throws SliderException, IOException {
+    // substitute CLUSTER_NAME into credentials
+    Map<String,List<String>> newcred = new HashMap<>();
+    for (Entry<String,List<String>> entry : 
instanceDefinition.getAppConf().credentials.entrySet()) {
+      List<String> resultList = new ArrayList<>();
+      for (String v : entry.getValue()) {
+        resultList.add(v.replaceAll(Pattern.quote("${CLUSTER_NAME}"),
+            clusterName).replaceAll(Pattern.quote("${CLUSTER}"),
+            clusterName));
+      }
+      newcred.put(entry.getKey().replaceAll(Pattern.quote("${CLUSTER_NAME}"),
+          clusterName).replaceAll(Pattern.quote("${CLUSTER}"),
+          clusterName),
+          resultList);
+    }
+    instanceDefinition.getAppConf().credentials = newcred;
+
     // generate and localize security stores
     SecurityStore[] stores = generateSecurityStores(container, role,
                                                     instanceDefinition, 
compOps);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/50db94ce/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
----------------------------------------------------------------------
diff --git 
a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json 
b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
index e0ed16a..b9eeb10 100644
--- a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
+++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
@@ -6,7 +6,7 @@
   },
   "components": {
     "slider-appmaster": {
-      "yarn.memory": "256"
+      "yarn.memory": "384"
     },
     "SLEEP_100": {
       "yarn.role.priority": "1",

Reply via email to