Skip to content

Commit 6e1d0a0

Browse files
authored
Clean up code in harness (#9076)
1 parent 5a49f64 commit 6e1d0a0

File tree

5 files changed

+12
-117
lines changed

5 files changed

+12
-117
lines changed

ydb/public/tools/lib/cmds/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from ydb.tests.library.common.types import Erasure
1818
from ydb.tests.library.harness.daemon import Daemon
1919
from ydb.tests.library.harness.util import LogLevels
20-
from ydb.tests.library.harness.kikimr_port_allocator import KikimrFixedPortAllocator, KikimrFixedNodePortAllocator
20+
from ydb.tests.library.harness.kikimr_port_allocator import KikimrFixedPortAllocator
2121
from library.python.testing.recipe import set_env
2222

2323

@@ -332,7 +332,7 @@ def deploy(arguments):
332332
port_allocator = None
333333
if getattr(arguments, 'fixed_ports', False):
334334
base_port_offset = getattr(arguments, 'base_port_offset', 0)
335-
port_allocator = KikimrFixedPortAllocator(base_port_offset, [KikimrFixedNodePortAllocator(base_port_offset=base_port_offset)])
335+
port_allocator = KikimrFixedPortAllocator(base_port_offset)
336336

337337
optionals = {}
338338
if enable_tls():

ydb/tests/library/harness/blockstore.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

ydb/tests/library/harness/kikimr_cluster.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from . import param_constants
1414
from .kikimr_runner import KiKiMR, KikimrExternalNode
1515
from .kikimr_cluster_interface import KiKiMRClusterInterface
16-
from . import blockstore
1716
import yaml
1817

1918
logger = logging.getLogger(__name__)
@@ -45,7 +44,6 @@ def __init__(self, config_path, binary_path=None, output_path=None):
4544
self.__yaml_config = load_yaml(config_path)
4645
self.__hosts = [host['name'] for host in self.__yaml_config.get('hosts')]
4746
self._slots = None
48-
self._nbs = None
4947
self.__binary_path = binary_path if binary_path is not None else param_constants.kikimr_driver_path()
5048
self.__output_path = output_path
5149
self.__slot_count = 0
@@ -199,15 +197,6 @@ def nodes(self):
199197
) for node_id, host in zip(itertools.count(start=1), self.__hosts)
200198
}
201199

202-
@property
203-
def nbs(self):
204-
return {}
205-
if self._nbs is None:
206-
self._nbs = {}
207-
for node_id, host in zip(itertools.count(start=1), self.__hosts):
208-
self._nbs[node_id] = blockstore.ExternalNetworkBlockStoreNode(host)
209-
return self._nbs
210-
211200
@property
212201
def slots(self):
213202
if self._slots is None:

ydb/tests/library/harness/kikimr_port_allocator.py

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ def ic_port(self):
3434
def sqs_port(self):
3535
pass
3636

37-
@abc.abstractproperty
38-
def ext_port(self):
39-
pass
40-
4137
@abc.abstractproperty
4238
def public_http_port(self):
4339
pass
@@ -122,12 +118,6 @@ def sqs_port(self):
122118
self.__sqs_port = self.__port_manager.get_port()
123119
return self.__sqs_port
124120

125-
@property
126-
def ext_port(self):
127-
if self.__ext_port is None:
128-
self.__ext_port = self.__port_manager.get_port()
129-
return self.__ext_port
130-
131121
@property
132122
def pgwire_port(self):
133123
if self.__pgwire_port is None:
@@ -169,40 +159,18 @@ def release_ports(self):
169159
class KikimrFixedNodePortAllocator(KikimrNodePortAllocatorInterface):
170160

171161
def __init__(self, base_port_offset, mon_port=8765, grpc_port=2135, mbus_port=2134, ic_port=19001, sqs_port=8771, grpc_ssl_port=2137,
172-
ext_port=2237, public_http_port=8766, pgwire_port=5432):
162+
public_http_port=8766, pgwire_port=5432):
173163
super(KikimrFixedNodePortAllocator, self).__init__()
174164

