|
11 | 11 | import ydb.tests.library.common.cms as cms |
12 | 12 | from ydb.tests.library.clients.kikimr_http_client import SwaggerClient |
13 | 13 | from ydb.tests.library.harness.kikimr_runner import KiKiMR |
14 | | -from ydb.tests.library.clients.kikimr_config_client import ConfigClient |
15 | 14 | from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator |
16 | 15 | from ydb.tests.library.kv.helpers import create_kv_tablets_and_wait_for_start |
17 | 16 | from ydb.public.api.protos.ydb_status_codes_pb2 import StatusIds |
@@ -46,6 +45,7 @@ class DistConfKiKiMRTest(object): |
46 | 45 | use_config_store = True |
47 | 46 | separate_node_configs = True |
48 | 47 | nodes_count = 0 |
| 48 | + protected_mode = False |
49 | 49 | metadata_section = { |
50 | 50 | "kind": "MainConfig", |
51 | 51 | "version": 0, |
@@ -73,17 +73,17 @@ def setup_class(cls): |
73 | 73 | separate_node_configs=cls.separate_node_configs, |
74 | 74 | simple_config=True, |
75 | 75 | use_self_management=True, |
| 76 | + protected_mode=cls.protected_mode, |
76 | 77 | extra_grpc_services=['config'], |
77 | 78 | additional_log_configs=log_configs) |
78 | 79 |
|
79 | 80 | cls.cluster = KiKiMR(configurator=cls.configurator) |
80 | 81 | cls.cluster.start() |
81 | 82 |
|
82 | | - cms.request_increase_ratio_limit(cls.cluster.client) |
| 83 | + if not cls.protected_mode: |
| 84 | + cms.request_increase_ratio_limit(cls.cluster.client) |
83 | 85 | host = cls.cluster.nodes[1].host |
84 | | - grpc_port = cls.cluster.nodes[1].port |
85 | 86 | cls.swagger_client = SwaggerClient(host, cls.cluster.nodes[1].mon_port) |
86 | | - cls.config_client = ConfigClient(host, grpc_port) |
87 | 87 |
|
88 | 88 | @classmethod |
89 | 89 | def teardown_class(cls): |
@@ -135,7 +135,7 @@ def test_cluster_expand_with_distconf(self): |
135 | 135 |
|
136 | 136 | node_port_allocator = self.configurator.port_allocator.get_node_port_allocator(expected_new_node_id) |
137 | 137 |
|
138 | | - fetched_config = fetch_config(self.config_client) |
| 138 | + fetched_config = fetch_config(self.cluster.config_client) |
139 | 139 | dumped_fetched_config = yaml.safe_load(fetched_config) |
140 | 140 | config_section = dumped_fetched_config["config"] |
141 | 141 |
|
@@ -170,7 +170,7 @@ def test_cluster_expand_with_distconf(self): |
170 | 170 | dumped_fetched_config["metadata"]["version"] = 1 |
171 | 171 |
|
172 | 172 | # replace config |
173 | | - replace_config_response = self.config_client.replace_config(yaml.dump(dumped_fetched_config)) |
| 173 | + replace_config_response = self.cluster.config_client.replace_config(yaml.dump(dumped_fetched_config)) |
174 | 174 | logger.debug(f"replace_config_response: {replace_config_response}") |
175 | 175 | assert_that(replace_config_response.operation.status == StatusIds.SUCCESS) |
176 | 176 | # start new node |
@@ -219,7 +219,7 @@ def test_cluster_expand_with_seed_nodes(self): |
219 | 219 |
|
220 | 220 | node_port_allocator = self.configurator.port_allocator.get_node_port_allocator(expected_new_node_id) |
221 | 221 |
|
222 | | - fetched_config = fetch_config(self.config_client) |
| 222 | + fetched_config = fetch_config(self.cluster.config_client) |
223 | 223 | dumped_fetched_config = yaml.safe_load(fetched_config) |
224 | 224 | config_section = dumped_fetched_config["config"] |
225 | 225 |
|
@@ -264,7 +264,7 @@ def test_cluster_expand_with_seed_nodes(self): |
264 | 264 | dumped_fetched_config["metadata"]["version"] = 1 |
265 | 265 |
|
266 | 266 | # replace config |
267 | | - replace_config_response = self.config_client.replace_config(yaml.dump(dumped_fetched_config)) |
| 267 | + replace_config_response = self.cluster.config_client.replace_config(yaml.dump(dumped_fetched_config)) |
268 | 268 | logger.debug(f"replace_config_response: {replace_config_response}") |
269 | 269 | assert_that(replace_config_response.operation.status == StatusIds.SUCCESS) |
270 | 270 | # start new node |
@@ -299,24 +299,24 @@ def test_cluster_expand_with_seed_nodes(self): |
299 | 299 | os.unlink(seed_nodes_file.name) |
300 | 300 |
|
301 | 301 | def test_invalid_host_config_id(self): |
302 | | - fetched_config = fetch_config(self.config_client) |
| 302 | + fetched_config = fetch_config(self.cluster.config_client) |
303 | 303 | dumped_fetched_config = yaml.safe_load(fetched_config) |
304 | 304 |
|
305 | 305 | # replace config with invalid host config id |
306 | 306 | dumped_fetched_config['metadata']['version'] = 1 |
307 | 307 | dumped_fetched_config["config"]["host_configs"][0]["host_config_id"] = 1000 |
308 | | - replace_config_response = self.config_client.replace_config(yaml.dump(dumped_fetched_config)) |
| 308 | + replace_config_response = self.cluster.config_client.replace_config(yaml.dump(dumped_fetched_config)) |
309 | 309 | logger.debug(f"replace_config_response: {replace_config_response}") |
310 | 310 | assert_that(replace_config_response.operation.status == StatusIds.INTERNAL_ERROR) |
311 | 311 |
|
312 | 312 | def test_invalid_change_host_config_disk(self): |
313 | | - fetched_config = fetch_config(self.config_client) |
| 313 | + fetched_config = fetch_config(self.cluster.config_client) |
314 | 314 | dumped_fetched_config = yaml.safe_load(fetched_config) |
315 | 315 |
|
316 | 316 | # replace config with invalid host config disk path |
317 | 317 | dumped_fetched_config["config"]["host_configs"][0]["drive"].append(dumped_fetched_config["config"]["host_configs"][0]["drive"][0]) |
318 | 318 | dumped_fetched_config['metadata']['version'] = 1 |
319 | | - replace_config_response = self.config_client.replace_config(yaml.dump(dumped_fetched_config)) |
| 319 | + replace_config_response = self.cluster.config_client.replace_config(yaml.dump(dumped_fetched_config)) |
320 | 320 | logger.debug(f"replace_config_response: {replace_config_response}") |
321 | 321 | assert_that(replace_config_response.operation.status == StatusIds.INTERNAL_ERROR) |
322 | 322 |
|
@@ -348,3 +348,18 @@ def test_bootstrap_selector_validation(self): |
348 | 348 | with pytest.raises(Exception) as ei: |
349 | 349 | cluster.start() |
350 | 350 | assert 'YAML validation failed' in str(ei.value) |
| 351 | + |
| 352 | + |
| 353 | +class TestDistConfWithAuth(DistConfKiKiMRTest): |
| 354 | + protected_mode = True |
| 355 | + |
| 356 | + def test_auth_v2_initialization(self): |
| 357 | + table_path = '/Root/mydb/mytable_with_auth' |
| 358 | + self.cluster.create_database( |
| 359 | + table_path, |
| 360 | + storage_pool_units_count={ |
| 361 | + 'rot': 1 |
| 362 | + }, |
| 363 | + timeout_seconds=60, |
| 364 | + token=self.cluster.root_token |
| 365 | + ) |
0 commit comments