You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ha...@apache.org on 2018/04/14 05:33:11 UTC
[ambari] branch branch-2.6 updated: [AMBARI-23584] Pre Upgrade
checks look for kafka service validation even when the service is deleted
(dgrinenko)
This is an automated email from the ASF dual-hosted git repository.
hapylestat pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.6 by this push:
new e57378d [AMBARI-23584] Pre Upgrade checks look for kafka service validation even when the service is deleted (dgrinenko)
e57378d is described below
commit e57378d21baaacdd48b7f0fb821d2c00e09ebfd3
Author: Reishin <ha...@gmail.com>
AuthorDate: Sat Apr 14 01:32:38 2018 +0300
[AMBARI-23584] Pre Upgrade checks look for kafka service validation even when the service is deleted (dgrinenko)
---
.../ambari/server/checks/KafkaPropertiesCheck.java | 13 +++++++++++--
.../server/checks/KafkaPropertiesCheckTest.java | 19 +++++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaPropertiesCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaPropertiesCheck.java
index 958d576..9a42a84 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaPropertiesCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaPropertiesCheck.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.checks;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
import java.util.regex.Pattern;
import org.apache.ambari.server.AmbariException;
@@ -28,9 +29,9 @@ import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
-import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
import org.apache.ambari.server.utils.VersionUtils;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
import com.google.common.collect.Lists;
@@ -64,7 +65,7 @@ public class KafkaPropertiesCheck extends AbstractCheckDescriptor {
}
/**
- * Constructor.
+ * Constructor
*/
public KafkaPropertiesCheck() {
super(CheckDescription.KAFKA_PROPERTIES_VALIDATION);
@@ -78,6 +79,14 @@ public class KafkaPropertiesCheck extends AbstractCheckDescriptor {
return Lists.<CheckQualification> newArrayList(new KafkaPropertiesMinVersionQualification());
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getApplicableServices(){
+ return Sets.newHashSet(KAFKA_SERVICE_NAME);
+ }
+
private String getKafkaServiceVersion(Cluster cluster)throws AmbariException{
ServiceInfo serviceInfo = ambariMetaInfo.get().getStack(cluster.getCurrentStackVersion()).getService(KAFKA_SERVICE_NAME);
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaPropertiesCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaPropertiesCheckTest.java
index 8c698b7..380f674 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaPropertiesCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaPropertiesCheckTest.java
@@ -21,6 +21,7 @@ import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
@@ -160,6 +161,24 @@ public class KafkaPropertiesCheckTest {
assertTrue(m_kafkaPropertiresCheck.isApplicable(request));
}
+ @Test
+ public void testNotApplicable() throws Exception {
+
+ final Service service = EasyMock.createMock(Service.class);
+ m_services.put("HDFS", service);
+
+ Cluster cluster = m_clusters.getCluster("cluster");
+ EasyMock.reset(cluster);
+ expect(cluster.getServices()).andReturn(m_services).anyTimes();
+ expect(cluster.getCurrentStackVersion()).andReturn(new StackId("HDP-2.3")).anyTimes();
+ replay(cluster);
+
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ assertFalse(m_kafkaPropertiresCheck.isApplicable(request));
+ }
+
@SuppressWarnings("unchecked")
@Test
public void testMissingProps() throws Exception {
--
To stop receiving notification emails like this one, please contact
hapylestat@apache.org.