SLIDER-146 added test for providing ssl certs on local fs
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/f507a4c0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/f507a4c0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/f507a4c0 Branch: refs/heads/feature/SLIDER-481_allow_dedicated_handling_of_exports Commit: f507a4c04093ca28616f95417ba4c8fd3bc01298 Parents: 7704bf0 Author: Billie Rinaldi <billie.rina...@gmail.com> Authored: Mon Oct 13 20:01:02 2014 -0700 Committer: Billie Rinaldi <billie.rina...@gmail.com> Committed: Mon Oct 13 20:01:02 2014 -0700 ---------------------------------------------------------------------- .../package/scripts/accumulo_configuration.py | 5 +- .../accumulo/AccumuloMonitorSSLIT.groovy | 1 - .../AccumuloMonitorSSLLocalCertsIT.groovy | 72 ++++++++++++++++++++ .../funtest/accumulo/AccumuloSSLTestBase.groovy | 5 +- 4 files changed, 77 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f507a4c0/app-packages/accumulo/package/scripts/accumulo_configuration.py ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/package/scripts/accumulo_configuration.py b/app-packages/accumulo/package/scripts/accumulo_configuration.py index b883c6f..fb4410e 100644 --- a/app-packages/accumulo/package/scripts/accumulo_configuration.py +++ b/app-packages/accumulo/package/scripts/accumulo_configuration.py @@ -39,8 +39,9 @@ def setup_conf_dir(name=None): # 'master' or 'tserver' or 'monitor' or 'gc' or ' if os.path.exists(params.keystore_path) or os.path.exists(params.truststore_path): if os.path.exists(params.keystore_path) and os.path.exists(params.truststore_path): # assume keystores were already set up properly - return - self.fail_with_error("something went wrong when certs were created") + pass + else: + self.fail_with_error("something went wrong when certs were created") Directory( format("{params.conf_dir}/ssl"), owner = params.accumulo_user, http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f507a4c0/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy index 7a901ca..b47689a 100644 --- a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy +++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy @@ -20,7 +20,6 @@ package org.apache.slider.funtest.accumulo import groovy.util.logging.Slf4j import org.apache.slider.api.ClusterDescription import org.apache.slider.client.SliderClient -import org.apache.slider.common.tools.SliderUtils import org.apache.slider.core.conf.ConfTree import javax.net.ssl.KeyManager http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f507a4c0/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLLocalCertsIT.groovy ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLLocalCertsIT.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLLocalCertsIT.groovy new file mode 100644 index 0000000..b4b8c03 --- /dev/null +++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLLocalCertsIT.groovy @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.slider.funtest.accumulo + +import groovy.json.JsonSlurper +import org.apache.accumulo.core.conf.Property +import org.apache.slider.api.ClusterDescription +import org.apache.slider.client.SliderClient +import org.apache.slider.core.conf.ConfTree +import org.apache.slider.funtest.framework.SliderShell + +class AccumuloMonitorSSLLocalCertsIT extends AccumuloMonitorSSLIT { + protected String templateName() { + return sysprop("test.app.resources.dir") + "/appConfig_monitor_ssl_local_certs.json" + } + + protected ConfTree modifyTemplate(ConfTree confTree) { + confTree = super.modifyTemplate(confTree) + confTree.global.put("site.accumulo-site." + Property.RPC_SSL_KEYSTORE_PATH.toString(), + clientKeyStoreFile.getAbsolutePath()) + confTree.global.put("site.accumulo-site." + Property.RPC_SSL_TRUSTSTORE_PATH.toString(), + trustStoreFile.getAbsolutePath()) + return confTree + } + + @Override + public String getClusterName() { + return "test_monitor_ssl_local_certs"; + } + + @Override + public String getDescription() { + return "Test enable monitor SSL with local certs $clusterName" + } + + @Override + public void clusterLoadOperations(ClusterDescription cd, SliderClient sliderClient) { + super.clusterLoadOperations(cd, sliderClient) + File accumuloSiteFile = new File(TEST_APP_PKG_DIR, "accumulo-site.json") + SliderShell shell = registry(EXIT_SUCCESS, + [ + ARG_GETCONF, "accumulo-site", + ARG_NAME, getClusterName(), + ARG_FORMAT, "json", + ARG_DEST, accumuloSiteFile.getAbsolutePath() + ]) + + logShell(shell) + + def slurper = new JsonSlurper() + def siteconf = slurper.parse(accumuloSiteFile) + assert siteconf[Property.RPC_SSL_KEYSTORE_PATH.toString()] == + clientKeyStoreFile.getAbsolutePath(), "unexpected keystore path" + assert siteconf[Property.RPC_SSL_TRUSTSTORE_PATH.toString()] == + trustStoreFile.getAbsolutePath(), "unexpected truststore path" + } +} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f507a4c0/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy index 5c6ba72..be19583 100644 --- a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy +++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy @@ -22,14 +22,13 @@ import org.apache.accumulo.core.conf.Property import org.apache.hadoop.conf.Configuration import org.apache.hadoop.fs.Path import org.apache.hadoop.yarn.conf.YarnConfiguration -import org.apache.slider.common.tools.SliderUtils import org.apache.slider.core.conf.ConfTree import org.apache.slider.funtest.framework.AgentUploads import org.junit.Before class AccumuloSSLTestBase extends AccumuloBasicIT { - File trustStoreFile = new File(TEST_APP_PKG_DIR, "truststore.jks") - File clientKeyStoreFile = new File(TEST_APP_PKG_DIR, "keystore.jks") + protected static final File trustStoreFile = new File(TEST_APP_PKG_DIR, "truststore.jks") + protected static final File clientKeyStoreFile = new File(TEST_APP_PKG_DIR, "keystore.jks") protected String templateName() { return sysprop("test.app.resources.dir") + "/appConfig_ssl.json"