Repository: incubator-slider Updated Branches: refs/heads/develop 73eee5bd6 -> be8adbaf4
SLIDER-246 Improper test cleanup prevented keystore generation Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/be8adbaf Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/be8adbaf Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/be8adbaf Branch: refs/heads/develop Commit: be8adbaf475ffcd7b80d9bf571ac1f57fef897a4 Parents: 73eee5b Author: Jon Maron <jma...@hortonworks.com> Authored: Thu Jul 17 13:14:44 2014 -0400 Committer: Jon Maron <jma...@hortonworks.com> Committed: Thu Jul 17 13:14:44 2014 -0400 ---------------------------------------------------------------------- .../apache/slider/common/SliderXMLConfKeysForTesting.java | 5 +++++ .../slider/providers/agent/TestAgentAMManagementWS.groovy | 10 +++++++++- .../groovy/org/apache/slider/test/SliderTestBase.groovy | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/be8adbaf/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java b/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java index 6d3fe38..e31cfb6 100644 --- a/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java +++ b/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java @@ -71,4 +71,9 @@ public interface SliderXMLConfKeysForTesting { */ String KEY_TEST_YARN_RAM_REQUEST = "slider.test.yarn.ram"; String DEFAULT_YARN_RAM_REQUEST = "192"; + + /** + * security related keys + */ + String TEST_SECURITY_DIR = "/tmp/work/security"; } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/be8adbaf/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy index 7d68458..28f24eb 100644 --- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy @@ -32,6 +32,7 @@ import org.apache.slider.server.appmaster.web.rest.agent.RegistrationResponse import org.apache.slider.server.appmaster.web.rest.agent.RegistrationStatus import org.apache.slider.server.services.security.CertificateManager import org.apache.slider.server.services.security.SecurityUtils +import org.junit.Before import org.junit.Test import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -73,6 +74,12 @@ class TestAgentAMManagementWS extends AgentTestBase { } }); + } + + @Override + @Before + void setup() { + super.setup() MapOperations compOperations = new MapOperations(); compOperations.put(SliderKeys.KEYSTORE_LOCATION, "/tmp/work/security/keystore.p12"); SecurityUtils.initializeSecurityParameters(compOperations); @@ -83,9 +90,10 @@ class TestAgentAMManagementWS extends AgentTestBase { System.setProperty("javax.net.ssl.trustStore", keystoreFile); System.setProperty("javax.net.ssl.trustStorePassword", password); System.setProperty("javax.net.ssl.trustStoreType", "PKCS12"); + } - @Test + @Test public void testAgentAMManagementWS() throws Throwable { def clustername = "test_agentammanagementws" createMiniCluster( http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/be8adbaf/slider-core/src/test/groovy/org/apache/slider/test/SliderTestBase.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestBase.groovy b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestBase.groovy index d632b25..032ad42 100644 --- a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestBase.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestBase.groovy @@ -19,8 +19,12 @@ package org.apache.slider.test import groovy.transform.CompileStatic +import org.apache.hadoop.fs.FileUtil +import org.apache.slider.common.SliderXMLConfKeysForTesting import org.junit.Before +import java.nio.file.Files + /** * Base class for unit tests as well as ones starting mini clusters * -the foundational code and methods @@ -35,6 +39,7 @@ public abstract class SliderTestBase extends SliderTestUtils { public void setup() { //give our thread a name Thread.currentThread().name = "JUnit" + FileUtil.fullyDelete(new File(SliderXMLConfKeysForTesting.TEST_SECURITY_DIR)) } }