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

av pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new c5725f602fb IGNITE-19140 Fix classpaths for modules in IgniteSpec 
(#10610)
c5725f602fb is described below

commit c5725f602fb7cba11ae1db59d08cab305ff4f65b
Author: Sergey Korotkov <[email protected]>
AuthorDate: Wed Mar 29 00:22:42 2023 +0700

    IGNITE-19140 Fix classpaths for modules in IgniteSpec (#10610)
---
 .../tests/ignitetest/services/utils/ignite_spec.py | 67 +++++++++++++---------
 .../tests/ignitetest/services/utils/path.py        | 12 ----
 2 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py 
b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
index b75c0aed02f..78ed9db9535 100644
--- a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
+++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
@@ -24,12 +24,13 @@ import os
 import subprocess
 from abc import ABCMeta, abstractmethod
 import re
+from itertools import chain
 
 from ignitetest.services.utils import IgniteServiceType
 from ignitetest.services.utils.config_template import 
IgniteClientConfigTemplate, IgniteServerConfigTemplate, \
     IgniteLoggerConfigTemplate, IgniteThinClientConfigTemplate
 from ignitetest.services.utils.jvm_utils import create_jvm_settings, 
merge_jvm_settings
-from ignitetest.services.utils.path import get_home_dir, get_module_path, 
IgnitePathAware
+from ignitetest.services.utils.path import get_home_dir, IgnitePathAware
 from ignitetest.services.utils.ssl.ssl_params import is_ssl_enabled
 from ignitetest.services.utils.metrics.metrics import 
is_opencensus_metrics_enabled, configure_opencensus_metrics,\
     is_jmx_metrics_enabled, configure_jmx_metrics
@@ -174,14 +175,31 @@ class IgniteSpec(metaclass=ABCMeta):
         product = product if product else self.service.product
         return get_home_dir(self.service.install_root, product)
 
-    def _module(self, name):
+    @staticmethod
+    def __get_module_libs(project_dir, module_name, is_dev):
         """
-        Get module path for current spec.
+        Get absolute paths to be added to classpath for the specified module.
         """
-        if name == "ducktests":
-            return get_module_path(self.__home(str(DEV_BRANCH)), name, 
DEV_BRANCH.is_dev)
+        if is_dev:
+            module_libs = [
+                os.path.join("modules", module_name, "target"),
+                os.path.join("modules", module_name, "target", "libs")
+            ]
+        else:
+            module_libs = [
+                os.path.join("libs", "optional", "ignite-%s" % module_name)
+            ]
+
+        return [os.path.join(project_dir, module_path) for module_path in 
module_libs]
+
+    def _module_libs(self, module_name):
+        """
+        Get list of paths to be added to classpath for the passed module for 
current spec.
+        """
+        if module_name == "ducktests":
+            return self.__get_module_libs(self.__home(str(DEV_BRANCH)), 
module_name, is_dev=True)
 
-        return get_module_path(self.__home(), name, 
self.service.config.version.is_dev)
+        return self.__get_module_libs(self.__home(), module_name, 
self.service.config.version.is_dev)
 
     @abstractmethod
     def command(self, node):
@@ -189,20 +207,27 @@ class IgniteSpec(metaclass=ABCMeta):
         :return: string that represents command to run service on a node
         """
 
-    def libs(self):
+    def modules(self):
         """
-        :return: libs set.
+        :return: modules set.
         """
-        libs = self.service.modules or []
+        modules = self.service.modules or []
 
-        libs.append("log4j2")
+        modules.append("log4j2")
+        modules.append("ducktests")
 
         if is_opencensus_metrics_enabled(self.service):
-            libs.append("opencensus")
+            modules.append("opencensus")
+
+        return modules
+
+    def libs(self):
+        """
+        :return: list of paths for all modules to be added to classpath
+        """
+        flat_libs_list = chain(*[self._module_libs(module) for module in 
self.modules()])
 
-        return [os.path.join(self.__home(str(DEV_BRANCH)), "modules", 
"ducktests", "target", "*"),
-                os.path.join(self.__home(str(DEV_BRANCH)), "modules", 
"ducktests", "target", "libs", "*"),
-                *list(map(lambda m: os.path.join(self._module(m), "*"), libs))]
+        return list(map(lambda lib: os.path.join(lib, "*"), flat_libs_list))
 
     def envs(self):
         """
@@ -323,19 +348,5 @@ class IgniteApplicationSpec(IgniteSpec):
         return self.service.config_file if self.service.config.service_type == 
IgniteServiceType.NODE \
             else self.service.thin_client_config_file
 
-    def libs(self):
-        libs = super().libs()
-        libs.extend(self.__jackson())
-
-        return libs
-
-    def __jackson(self):
-        if not self.service.config.version.is_dev:
-            ducktests = self._module("ducktests")
-            return self.service.context.cluster.nodes[0].account.ssh_capture(
-                "find %s -type f -name '*.jar' | grep jackson | tr '\n' ':' " 
% ducktests)
-
-        return []
-
     def envs(self):
         return {**super().envs(), **{"MAIN_CLASS": 
self.service.main_java_class}}
diff --git a/modules/ducktests/tests/ignitetest/services/utils/path.py 
b/modules/ducktests/tests/ignitetest/services/utils/path.py
index cd2aac97bbb..ff6674727b7 100644
--- a/modules/ducktests/tests/ignitetest/services/utils/path.py
+++ b/modules/ducktests/tests/ignitetest/services/utils/path.py
@@ -30,18 +30,6 @@ def get_home_dir(install_root, product):
     return os.path.join(install_root, product)
 
 
-def get_module_path(project_dir, module_name, is_dev):
-    """
-    Get absolute path to the specified module.
-    """
-    if is_dev:
-        module_path = os.path.join("modules", module_name, "target")
-    else:
-        module_path = os.path.join("libs", "optional", "ignite-%s" % 
module_name)
-
-    return os.path.join(project_dir, module_path)
-
-
 def get_shared_root_path(test_globals):
     """
     Get path to shared root directory.

Reply via email to