From c61eb009e412b8929adc50382a653d51b687e20c Mon Sep 17 00:00:00 2001 From: Nikolay Date: Thu, 22 Apr 2021 19:56:37 +0300 Subject: [PATCH 01/12] IGNITE-14631 SSL certificates generation via python code --- modules/ducktests/tests/docker/run_tests.sh | 2 -- .../ignitetest/services/utils/ignite_aware.py | 11 ++++++ .../ignitetest/services/utils/ignite_spec.py | 34 +++++++++++++++++++ .../tests/ignitetest/services/utils/path.py | 11 ++++++ .../tests/ignitetest/tests/self_test.py | 14 ++++---- .../tests/ignitetest/utils/ignite_test.py | 2 +- 6 files changed, 65 insertions(+), 9 deletions(-) diff --git a/modules/ducktests/tests/docker/run_tests.sh b/modules/ducktests/tests/docker/run_tests.sh index 320f992fb6372..6fb10b17622b7 100755 --- a/modules/ducktests/tests/docker/run_tests.sh +++ b/modules/ducktests/tests/docker/run_tests.sh @@ -160,7 +160,5 @@ if [[ -n "$MAX_PARALLEL" ]]; then DUCKTAPE_OPTIONS="$DUCKTAPE_OPTIONS --max-parallel $MAX_PARALLEL" fi -"$SCRIPT_DIR"/../certs/mkcerts.sh - "$SCRIPT_DIR"/ducker-ignite test "$TC_PATHS" "$DUCKTAPE_OPTIONS" \ || die "ducker-ignite test failed" diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py index 10fbf54ffdff5..1ce6a33ff8bd8 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py @@ -19,6 +19,7 @@ import os import re import signal + import sys import time from abc import ABCMeta @@ -106,6 +107,7 @@ def await_started(self): self.await_event("Topology snapshot", self.startup_timeout_sec, from_the_beginning=True) def start_node(self, node, **kwargs): + self.init_shared(node) self.init_persistent(node) self.__update_node_log_file(node) @@ -171,6 +173,15 @@ def init_persistent(self, node): self._prepare_configs(node) + def init_shared(self, node): + local_shared_dir = self.spec.init_local_shared() + + node.account.mkdirs(f"{self.persistent_root} {self.shared_root}") + + for file in os.listdir(local_shared_dir): + self.logger.debug("Copying shared file to node. " + str(file)) + node.account.copy_to(os.path.join(local_shared_dir, file), self.shared_root) + def _prepare_configs(self, node): config = self.config.prepare_for_env(test_globals=self.globals, node=node, cluster=self) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py index 9731e2c2b77bf..4dc9f1e80ab2f 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py @@ -21,6 +21,8 @@ import importlib import json import os +import subprocess +import tempfile from abc import ABCMeta, abstractmethod from ignitetest.services.utils import IgniteServiceType @@ -28,6 +30,7 @@ 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.ssl.ssl_params import is_ssl_enabled from ignitetest.utils.version import DEV_BRANCH @@ -157,6 +160,37 @@ def config_file_path(self): """ return self.service.config_file + def init_local_shared(self): + if not is_ssl_enabled(self.service.context.globals): + self.service.logger.debug("Ssl disabled. Nothing to generate.") + return + + local_dir = os.path.join(tempfile.gettempdir(), str(self.service.context.session_context.session_id)) + + if os.path.isdir(local_dir): + self.service.logger.debug("Local shared dir already exists. Exiting. " + local_dir) + return local_dir + + self.service.logger.debug("Local shared dir not exists. Creating. " + local_dir) + os.mkdir(local_dir) + + script_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "certs") + + self.runcmd(f"cp {script_dir}/*.sh {local_dir}") + self.runcmd(f"{local_dir}/mkcerts.sh") + + return local_dir + + def runcmd(self, cmd): + self.service.logger.debug(cmd) + proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + stdout, stderr = proc.communicate() + + if proc.returncode != 0: + raise RuntimeError("Command '%s' returned non-zero exit status %d: %s" % (cmd, proc.returncode, stdout)) + + + def _jvm_opts(self): """ :return: line with extra JVM params for ignite.sh script: -J-Dparam=value -J-ea diff --git a/modules/ducktests/tests/ignitetest/services/utils/path.py b/modules/ducktests/tests/ignitetest/services/utils/path.py index 358ecfe5393f8..efac7a346e985 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/path.py +++ b/modules/ducktests/tests/ignitetest/services/utils/path.py @@ -66,6 +66,10 @@ def init_logs_attribute(self): "config": { "path": self.config_dir, "collect_default": True + }, + "shared": { + "path": self.shared_root, + "collect_default": True } }) @@ -104,6 +108,13 @@ def log_dir(self): """ return os.path.join(self.persistent_root, "logs") + @property + def shared_root(self): + """ + :return: path to directory with shared files - same files on all nodes + """ + return os.path.join(self.persistent_root, "shared") + @property @abstractmethod def product(self): diff --git a/modules/ducktests/tests/ignitetest/tests/self_test.py b/modules/ducktests/tests/ignitetest/tests/self_test.py index c0fed2985ac0c..83ef213066e9a 100644 --- a/modules/ducktests/tests/ignitetest/tests/self_test.py +++ b/modules/ducktests/tests/ignitetest/tests/self_test.py @@ -47,7 +47,8 @@ def test_assertion_convertion(self, ignite_version): app = IgniteApplicationService( self.test_context, server_configuration, - java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.AssertionApplication") + java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.AssertionApplication", + startup_timeout_sec=180) try: app.start() @@ -64,12 +65,12 @@ def test_simple_services_start_stop(self, ignite_version): Tests plain services start and stop (termitation vs self-terination). """ ignites = IgniteService(self.test_context, IgniteConfiguration(version=IgniteVersion(ignite_version)), - num_nodes=1) + num_nodes=1, startup_timeout_sec=180) ignites.start() client = IgniteService(self.test_context, IgniteClientConfiguration(version=IgniteVersion(ignite_version)), - num_nodes=1) + num_nodes=1, startup_timeout_sec=180) client.start() @@ -114,7 +115,7 @@ def get_logs_count(service): return list(node.account.ssh_capture(f'ls {service.log_dir}/console.log* | wc -l', callback=int))[0] ignites = IgniteService(self.test_context, IgniteConfiguration(version=IgniteVersion(ignite_version)), - num_nodes=1) + num_nodes=1, startup_timeout_sec=180) ignites.start() @@ -146,11 +147,12 @@ def test_config_add_to_result(self, ignite_version, is_ignite_service): ignite_cfg = IgniteConfiguration(version=IgniteVersion(ignite_version)) if is_ignite_service: - ignite = IgniteService(self.test_context, ignite_cfg, num_nodes=1) + ignite = IgniteService(self.test_context, ignite_cfg, num_nodes=1, startup_timeout_sec=180) else: ignite = IgniteApplicationService( self.test_context, ignite_cfg, - java_class_name="org.apache.ignite.internal.ducktest.tests.self_test.TestKillableApplication") + java_class_name="org.apache.ignite.internal.ducktest.tests.self_test.TestKillableApplication", + startup_timeout_sec=180) ignite.start() diff --git a/modules/ducktests/tests/ignitetest/utils/ignite_test.py b/modules/ducktests/tests/ignitetest/utils/ignite_test.py index 6530eab7441ed..e464bbb98d5b5 100644 --- a/modules/ducktests/tests/ignitetest/utils/ignite_test.py +++ b/modules/ducktests/tests/ignitetest/utils/ignite_test.py @@ -44,7 +44,7 @@ def monotonic(): """ return monotonic() - def tearDown(self): + def teardown(self): self.logger.debug("Killing all runned services to speed-up the tearing down.") # pylint: disable=W0212 From d956743575f63432cc881fff21b0366cf6e1c64d Mon Sep 17 00:00:00 2001 From: Nikolay Date: Thu, 22 Apr 2021 20:00:40 +0300 Subject: [PATCH 02/12] IGNITE-14631 SSL certificates generation via python code --- .../ignitetest/services/utils/ignite_aware.py | 1 - .../ignitetest/services/utils/ignite_spec.py | 31 ++++++++++--------- .../tests/ignitetest/services/utils/path.py | 4 --- .../tests/ignitetest/tests/self_test.py | 14 ++++----- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py index 1ce6a33ff8bd8..91880cbb87ce0 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py @@ -19,7 +19,6 @@ import os import re import signal - import sys import time from abc import ABCMeta diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py index 4dc9f1e80ab2f..49d18e961b379 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py @@ -161,11 +161,14 @@ def config_file_path(self): return self.service.config_file def init_local_shared(self): + """ + :return: path to local share folder. Files should be copied on all nodes in `shared_root` folder. + """ + local_dir = os.path.join(tempfile.gettempdir(), str(self.service.context.session_context.session_id)) + if not is_ssl_enabled(self.service.context.globals): self.service.logger.debug("Ssl disabled. Nothing to generate.") - return - - local_dir = os.path.join(tempfile.gettempdir(), str(self.service.context.session_context.session_id)) + return local_dir if os.path.isdir(local_dir): self.service.logger.debug("Local shared dir already exists. Exiting. " + local_dir) @@ -176,21 +179,11 @@ def init_local_shared(self): script_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "certs") - self.runcmd(f"cp {script_dir}/*.sh {local_dir}") - self.runcmd(f"{local_dir}/mkcerts.sh") + self.__runcmd(f"cp {script_dir}/*.sh {local_dir}") + self.__runcmd(f"{local_dir}/mkcerts.sh") return local_dir - def runcmd(self, cmd): - self.service.logger.debug(cmd) - proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - stdout, stderr = proc.communicate() - - if proc.returncode != 0: - raise RuntimeError("Command '%s' returned non-zero exit status %d: %s" % (cmd, proc.returncode, stdout)) - - - def _jvm_opts(self): """ :return: line with extra JVM params for ignite.sh script: -J-Dparam=value -J-ea @@ -202,6 +195,14 @@ def _add_jvm_opts(self, opts): """Properly adds JVM options to current""" self.jvm_opts = merge_jvm_settings(self.jvm_opts, opts) + def __runcmd(self, cmd): + self.service.logger.debug(cmd) + proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + stdout, stderr = proc.communicate() + + if proc.returncode != 0: + raise RuntimeError("Command '%s' returned non-zero exit status %d: %s" % (cmd, proc.returncode, stdout)) + class IgniteNodeSpec(IgniteSpec): """ diff --git a/modules/ducktests/tests/ignitetest/services/utils/path.py b/modules/ducktests/tests/ignitetest/services/utils/path.py index efac7a346e985..ed14468bbaa1e 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/path.py +++ b/modules/ducktests/tests/ignitetest/services/utils/path.py @@ -66,10 +66,6 @@ def init_logs_attribute(self): "config": { "path": self.config_dir, "collect_default": True - }, - "shared": { - "path": self.shared_root, - "collect_default": True } }) diff --git a/modules/ducktests/tests/ignitetest/tests/self_test.py b/modules/ducktests/tests/ignitetest/tests/self_test.py index 83ef213066e9a..c0fed2985ac0c 100644 --- a/modules/ducktests/tests/ignitetest/tests/self_test.py +++ b/modules/ducktests/tests/ignitetest/tests/self_test.py @@ -47,8 +47,7 @@ def test_assertion_convertion(self, ignite_version): app = IgniteApplicationService( self.test_context, server_configuration, - java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.AssertionApplication", - startup_timeout_sec=180) + java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.AssertionApplication") try: app.start() @@ -65,12 +64,12 @@ def test_simple_services_start_stop(self, ignite_version): Tests plain services start and stop (termitation vs self-terination). """ ignites = IgniteService(self.test_context, IgniteConfiguration(version=IgniteVersion(ignite_version)), - num_nodes=1, startup_timeout_sec=180) + num_nodes=1) ignites.start() client = IgniteService(self.test_context, IgniteClientConfiguration(version=IgniteVersion(ignite_version)), - num_nodes=1, startup_timeout_sec=180) + num_nodes=1) client.start() @@ -115,7 +114,7 @@ def get_logs_count(service): return list(node.account.ssh_capture(f'ls {service.log_dir}/console.log* | wc -l', callback=int))[0] ignites = IgniteService(self.test_context, IgniteConfiguration(version=IgniteVersion(ignite_version)), - num_nodes=1, startup_timeout_sec=180) + num_nodes=1) ignites.start() @@ -147,12 +146,11 @@ def test_config_add_to_result(self, ignite_version, is_ignite_service): ignite_cfg = IgniteConfiguration(version=IgniteVersion(ignite_version)) if is_ignite_service: - ignite = IgniteService(self.test_context, ignite_cfg, num_nodes=1, startup_timeout_sec=180) + ignite = IgniteService(self.test_context, ignite_cfg, num_nodes=1) else: ignite = IgniteApplicationService( self.test_context, ignite_cfg, - java_class_name="org.apache.ignite.internal.ducktest.tests.self_test.TestKillableApplication", - startup_timeout_sec=180) + java_class_name="org.apache.ignite.internal.ducktest.tests.self_test.TestKillableApplication") ignite.start() From 1121ac3e2db0752accf96ebd4bf3d1bd30130843 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 11:14:02 +0300 Subject: [PATCH 03/12] IGNITE-14631 SSL certificates generation via python code --- .../check_get_ssl_params_from_globals.py | 44 +++++++++---------- .../services/utils/control_utility.py | 2 +- .../ignitetest/services/utils/ignite_aware.py | 3 +- .../utils/ignite_configuration/__init__.py | 10 +++-- .../services/utils/ssl/ssl_params.py | 12 ++--- 5 files changed, 35 insertions(+), 36 deletions(-) diff --git a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py index 63a0f38716278..ba4499d0f1981 100644 --- a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py +++ b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py @@ -16,13 +16,13 @@ """ Check that SslParams correctly parse SSL params from globals """ +import os import pytest from ignitetest.services.utils.ssl.ssl_params import get_ssl_params, SslParams, DEFAULT_TRUSTSTORE, \ DEFAULT_CLIENT_KEYSTORE, DEFAULT_PASSWORD, IGNITE_CLIENT_ALIAS, SSL_KEY, SSL_PARAMS_KEY, ENABLED_KEY -INSTALL_ROOT = '/opt/' -CERTIFICATE_DIR = '/opt/ignite-dev/modules/ducktests/tests/certs/' +CERTIFICATE_DIR = "/mnt/service/shared" TEST_KEYSTORE_JKS = "client1.jks" TEST_TRUSTSTORE_JKS = "truststore.jks" TEST_PASSWORD = "qwe123" @@ -72,7 +72,6 @@ class TestParams: """ test_globals_jks = { - "install_root": INSTALL_ROOT, SSL_KEY: { ENABLED_KEY: True, SSL_PARAMS_KEY: { @@ -81,33 +80,34 @@ class TestParams: "key_store_password": TEST_PASSWORD, "trust_store_jks": TEST_TRUSTSTORE_JKS, "trust_store_password": TEST_PASSWORD}}}} + test_globals_path = { - "install_root": INSTALL_ROOT, SSL_KEY: { ENABLED_KEY: True, SSL_PARAMS_KEY: { IGNITE_CLIENT_ALIAS: { - "key_store_path": TEST_CERTIFICATE_DIR + TEST_KEYSTORE_JKS, + "key_store_path": os.path.join(TEST_CERTIFICATE_DIR, TEST_KEYSTORE_JKS), "key_store_password": TEST_PASSWORD, - "trust_store_path": TEST_CERTIFICATE_DIR + TEST_TRUSTSTORE_JKS, + "trust_store_path": os.path.join(TEST_CERTIFICATE_DIR, TEST_TRUSTSTORE_JKS), "trust_store_password": TEST_PASSWORD}}}} - test_globals_default = { - "install_root": INSTALL_ROOT, - SSL_KEY: {ENABLED_KEY: True}} - test_globals_no_ssl = { - "install_root": INSTALL_ROOT} - expected_ssl_params_jks = {'key_store_path': CERTIFICATE_DIR + TEST_KEYSTORE_JKS, + test_globals_default = {SSL_KEY: {ENABLED_KEY: True}} + + test_globals_no_ssl = {} + + expected_ssl_params_jks = {'key_store_path': os.path.join(CERTIFICATE_DIR, TEST_KEYSTORE_JKS), 'key_store_password': TEST_PASSWORD, - 'trust_store_path': CERTIFICATE_DIR + TEST_TRUSTSTORE_JKS, + 'trust_store_path': os.path.join(CERTIFICATE_DIR, TEST_TRUSTSTORE_JKS), 'trust_store_password': TEST_PASSWORD} - expected_ssl_params_path = {'key_store_path': TEST_CERTIFICATE_DIR + TEST_KEYSTORE_JKS, + + expected_ssl_params_path = {'key_store_path': os.path.join(TEST_CERTIFICATE_DIR, TEST_KEYSTORE_JKS), 'key_store_password': TEST_PASSWORD, - 'trust_store_path': TEST_CERTIFICATE_DIR + TEST_TRUSTSTORE_JKS, + 'trust_store_path': os.path.join(TEST_CERTIFICATE_DIR, TEST_TRUSTSTORE_JKS), 'trust_store_password': TEST_PASSWORD} - expected_ssl_params_default = {'key_store_path': CERTIFICATE_DIR + DEFAULT_CLIENT_KEYSTORE, + + expected_ssl_params_default = {'key_store_path': os.path.join(CERTIFICATE_DIR, DEFAULT_CLIENT_KEYSTORE), 'key_store_password': DEFAULT_PASSWORD, - 'trust_store_path': CERTIFICATE_DIR + DEFAULT_TRUSTSTORE, + 'trust_store_path': os.path.join(CERTIFICATE_DIR, DEFAULT_TRUSTSTORE), 'trust_store_password': DEFAULT_PASSWORD} @@ -118,11 +118,11 @@ class CheckCaseJks: @staticmethod @pytest.mark.parametrize('test_globals, expected', - [(TestParams.test_globals_jks, TestParams.expected_ssl_params_jks), - (TestParams.test_globals_path, TestParams.expected_ssl_params_path), - (TestParams.test_globals_default, TestParams.expected_ssl_params_default)]) - def check_parse(test_globals, expected): + [(TestParams.test_globals_jks, CERTIFICATE_DIR, TestParams.expected_ssl_params_jks), + (TestParams.test_globals_path, TEST_CERTIFICATE_DIR, TestParams.expected_ssl_params_path), + (TestParams.test_globals_default, CERTIFICATE_DIR, TestParams.expected_ssl_params_default)]) + def check_parse(test_globals, shared_root, expected): """ Check that SslParams correctly parse SSL params from globals """ - assert _compare(expected, get_ssl_params(test_globals, IGNITE_CLIENT_ALIAS)) + assert _compare(expected, get_ssl_params(test_globals, shared_root, IGNITE_CLIENT_ALIAS)) diff --git a/modules/ducktests/tests/ignitetest/services/utils/control_utility.py b/modules/ducktests/tests/ignitetest/services/utils/control_utility.py index 7c3249b54c586..8d9b74d01de4d 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/control_utility.py +++ b/modules/ducktests/tests/ignitetest/services/utils/control_utility.py @@ -45,7 +45,7 @@ def __init__(self, cluster, ssl_params=None, username=None, password=None): if ssl_params: self.ssl_params = ssl_params elif is_ssl_enabled(cluster.context.globals): - self.ssl_params = get_ssl_params(cluster.context.globals, IGNITE_ADMIN_ALIAS) + self.ssl_params = get_ssl_params(cluster.context.globals, cluster.shared_root, IGNITE_ADMIN_ALIAS) if username and password: self.username, self.password = username, password diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py index 91880cbb87ce0..815c58a66d84e 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py @@ -182,7 +182,8 @@ def init_shared(self, node): node.account.copy_to(os.path.join(local_shared_dir, file), self.shared_root) def _prepare_configs(self, node): - config = self.config.prepare_for_env(test_globals=self.globals, node=node, cluster=self) + config = self.config.prepare_for_env(test_globals=self.globals, shared_root=self.shared_root, node=node, + cluster=self) for name, template in self.spec.config_templates: config_txt = template.render(config_dir=self.config_dir, work_dir=self.work_dir, config=config) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py index fa6efe9272b7e..b36bad180a972 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py @@ -58,7 +58,7 @@ class IgniteConfiguration(NamedTuple): rebalance_batches_prefetch_count: int = None rebalance_throttle: int = None - def __prepare_ssl(self, test_globals): + def __prepare_ssl(self, shared_root, test_globals): """ Updates ssl configuration from globals. """ @@ -66,6 +66,7 @@ def __prepare_ssl(self, test_globals): if self.ssl_params is None and is_ssl_enabled(test_globals): ssl_params = get_ssl_params( test_globals, + shared_root, IGNITE_CLIENT_ALIAS if self.client_mode else IGNITE_SERVER_ALIAS ) if ssl_params: @@ -89,11 +90,12 @@ def __prepare_discovery(self, node, cluster): return config # pylint: disable=protected-access - def prepare_for_env(self, test_globals, node, cluster): + def prepare_for_env(self, **kwargs): """ Updates configuration based on current environment. """ - return self.__prepare_ssl(test_globals).__prepare_discovery(node, cluster) + return self.__prepare_ssl(kwargs.get("test_globals"), kwargs.get("shared_root"))\ + .__prepare_discovery(kwargs.get("node"), kwargs.get("cluster")) @property def service_type(self): @@ -118,7 +120,7 @@ class IgniteThinClientConfiguration(NamedTuple): version: IgniteVersion = DEV_BRANCH # pylint: disable=unused-argument - def prepare_for_env(self, test_globals, node, cluster): + def prepare_for_env(self, **kwargs): """ Updates configuration based on current environment. """ diff --git a/modules/ducktests/tests/ignitetest/services/utils/ssl/ssl_params.py b/modules/ducktests/tests/ignitetest/services/utils/ssl/ssl_params.py index eb74b472ac20e..0ed9f6b29fdbb 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ssl/ssl_params.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ssl/ssl_params.py @@ -27,7 +27,6 @@ DEFAULT_ADMIN_KEYSTORE = 'admin.jks' DEFAULT_PASSWORD = "123456" DEFAULT_TRUSTSTORE = "truststore.jks" -DEFAULT_ROOT = "/opt/" SSL_PARAMS_KEY = "params" SSL_KEY = "ssl" @@ -52,15 +51,13 @@ def __init__(self, key_store_jks: str = None, key_store_password: str = DEFAULT_ if not key_store_jks and not key_store_path: raise Exception("Keystore must be specified to init SslParams") - certificate_dir = os.path.join(root_dir, "ignite-dev", "modules", "ducktests", "tests", "certs") - - self.key_store_path = key_store_path if key_store_path else os.path.join(certificate_dir, key_store_jks) + self.key_store_path = key_store_path if key_store_path else os.path.join(root_dir, key_store_jks) self.key_store_password = key_store_password - self.trust_store_path = trust_store_path if trust_store_path else os.path.join(certificate_dir, trust_store_jks) + self.trust_store_path = trust_store_path if trust_store_path else os.path.join(root_dir, trust_store_jks) self.trust_store_password = trust_store_password -def get_ssl_params(_globals: dict, alias: str): +def get_ssl_params(_globals: dict, shared_root: str, alias: str): """ Gets SSL params from Globals Structure may be found in modules/ducktests/tests/checks/utils/check_get_ssl_params.py @@ -79,7 +76,6 @@ def get_ssl_params(_globals: dict, alias: str): If you specyfy ssl_params in test, you override globals """ - root_dir = _globals.get("install_root", DEFAULT_ROOT) if SSL_PARAMS_KEY in _globals[SSL_KEY] and alias in _globals[SSL_KEY][SSL_PARAMS_KEY]: ssl_param = _globals[SSL_KEY][SSL_PARAMS_KEY][alias] elif alias in default_keystore: @@ -87,7 +83,7 @@ def get_ssl_params(_globals: dict, alias: str): else: raise Exception("We don't have SSL params for: " + alias) - return SslParams(root_dir=root_dir, **ssl_param) if ssl_param else None + return SslParams(root_dir=shared_root, **ssl_param) if ssl_param else None def is_ssl_enabled(_globals: dict): From bbfa8ec70b9a91181d3bc83cf32964182cf5b912 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 11:25:06 +0300 Subject: [PATCH 04/12] IGNITE-14631 SSL certificates generation via python code --- .../checks/utils/check_get_ssl_params_from_globals.py | 3 ++- .../tests/ignitetest/services/utils/ignite_aware.py | 4 ++++ .../tests/ignitetest/services/utils/ignite_spec.py | 4 ++-- .../tests/ignitetest/services/utils/ssl/ssl_params.py | 6 +++--- modules/ducktests/tests/ignitetest/tests/ssl_test.py | 8 ++++---- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py index ba4499d0f1981..b99edd6dd9610 100644 --- a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py +++ b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py @@ -120,7 +120,8 @@ class CheckCaseJks: @pytest.mark.parametrize('test_globals, expected', [(TestParams.test_globals_jks, CERTIFICATE_DIR, TestParams.expected_ssl_params_jks), (TestParams.test_globals_path, TEST_CERTIFICATE_DIR, TestParams.expected_ssl_params_path), - (TestParams.test_globals_default, CERTIFICATE_DIR, TestParams.expected_ssl_params_default)]) + (TestParams.test_globals_default, CERTIFICATE_DIR, + TestParams.expected_ssl_params_default)]) def check_parse(test_globals, shared_root, expected): """ Check that SslParams correctly parse SSL params from globals diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py index 815c58a66d84e..de5ee405fb186 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py @@ -173,6 +173,10 @@ def init_persistent(self, node): self._prepare_configs(node) def init_shared(self, node): + """ + Init shared directory. Content of shared directory must be equal on all test nodes. + :param node: Ignite service node. + """ local_shared_dir = self.spec.init_local_shared() node.account.mkdirs(f"{self.persistent_root} {self.shared_root}") diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py index 49d18e961b379..5ba7c46560b45 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py @@ -166,7 +166,7 @@ def init_local_shared(self): """ local_dir = os.path.join(tempfile.gettempdir(), str(self.service.context.session_context.session_id)) - if not is_ssl_enabled(self.service.context.globals): + if not is_ssl_enabled(self.service.context.globals) and not self.service.config.ssl_params: self.service.logger.debug("Ssl disabled. Nothing to generate.") return local_dir @@ -198,7 +198,7 @@ def _add_jvm_opts(self, opts): def __runcmd(self, cmd): self.service.logger.debug(cmd) proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - stdout, stderr = proc.communicate() + stdout, _ = proc.communicate() if proc.returncode != 0: raise RuntimeError("Command '%s' returned non-zero exit status %d: %s" % (cmd, proc.returncode, stdout)) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ssl/ssl_params.py b/modules/ducktests/tests/ignitetest/services/utils/ssl/ssl_params.py index 0ed9f6b29fdbb..b3b3af1a4d595 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ssl/ssl_params.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ssl/ssl_params.py @@ -45,9 +45,9 @@ class SslParams: """ # pylint: disable=R0913 - def __init__(self, key_store_jks: str = None, key_store_password: str = DEFAULT_PASSWORD, + def __init__(self, root_dir: str, key_store_jks: str = None, key_store_password: str = DEFAULT_PASSWORD, trust_store_jks: str = DEFAULT_TRUSTSTORE, trust_store_password: str = DEFAULT_PASSWORD, - key_store_path: str = None, trust_store_path: str = None, root_dir: str = DEFAULT_ROOT): + key_store_path: str = None, trust_store_path: str = None): if not key_store_jks and not key_store_path: raise Exception("Keystore must be specified to init SslParams") @@ -83,7 +83,7 @@ def get_ssl_params(_globals: dict, shared_root: str, alias: str): else: raise Exception("We don't have SSL params for: " + alias) - return SslParams(root_dir=shared_root, **ssl_param) if ssl_param else None + return SslParams(shared_root, **ssl_param) if ssl_param else None def is_ssl_enabled(_globals: dict): diff --git a/modules/ducktests/tests/ignitetest/tests/ssl_test.py b/modules/ducktests/tests/ignitetest/tests/ssl_test.py index 4dd8de012d3d2..bcdc21ec2b603 100644 --- a/modules/ducktests/tests/ignitetest/tests/ssl_test.py +++ b/modules/ducktests/tests/ignitetest/tests/ssl_test.py @@ -41,9 +41,9 @@ def test_ssl_connection(self, ignite_version): Test that IgniteService, IgniteApplicationService correctly start and stop with ssl configurations. And check ControlUtility with ssl arguments. """ - root_dir = self.test_context.globals.get("install_root", "/opt") + shared_root = "/mnt/service/shared" - server_ssl = SslParams(root_dir=root_dir, key_store_jks=DEFAULT_SERVER_KEYSTORE) + server_ssl = SslParams(shared_root, key_store_jks=DEFAULT_SERVER_KEYSTORE) server_configuration = IgniteConfiguration( version=IgniteVersion(ignite_version), ssl_params=server_ssl, @@ -54,7 +54,7 @@ def test_ssl_connection(self, ignite_version): client_configuration = server_configuration._replace( client_mode=True, - ssl_params=SslParams(root_dir=root_dir, key_store_jks=DEFAULT_CLIENT_KEYSTORE), + ssl_params=SslParams(shared_root, key_store_jks=DEFAULT_CLIENT_KEYSTORE), connector_configuration=None) app = IgniteApplicationService( @@ -63,7 +63,7 @@ def test_ssl_connection(self, ignite_version): java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.SimpleApplication", startup_timeout_sec=180) - admin_ssl = SslParams(root_dir=root_dir, key_store_jks=DEFAULT_ADMIN_KEYSTORE) + admin_ssl = SslParams(shared_root, key_store_jks=DEFAULT_ADMIN_KEYSTORE) control_utility = ControlUtility(cluster=ignite, ssl_params=admin_ssl) ignite.start() From 29ccc2c7e9bdad5a5322701050765a731a510999 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 11:27:05 +0300 Subject: [PATCH 05/12] IGNITE-14631 SSL certificates generation via python code --- modules/ducktests/tests/ignitetest/utils/ignite_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ducktests/tests/ignitetest/utils/ignite_test.py b/modules/ducktests/tests/ignitetest/utils/ignite_test.py index e464bbb98d5b5..6530eab7441ed 100644 --- a/modules/ducktests/tests/ignitetest/utils/ignite_test.py +++ b/modules/ducktests/tests/ignitetest/utils/ignite_test.py @@ -44,7 +44,7 @@ def monotonic(): """ return monotonic() - def teardown(self): + def tearDown(self): self.logger.debug("Killing all runned services to speed-up the tearing down.") # pylint: disable=W0212 From d15458b518f720febd028a09f8bc8575fe6b8685 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 11:55:44 +0300 Subject: [PATCH 06/12] IGNITE-14631 SSL certificates generation via python code --- .../ducktests/tests/ignitetest/services/utils/ignite_aware.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py index de5ee405fb186..54f5cd5a57bad 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py @@ -179,6 +179,10 @@ def init_shared(self, node): """ local_shared_dir = self.spec.init_local_shared() + if not os.path.isdir(local_shared_dir): + self.logger.debug("Local shared dir not exists. Nothing to copy. " + str(local_shared_dir)) + return + node.account.mkdirs(f"{self.persistent_root} {self.shared_root}") for file in os.listdir(local_shared_dir): From b30e14c31946aa68e3a6787ef3cd3ecbcd489903 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 12:10:33 +0300 Subject: [PATCH 07/12] IGNITE-14631 SSL certificates generation via python code --- .../tests/checks/utils/check_get_ssl_params_from_globals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py index b99edd6dd9610..66c65ca69af93 100644 --- a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py +++ b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py @@ -117,7 +117,7 @@ class CheckCaseJks: """ @staticmethod - @pytest.mark.parametrize('test_globals, expected', + @pytest.mark.parametrize('test_globals, shared_root, expected', [(TestParams.test_globals_jks, CERTIFICATE_DIR, TestParams.expected_ssl_params_jks), (TestParams.test_globals_path, TEST_CERTIFICATE_DIR, TestParams.expected_ssl_params_path), (TestParams.test_globals_default, CERTIFICATE_DIR, From 6695f4054e310c4e8090b596f79f6591d6599b99 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 13:02:26 +0300 Subject: [PATCH 08/12] IGNITE-14631 SSL certificates generation via python code --- .../ducktests/tests/ignitetest/services/utils/ignite_spec.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py index 5ba7c46560b45..bdc2cd419c907 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py @@ -166,7 +166,8 @@ def init_local_shared(self): """ local_dir = os.path.join(tempfile.gettempdir(), str(self.service.context.session_context.session_id)) - if not is_ssl_enabled(self.service.context.globals) and not self.service.config.ssl_params: + if not is_ssl_enabled(self.service.context.globals) and \ + not (self.service.config.service_type == IgniteServiceType.NODE and self.service.config.ssl_params): self.service.logger.debug("Ssl disabled. Nothing to generate.") return local_dir From 1a2aa46858570b6af0add6700b5695f51e0e5df8 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 15:04:29 +0300 Subject: [PATCH 09/12] IGNITE-14631 SSL certificates generation via python code --- .../ignitetest/services/utils/ignite_configuration/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py index b36bad180a972..cf658a497f23b 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py @@ -94,7 +94,7 @@ def prepare_for_env(self, **kwargs): """ Updates configuration based on current environment. """ - return self.__prepare_ssl(kwargs.get("test_globals"), kwargs.get("shared_root"))\ + return self.__prepare_ssl(kwargs.get("shared_root"), kwargs.get("test_globals"))\ .__prepare_discovery(kwargs.get("node"), kwargs.get("cluster")) @property From 899eeefa477bbedfc323dbbc39fb0835b9783c09 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 15:36:16 +0300 Subject: [PATCH 10/12] IGNITE-14631 SSL certificates generation via python code --- .../check_get_ssl_params_from_globals.py | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py index 66c65ca69af93..9338b15c450af 100644 --- a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py +++ b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py @@ -22,11 +22,11 @@ from ignitetest.services.utils.ssl.ssl_params import get_ssl_params, SslParams, DEFAULT_TRUSTSTORE, \ DEFAULT_CLIENT_KEYSTORE, DEFAULT_PASSWORD, IGNITE_CLIENT_ALIAS, SSL_KEY, SSL_PARAMS_KEY, ENABLED_KEY -CERTIFICATE_DIR = "/mnt/service/shared" +CERT_DIR1 = "/folder1" +CERT_DIR2 = "/folder2" TEST_KEYSTORE_JKS = "client1.jks" TEST_TRUSTSTORE_JKS = "truststore.jks" TEST_PASSWORD = "qwe123" -TEST_CERTIFICATE_DIR = "/opt/certs/" def _compare(expected, actual): @@ -86,28 +86,28 @@ class TestParams: ENABLED_KEY: True, SSL_PARAMS_KEY: { IGNITE_CLIENT_ALIAS: { - "key_store_path": os.path.join(TEST_CERTIFICATE_DIR, TEST_KEYSTORE_JKS), + "key_store_path": os.path.join(CERT_DIR2, TEST_KEYSTORE_JKS), "key_store_password": TEST_PASSWORD, - "trust_store_path": os.path.join(TEST_CERTIFICATE_DIR, TEST_TRUSTSTORE_JKS), + "trust_store_path": os.path.join(CERT_DIR2, TEST_TRUSTSTORE_JKS), "trust_store_password": TEST_PASSWORD}}}} test_globals_default = {SSL_KEY: {ENABLED_KEY: True}} test_globals_no_ssl = {} - expected_ssl_params_jks = {'key_store_path': os.path.join(CERTIFICATE_DIR, TEST_KEYSTORE_JKS), + expected_ssl_params_jks = {'key_store_path': os.path.join(CERT_DIR1, TEST_KEYSTORE_JKS), 'key_store_password': TEST_PASSWORD, - 'trust_store_path': os.path.join(CERTIFICATE_DIR, TEST_TRUSTSTORE_JKS), + 'trust_store_path': os.path.join(CERT_DIR1, TEST_TRUSTSTORE_JKS), 'trust_store_password': TEST_PASSWORD} - expected_ssl_params_path = {'key_store_path': os.path.join(TEST_CERTIFICATE_DIR, TEST_KEYSTORE_JKS), + expected_ssl_params_path = {'key_store_path': os.path.join(CERT_DIR2, TEST_KEYSTORE_JKS), 'key_store_password': TEST_PASSWORD, - 'trust_store_path': os.path.join(TEST_CERTIFICATE_DIR, TEST_TRUSTSTORE_JKS), + 'trust_store_path': os.path.join(CERT_DIR2, TEST_TRUSTSTORE_JKS), 'trust_store_password': TEST_PASSWORD} - expected_ssl_params_default = {'key_store_path': os.path.join(CERTIFICATE_DIR, DEFAULT_CLIENT_KEYSTORE), + expected_ssl_params_default = {'key_store_path': os.path.join(CERT_DIR1, DEFAULT_CLIENT_KEYSTORE), 'key_store_password': DEFAULT_PASSWORD, - 'trust_store_path': os.path.join(CERTIFICATE_DIR, DEFAULT_TRUSTSTORE), + 'trust_store_path': os.path.join(CERT_DIR1, DEFAULT_TRUSTSTORE), 'trust_store_password': DEFAULT_PASSWORD} @@ -118,10 +118,9 @@ class CheckCaseJks: @staticmethod @pytest.mark.parametrize('test_globals, shared_root, expected', - [(TestParams.test_globals_jks, CERTIFICATE_DIR, TestParams.expected_ssl_params_jks), - (TestParams.test_globals_path, TEST_CERTIFICATE_DIR, TestParams.expected_ssl_params_path), - (TestParams.test_globals_default, CERTIFICATE_DIR, - TestParams.expected_ssl_params_default)]) + [(TestParams.test_globals_jks, CERT_DIR1, TestParams.expected_ssl_params_jks), + (TestParams.test_globals_path, CERT_DIR2, TestParams.expected_ssl_params_path), + (TestParams.test_globals_default, CERT_DIR1, TestParams.expected_ssl_params_default)]) def check_parse(test_globals, shared_root, expected): """ Check that SslParams correctly parse SSL params from globals From e686da1000708af3a20768f6e596c371c48f8503 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 15:39:50 +0300 Subject: [PATCH 11/12] IGNITE-14631 SSL certificates generation via python code --- .../tests/checks/utils/check_get_ssl_params_from_globals.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py index 9338b15c450af..4d0b7c7d866bf 100644 --- a/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py +++ b/modules/ducktests/tests/checks/utils/check_get_ssl_params_from_globals.py @@ -80,7 +80,6 @@ class TestParams: "key_store_password": TEST_PASSWORD, "trust_store_jks": TEST_TRUSTSTORE_JKS, "trust_store_password": TEST_PASSWORD}}}} - test_globals_path = { SSL_KEY: { ENABLED_KEY: True, @@ -90,21 +89,17 @@ class TestParams: "key_store_password": TEST_PASSWORD, "trust_store_path": os.path.join(CERT_DIR2, TEST_TRUSTSTORE_JKS), "trust_store_password": TEST_PASSWORD}}}} - test_globals_default = {SSL_KEY: {ENABLED_KEY: True}} - test_globals_no_ssl = {} expected_ssl_params_jks = {'key_store_path': os.path.join(CERT_DIR1, TEST_KEYSTORE_JKS), 'key_store_password': TEST_PASSWORD, 'trust_store_path': os.path.join(CERT_DIR1, TEST_TRUSTSTORE_JKS), 'trust_store_password': TEST_PASSWORD} - expected_ssl_params_path = {'key_store_path': os.path.join(CERT_DIR2, TEST_KEYSTORE_JKS), 'key_store_password': TEST_PASSWORD, 'trust_store_path': os.path.join(CERT_DIR2, TEST_TRUSTSTORE_JKS), 'trust_store_password': TEST_PASSWORD} - expected_ssl_params_default = {'key_store_path': os.path.join(CERT_DIR1, DEFAULT_CLIENT_KEYSTORE), 'key_store_password': DEFAULT_PASSWORD, 'trust_store_path': os.path.join(CERT_DIR1, DEFAULT_TRUSTSTORE), From 5a9927bce0a8c7df4ff7da222857aee99218e10e Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 23 Apr 2021 15:43:41 +0300 Subject: [PATCH 12/12] IGNITE-14631 SSL certificates generation via python code --- .../tests/ignitetest/services/utils/ignite_aware.py | 3 +-- .../services/utils/ignite_configuration/__init__.py | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py index 54f5cd5a57bad..936093fce5abf 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py @@ -190,8 +190,7 @@ def init_shared(self, node): node.account.copy_to(os.path.join(local_shared_dir, file), self.shared_root) def _prepare_configs(self, node): - config = self.config.prepare_for_env(test_globals=self.globals, shared_root=self.shared_root, node=node, - cluster=self) + config = self.config.prepare_for_env(self.globals, self.shared_root, node, self) for name, template in self.spec.config_templates: config_txt = template.render(config_dir=self.config_dir, work_dir=self.work_dir, config=config) diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py index cf658a497f23b..544248815a9fd 100644 --- a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py +++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py @@ -58,7 +58,7 @@ class IgniteConfiguration(NamedTuple): rebalance_batches_prefetch_count: int = None rebalance_throttle: int = None - def __prepare_ssl(self, shared_root, test_globals): + def __prepare_ssl(self, test_globals, shared_root): """ Updates ssl configuration from globals. """ @@ -90,12 +90,11 @@ def __prepare_discovery(self, node, cluster): return config # pylint: disable=protected-access - def prepare_for_env(self, **kwargs): + def prepare_for_env(self, test_globals, shared_root, node, cluster): """ Updates configuration based on current environment. """ - return self.__prepare_ssl(kwargs.get("shared_root"), kwargs.get("test_globals"))\ - .__prepare_discovery(kwargs.get("node"), kwargs.get("cluster")) + return self.__prepare_ssl(test_globals, shared_root).__prepare_discovery(node, cluster) @property def service_type(self): @@ -120,7 +119,7 @@ class IgniteThinClientConfiguration(NamedTuple): version: IgniteVersion = DEV_BRANCH # pylint: disable=unused-argument - def prepare_for_env(self, **kwargs): + def prepare_for_env(self, test_globals, shared_root, node, cluster): """ Updates configuration based on current environment. """