kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: MINOR: Support versions with 3 segments in _kafka_jar_versions
Date Wed, 02 Aug 2017 14:51:26 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk b7684b47b -> db306ec36


MINOR: Support versions with 3 segments in _kafka_jar_versions

The bump from 0.11.1.0-SNAPSHOT to 1.0.0-SNAPSHOT broke a couple
of system tests:

* TestVerifiableProducer.test_simple_run
* KafkaVersionTest.test_multi_version

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Damian Guy <damian.guy@gmail.com>

Closes #3587 from ijuma/fix-_kafka_jar_versions


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

Branch: refs/heads/trunk
Commit: db306ec36297d042b58de6f825b0419d0ea912d8
Parents: b7684b4
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Wed Aug 2 15:50:40 2017 +0100
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Wed Aug 2 15:50:40 2017 +0100

----------------------------------------------------------------------
 tests/kafkatest/utils/util.py | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/db306ec3/tests/kafkatest/utils/util.py
----------------------------------------------------------------------
diff --git a/tests/kafkatest/utils/util.py b/tests/kafkatest/utils/util.py
index 3be8d80..d82903a 100644
--- a/tests/kafkatest/utils/util.py
+++ b/tests/kafkatest/utils/util.py
@@ -24,10 +24,35 @@ def kafkatest_version():
 
 
 def _kafka_jar_versions(proc_string):
-    """Use a rough heuristic to find all kafka versions explicitly in the process classpath"""
-    versions = re.findall("kafka-[a-z]+-([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)", proc_string)
+    """Use a rough heuristic to find all kafka versions explicitly in the process classpath.
We need to handle patterns
+    like:
+        - kafka_2.11-1.0.0-SNAPSHOT.jar
+        - kafka_2.11-0.11.0.0-SNAPSHOT.jar
+        - kafka-1.0.0/bin/../libs/* (i.e. the JARs are not listed explicitly)
+        - kafka-0.11.0.0/bin/../libs/* (i.e. the JARs are not listed explicitly)
+        - kafka-streams-1.0.0-SNAPSHOT.jar
+        - kafka-streams-0.11.0.0-SNAPSHOT.jar
+    """
+
+    # Pattern example: kafka_2.11-1.0.0-SNAPSHOT.jar (we have to be careful not to partially
match the 4 segment version string)
+    versions = re.findall("kafka_[0-9]+\.[0-9]+-([0-9]+\.[0-9]+\.[0-9]+)[\.-][a-zA-z]", proc_string)
+
+    # Pattern example: kafka_2.11-0.11.0.0-SNAPSHOT.jar
+    versions.extend(re.findall("kafka_[0-9]+\.[0-9]+-([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)", proc_string))
+
+    # Pattern example: kafka-1.0.0/bin/../libs/* (i.e. the JARs are not listed explicitly,
we have to be careful not to
+    # partially match the 4 segment version)
+    versions.extend(re.findall("kafka-([0-9]+\.[0-9]+\.[0-9]+)/", proc_string))
+
+    # Pattern example: kafka-0.11.0.0/bin/../libs/* (i.e. the JARs are not listed explicitly)
     versions.extend(re.findall("kafka-([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)", proc_string))
 
+    # Pattern example: kafka-streams-1.0.0-SNAPSHOT.jar (we have to be careful not to partially
match the 4 segment version string)
+    versions.extend(re.findall("kafka-[a-z]+-([0-9]+\.[0-9]+\.[0-9]+)[\.-][a-zA-z]", proc_string))
+
+    # Pattern example: kafka-streams-0.11.0.0-SNAPSHOT.jar
+    versions.extend(re.findall("kafka-[a-z]+-([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)", proc_string))
+
     return set(versions)
 
 
@@ -37,12 +62,13 @@ def is_version(node, version_list, proc_grep_string="kafka", logger=None):
     """
     lines = [l for l in node.account.ssh_capture("ps ax | grep %s | grep -v grep" % proc_grep_string)]
     assert len(lines) == 1
+    psLine = lines[0]
 
-    versions = _kafka_jar_versions(lines[0])
+    versions = _kafka_jar_versions(psLine)
     r = versions == {str(v) for v in version_list}
     if not r and logger is not None:
-        logger.warning("%s: %s version mismatch: expected %s: actual %s" % \
-                       (str(node), proc_grep_string, version_list, versions))
+        logger.warning("%s: %s version mismatch: expected %s, actual %s, ps line %s" % \
+                       (str(node), proc_grep_string, version_list, versions, psLine))
     return r
 
 


Mime
View raw message