ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From magyari_san...@apache.org
Subject ambari git commit: AMBARI-19961. KERBEROS_CLIENT is not included automatically in all hostgroups when scaling a cluster after server restart (magyari_sandor)
Date Tue, 14 Feb 2017 08:32:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 c2952d059 -> 771274a47


AMBARI-19961. KERBEROS_CLIENT is not included automatically in all hostgroups when scaling
a cluster after server restart (magyari_sandor)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/771274a4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/771274a4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/771274a4

Branch: refs/heads/branch-2.5
Commit: 771274a479f5d4f5c13f39ea723dc4de705337d7
Parents: c2952d0
Author: Sandor Magyari <smagyari@hortonworks.com>
Authored: Fri Feb 10 22:09:29 2017 +0100
Committer: Sandor Magyari <smagyari@hortonworks.com>
Committed: Tue Feb 14 09:31:21 2017 +0100

----------------------------------------------------------------------
 .../ambari/server/topology/TopologyManager.java |  6 ++++
 .../server/topology/TopologyManagerTest.java    | 35 +++++++++++++++++---
 2 files changed, 36 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/771274a4/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
index 3103c34..c4c3dd2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
@@ -174,6 +174,12 @@ public class TopologyManager {
       synchronized (initializationLock) {
         if (!isInitialized) {
           replayRequests(persistedState.getAllRequests());
+          // ensure KERBEROS_CLIENT is present in each hostgroup even if it's not in original
BP
+          for(ClusterTopology clusterTopology : clusterTopologyMap.values()) {
+            if (clusterTopology.isClusterKerberosEnabled()) {
+              addKerberosClient(clusterTopology);
+            }
+          }
           isInitialized = true;
         }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/771274a4/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
index cf92911..0d2c731 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
@@ -150,6 +150,9 @@ public class TopologyManagerTest {
   private ResourceProvider resourceProvider;
   @Mock(type = MockType.STRICT)
   private SettingDAO settingDAO;
+  @Mock(type = MockType.NICE)
+  private ClusterTopology clusterTopologyMock;
+
 
   @Mock(type = MockType.STRICT)
   private Future mockFuture;
@@ -343,7 +346,6 @@ public class TopologyManagerTest {
     persistedState.persistLogicalRequest(logicalRequest, 1);
     expectLastCall().anyTimes();
 
-
     Class clazz = TopologyManager.class;
 
     Field f = clazz.getDeclaredField("executor");
@@ -365,12 +367,12 @@ public class TopologyManagerTest {
     PowerMock.verify(System.class);
     verify(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory,
         logicalRequest, configurationRequest, configurationRequest2, configurationRequest3,
-        requestStatusResponse, executor, persistedState, mockFuture, settingDAO);
+        requestStatusResponse, executor, persistedState, clusterTopologyMock, mockFuture,
settingDAO);
 
     PowerMock.reset(System.class);
     reset(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory,
         logicalRequest, configurationRequest, configurationRequest2, configurationRequest3,
-        requestStatusResponse, executor, persistedState, mockFuture, settingDAO);
+        requestStatusResponse, executor, persistedState, clusterTopologyMock, mockFuture,
settingDAO);
   }
 
   @Test
@@ -384,6 +386,29 @@ public class TopologyManagerTest {
   }
 
   @Test
+  public void testAddKerberosClientAtTopologyInit() throws Exception {
+    Map<ClusterTopology, List<LogicalRequest>> allRequests = new HashMap<>();
+    List<LogicalRequest> requestList = new ArrayList<>();
+    requestList.add(logicalRequest);
+    expect(logicalRequest.hasCompleted()).andReturn(true).anyTimes();
+    allRequests.put(clusterTopologyMock, requestList);
+    expect(requestStatusResponse.getTasks()).andReturn(Collections.<ShortTaskStatus>emptyList()).anyTimes();
+    expect(clusterTopologyMock.isClusterKerberosEnabled()).andReturn(true);
+    expect(clusterTopologyMock.getClusterId()).andReturn(CLUSTER_ID).anyTimes();
+    expect(clusterTopologyMock.getBlueprint()).andReturn(blueprint).anyTimes();
+    expect(persistedState.getAllRequests()).andReturn(allRequests).anyTimes();
+    expect(persistedState.getProvisionRequest(CLUSTER_ID)).andReturn(logicalRequest).anyTimes();
+    expect(ambariContext.isTopologyResolved(CLUSTER_ID)).andReturn(true).anyTimes();
+    expect(group1.addComponent("KERBEROS_CLIENT")).andReturn(true);
+    expect(group2.addComponent("KERBEROS_CLIENT")).andReturn(true);
+
+    replayAll();
+
+    topologyManager.provisionCluster(request);
+    //todo: assertions
+  }
+
+  @Test
   public void testBlueprintRequestCompletion() throws Exception {
     List<ShortTaskStatus> tasks = new ArrayList<>();
     ShortTaskStatus t1 = new ShortTaskStatus();
@@ -499,8 +524,8 @@ public class TopologyManagerTest {
   private void replayAll() {
     replay(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory,
             configurationRequest, configurationRequest2, configurationRequest3, executor,
-            persistedState, securityConfigurationFactory, credentialStoreService, clusterController,
resourceProvider,
-            mockFuture, requestStatusResponse, logicalRequest, settingDAO);
+            persistedState, clusterTopologyMock, securityConfigurationFactory, credentialStoreService,
+            clusterController, resourceProvider, mockFuture, requestStatusResponse, logicalRequest,
settingDAO);
   }
 
   @Test(expected = InvalidTopologyException.class)


Mime
View raw message