175165
self.base_port_offset = base_port_offset
176-
if os.getenv('MON_PORT') is not None:
177-
self.__mon_port = int(os.getenv('MON_PORT'))
178-
else:
179-
self.__mon_port = mon_port
180-
if os.getenv('GRPC_PORT') is not None:
181-
self.__grpc_port = int(os.getenv('GRPC_PORT'))
182-
else:
183-
self.__grpc_port = grpc_port
166+
self.__mon_port = int(os.getenv('MON_PORT', mon_port))
167+
self.__grpc_port = int(os.getenv('GRPC_PORT', grpc_port))
184168
self.__mbus_port = mbus_port
185-
if os.getenv('IC_PORT') is not None:
186-
self.__ic_port = int(os.getenv('IC_PORT'))
187-
else:
188-
self.__ic_port = ic_port
169+
self.__ic_port = int(os.getenv('IC_PORT', ic_port))
189170
self.__sqs_port = sqs_port
190-
if os.getenv('GRPC_TLS_PORT') is not None:
191-
self.__grpc_ssl_port = int(os.getenv('GRPC_TLS_PORT'))
192-
else:
193-
self.__grpc_ssl_port = grpc_ssl_port
194-
if os.getenv('GRPC_EXT_PORT') is not None:
195-
self.__ext_port = int(os.getenv('GRPC_EXT_PORT'))
196-
else:
197-
self.__ext_port = ext_port
198-
if os.getenv('PUBLIC_HTTP_PORT') is not None:
199-
self.__public_http_port = int(os.getenv('PUBLIC_HTTP_PORT'))
200-
else:
201-
self.__public_http_port = public_http_port
202-
if os.getenv('YDB_PGWIRE_PORT') is not None:
203-
self.__pgwire_port = int(os.getenv('YDB_PGWIRE_PORT'))
204-
else:
205-
self.__pgwire_port = pgwire_port
171+
self.__grpc_ssl_port = int(os.getenv('GRPC_TLS_PORT', grpc_ssl_port))
172+
self.__public_http_port = int(os.getenv('PUBLIC_HTTP_PORT', public_http_port))
173+
self.__pgwire_port = int(os.getenv('YDB_PGWIRE_PORT', pgwire_port))
206174

207175
@property
208176
def mon_port(self):
@@ -229,9 +197,6 @@ def sqs_port(self):
229197
return self.__sqs_port + self.base_port_offset
230198

231199
@property
232-
def ext_port(self):
233-
return self.__ext_port + self.base_port_offset
234-
235200
def public_http_port(self):
236201
return self.__public_http_port + self.base_port_offset
237202

@@ -242,25 +207,15 @@ def pgwire_port(self):
242207

243208
class KikimrFixedPortAllocator(KikimrPortAllocatorInterface):
244209
def __init__(self,
245-
base_port_offset,
246-
nodes_port_allocators_list=(),
247-
slots_port_allocators_list=()):
210+
base_port_offset):
248211
super(KikimrFixedPortAllocator, self).__init__()
249-
self.__nodes_port_allocators_list = nodes_port_allocators_list
250-
self.__slots_port_allocators_list = slots_port_allocators_list
251212
self.__default_value = KikimrFixedNodePortAllocator(base_port_offset)
252213

253214
def get_node_port_allocator(self, node_index):
254-
if node_index <= len(self.__nodes_port_allocators_list):
255-
return self.__nodes_port_allocators_list[node_index - 1]
256-
else:
257-
return self.__default_value
215+
return self.__default_value
258216

259217
def get_slot_port_allocator(self, slot_index):
260-
if slot_index <= len(self.__slots_port_allocators_list):
261-
return self.__slots_port_allocators_list[slot_index - 1]
262-
else:
263-
return self.__default_value
218+
return self.__default_value
264219

265220
def release_ports(self):
266221
pass

ydb/tests/library/ya.make

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ PY_SRCS(
2323
serializability/__init__.py
2424
serializability/checker.py
2525
harness/__init__.py
26-
harness/blockstore.py
2726
harness/daemon.py
2827
harness/kikimr_client.py
2928
harness/kikimr_node_interface.py

0 commit comments

Comments
 (0)