aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitalii Gridnev <gridnevvvit@gmail.com>2022-03-10 16:16:51 +0300
committerVitalii Gridnev <gridnevvvit@gmail.com>2022-03-10 16:16:51 +0300
commit907359550105266054869b15bf9dc66291af2d75 (patch)
treef583966d61c37e857c1cf5bbad3dd3cad0e492c3
parent783b78ac55a27f027f249f7f218331f9c23270f5 (diff)
downloadydb-907359550105266054869b15bf9dc66291af2d75.tar.gz
add rolling update tests KIKIMR-12271
ref:fbc4f4676175673fc2f6363854cbec82a885b62d
-rw-r--r--ydb/tests/library/harness/kikimr_config.py12
-rw-r--r--ydb/tests/library/harness/kikimr_runner.py30
2 files changed, 33 insertions, 9 deletions
diff --git a/ydb/tests/library/harness/kikimr_config.py b/ydb/tests/library/harness/kikimr_config.py
index 7b4e7b77ec7..3782ac8d3bc 100644
--- a/ydb/tests/library/harness/kikimr_config.py
+++ b/ydb/tests/library/harness/kikimr_config.py
@@ -113,7 +113,7 @@ class KikimrConfigGenerator(object):
auth_config_path=None,
disable_mvcc=False,
enable_public_api_external_blobs=False,
- node_kind=None
+ node_kind=None,
):
self._version = version
self.use_log_files = use_log_files
@@ -139,8 +139,6 @@ class KikimrConfigGenerator(object):
self.__grpc_tls_key = key_pem
self.__grpc_tls_cert = cert_pem
- if binary_path is None:
- binary_path = kikimr_driver_path()
self.__binary_path = binary_path
rings_count = 3 if erasure == Erasure.MIRROR_3_DC else 1
if nodes is None:
@@ -318,9 +316,15 @@ class KikimrConfigGenerator(object):
def output_path(self):
return self.__output_path
+ def set_binary_path(self, binary_path):
+ self.__binary_path = binary_path
+ return self
+
@property
def binary_path(self):
- return self.__binary_path
+ if self.__binary_path is not None:
+ return self.__binary_path
+ return kikimr_driver_path()
def write_tls_data(self):
if self.__grpc_ssl_enable:
diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py
index e479e9a9888..9d2dbd3fb8c 100644
--- a/ydb/tests/library/harness/kikimr_runner.py
+++ b/ydb/tests/library/harness/kikimr_runner.py
@@ -47,7 +47,8 @@ def join(a, b):
class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
def __init__(self, node_idx, config_path, port_allocator, cluster_name, configurator,
- udfs_dir=None, role='node', node_broker_port=None, tenant_affiliation=None, encryption_key=None):
+ udfs_dir=None, role='node', node_broker_port=None, tenant_affiliation=None, encryption_key=None,
+ binary_path=None):
super(kikimr_node_interface.NodeInterface, self).__init__()
self.node_id = node_idx
@@ -56,6 +57,7 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
self.__cluster_name = cluster_name
self.__configurator = configurator
self.__common_udfs_dir = udfs_dir
+ self.__binary_path = binary_path
self.__encryption_key = encryption_key
self._tenant_affiliation = tenant_affiliation if tenant_affiliation is not None else 'dynamic'
@@ -77,6 +79,7 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
)
self.__cms_config_cache_file_name = self.__cms_config_cache_file.name
daemon.Daemon.__init__(self, self.command, cwd=self.cwd, timeout=180, stderr_on_error_lines=240)
+ self.__binary_path = None
@property
def cwd(self):
@@ -95,6 +98,12 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
return self.__cwd
@property
+ def binary_path(self):
+ if self.__binary_path:
+ return self.__binary_path
+ return self.__configurator.binary_path
+
+ @property
def cms_config_cache_file_name(self):
return self.__cms_config_cache_file_name
@@ -102,6 +111,10 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
def command(self):
return self.__make_run_command()
+ def set_binary_path(self, binary_path):
+ self.__binary_path = binary_path
+ return self.__binary_path
+
def format_pdisk(self, pdisk_path, disk_size, **kwargs):
logger.debug("Formatting pdisk %s on node %s, disk_size %s" % (pdisk_path, self, disk_size))
if pdisk_path.startswith('SectorMap'):
@@ -112,7 +125,8 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
out.write(b'\0')
def __make_run_command(self):
- command = [self.__configurator.binary_path, "server"]
+ command = [self.binary_path, "server"]
+
if self.__common_udfs_dir is not None:
command.append("--udfs-dir={}".format(self.__common_udfs_dir))
@@ -227,6 +241,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
self._slot_index_allocator = itertools.count(1)
self._node_index_allocator = itertools.count(1)
self.default_channel_bindings = None
+ self.__initialy_prepared = False
@property
def config(self):
@@ -282,15 +297,20 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
self.stop()
raise
- def __run(self):
- self.__client = None
+ def prepare(self):
+ if self.__initialy_prepared:
+ return
+ self.__initialy_prepared = True
+ self.__client = None
self.__instantiate_udfs_dir()
self.__write_configs()
-
for _ in self.__configurator.all_node_ids():
self.__register_node()
+ def __run(self):
+ self.prepare()
+
for node_id in self.__configurator.all_node_ids():
self.__run_node(node_id)