This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 64257991343 KAFKA-20881 Select the correct Connect module JAR in 
system tests (#23076)
64257991343 is described below

commit 6425799134313fe3216555b34cdb81b04bf9f102
Author: majialong <[email protected]>
AuthorDate: Thu Aug 6 02:03:36 2026 +0800

    KAFKA-20881 Select the correct Connect module JAR in system tests (#23076)
    
    Connect system tests currently add the first JAR returned by `os.walk`
    to the worker classpath, which may select a javadoc JAR instead of the
    executable module JAR.
    
    This change uses `DEV_VERSION` to construct and select the exact
    expected JAR for each Connect module, removing the dependency on
    filesystem traversal order.
    
    Reviewers: PoAn Yang <[email protected]>, Ken Huang
     <[email protected]>, Chia-Ping Tsai <[email protected]>
---
 tests/kafkatest/services/connect.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/kafkatest/services/connect.py 
b/tests/kafkatest/services/connect.py
index e09eba30b3e..d344f2e3916 100644
--- a/tests/kafkatest/services/connect.py
+++ b/tests/kafkatest/services/connect.py
@@ -26,6 +26,7 @@ from ducktape.utils.util import wait_until
 
 from kafkatest.directory_layout.kafka_path import KafkaPathResolverMixin
 from kafkatest.services.kafka.util import fix_opts_for_new_jvm, 
get_log4j_config_param, get_log4j_config_for_connect
+from kafkatest.version import DEV_VERSION
 
 
 class ConnectServiceBase(KafkaPathResolverMixin, Service):
@@ -314,13 +315,12 @@ class ConnectServiceBase(KafkaPathResolverMixin, Service):
         relative_path = "/connect/" + module + "/build/libs/"
         local_dir = cwd + relative_path
         lib_dir = self.path.home() + relative_path
-        for pwd, dirs, files in os.walk(local_dir):
-            for file in files:
-                if file.endswith(".jar"):
-                    # Use the expected directory on the node instead of the 
path in the driver node
-                    file_path = lib_dir + file
-                    self.logger.info("Appending %s to Connect worker's 
CLASSPATH" % file_path)
-                    return "export CLASSPATH=${CLASSPATH}:%s; " % file_path
+        jar_name = "connect-%s-%s.jar" % (module, DEV_VERSION)
+        if os.path.isfile(local_dir + jar_name):
+            # Use the expected directory on the node instead of the path in 
the driver node
+            file_path = lib_dir + jar_name
+            self.logger.info("Appending %s to Connect worker's CLASSPATH" % 
file_path)
+            return "export CLASSPATH=${CLASSPATH}:%s; " % file_path
 
         self.logger.info("Jar not found within %s" % local_dir)
         return ""

Reply via email to