summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasatarin <[email protected]>2022-02-10 16:47:30 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:47:30 +0300
commit4ca29390ac54b7877174de542de47532c67453b5 (patch)
tree14f6fc2edf989ce65a7555e8882e3eae3e9306fe
parent05f59b2581f074c756adaee6b260014ac3a0c3ec (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
-rw-r--r--build/scripts/coverage-info.py158
-rw-r--r--contrib/libs/crcutil/interface.cc2
-rw-r--r--contrib/python/PyHamcrest/LICENSE.txt54
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/__init__.py12
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/__init__.py14
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/assert_that.py128
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/base_description.py184
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/base_matcher.py68
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/compat.py38
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/__init__.py36
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/allof.py88
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/anyof.py74
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/described_as.py96
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/is_.py152
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/isanything.py62
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/isequal.py64
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/isinstanceof.py70
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/isnone.py52
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/isnot.py114
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/issame.py78
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/core/raises.py240
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/description.py116
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/helpers/__init__.py10
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/helpers/hasmethod.py24
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/helpers/wrap_matcher.py62
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/matcher.py104
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/selfdescribing.py36
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/selfdescribingvalue.py54
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/core/string_description.py74
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/__init__.py88
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/__init__.py32
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/is_empty.py70
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containing.py108
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingentries.py266
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingkey.py96
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingvalue.py96
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/isin.py60
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containing.py178
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginanyorder.py194
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginorder.py176
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_onlycontaining.py110
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/integration/__init__.py16
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/integration/match_equality.py84
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/number/__init__.py18
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/number/iscloseto.py148
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/number/ordering_comparison.py118
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/object/__init__.py20
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/object/haslength.py100
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/object/hasproperty.py308
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/object/hasstring.py80
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/__init__.py28
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_case.py86
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_whitespace.py114
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py76
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontainsinorder.py104
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py78
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py80
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py78
-rw-r--r--contrib/python/PyHamcrest/src/hamcrest/library/text/substringmatcher.py40
-rw-r--r--contrib/python/PyHamcrest/tests/test_raises.py90
-rw-r--r--contrib/python/PyHamcrest/tests/test_string_description.py34
-rw-r--r--contrib/python/PyHamcrest/tests/ya.make24
-rw-r--r--contrib/python/PyHamcrest/ya.make12
-rw-r--r--library/cpp/actors/core/actor_coroutine_ut.cpp12
-rw-r--r--library/cpp/actors/core/mailbox.cpp8
-rw-r--r--library/cpp/actors/memory_log/memlog.cpp96
-rw-r--r--library/cpp/actors/testlib/test_runtime.cpp14
-rw-r--r--library/cpp/actors/testlib/test_runtime.h16
-rw-r--r--library/cpp/bucket_quoter/bucket_quoter.h4
-rw-r--r--library/cpp/messagebus/netaddr_ut.cpp4
-rw-r--r--library/cpp/messagebus/test/ut/locator_uniq_ut.cpp4
-rw-r--r--library/cpp/messagebus/test/ut/one_way_ut.cpp12
-rw-r--r--library/cpp/messagebus/test/ut/ya.make78
-rw-r--r--library/cpp/messagebus/test_utils.h8
-rw-r--r--library/cpp/messagebus/ya.make6
-rw-r--r--library/cpp/testing/unittest/registar.cpp2
-rw-r--r--library/cpp/testing/unittest/registar.h18
-rw-r--r--library/cpp/threading/skip_list/perf/main.cpp10
-rw-r--r--library/python/testing/yatest_common/yatest/common/network.py8
-rw-r--r--library/python/testing/yatest_common/yatest/common/process.py20
-rw-r--r--library/python/testing/yatest_common/yatest/common/runtime.py28
-rw-r--r--library/python/testing/yatest_lib/test_splitter.py92
-rw-r--r--util/system/sanitizers.h38
-rw-r--r--util/system/valgrind.h36
-rw-r--r--ydb/core/actorlib_impl/test_interconnect_ut.cpp4
-rw-r--r--ydb/core/actorlib_impl/ut/ya.make2
-rw-r--r--ydb/core/base/localdb.cpp2
-rw-r--r--ydb/core/base/logoblob_ut.cpp156
-rw-r--r--ydb/core/blobstorage/dsproxy/ut/ya.make10
-rw-r--r--ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp14
-rw-r--r--ydb/core/blobstorage/dsproxy/ut_fat/ya.make10
-rw-r--r--ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp32
-rw-r--r--ydb/core/blobstorage/incrhuge/ut/ya.make36
-rw-r--r--ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp2
-rw-r--r--ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_async.cpp2
-rw-r--r--ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp14
-rw-r--r--ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp12
-rw-r--r--ydb/core/blobstorage/ut_pdiskfit/ut/main.cpp4
-rw-r--r--ydb/core/blobstorage/ut_vdisk/lib/prepare.h8
-rw-r--r--ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp10
-rw-r--r--ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp64
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h2
-rw-r--r--ydb/core/client/flat_ut.cpp2
-rw-r--r--ydb/core/client/minikql_result_lib/ut/ya.make4
-rw-r--r--ydb/core/client/server/msgbus_server_keyvalue.cpp34
-rw-r--r--ydb/core/client/ut/ya.make10
-rw-r--r--ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp16
-rw-r--r--ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp14
-rw-r--r--ydb/core/engine/ut/ya.make8
-rw-r--r--ydb/core/erasure/ut/ya.make12
-rw-r--r--ydb/core/keyvalue/keyvalue_state.cpp6
-rw-r--r--ydb/core/keyvalue/ut/ya.make12
-rw-r--r--ydb/core/mind/hive/hive.h2
-rw-r--r--ydb/core/mind/hive/hive_ut.cpp62
-rw-r--r--ydb/core/mind/hive/ut/ya.make2
-rw-r--r--ydb/core/mind/ut/ya.make10
-rw-r--r--ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp2
-rw-r--r--ydb/core/mind/ut_fat/ya.make24
-rw-r--r--ydb/core/persqueue/partition.cpp10
-rw-r--r--ydb/core/persqueue/pq_ut.cpp24
-rw-r--r--ydb/core/persqueue/ut/ya.make2
-rw-r--r--ydb/core/protos/blobstorage_vdisk_config.proto4
-rw-r--r--ydb/core/protos/config.proto6
-rw-r--r--ydb/core/protos/counters.proto36
-rw-r--r--ydb/core/protos/flat_scheme_op.proto8
-rw-r--r--ydb/core/protos/msgbus.proto168
-rw-r--r--ydb/core/protos/tx_proxy.proto2
-rw-r--r--ydb/core/tablet/tablet_pipe_ut.cpp6
-rw-r--r--ydb/core/tablet/tablet_req_rebuildhistory.cpp10
-rw-r--r--ydb/core/tablet/ut/ya.make14
-rw-r--r--ydb/core/tablet_flat/flat_executor_database_ut.cpp10
-rw-r--r--ydb/core/tablet_flat/flat_executor_txloglogic.cpp4
-rw-r--r--ydb/core/tablet_flat/tablet_flat_executed.cpp12
-rw-r--r--ydb/core/tablet_flat/ut/ya.make4
-rw-r--r--ydb/core/testlib/actors/ut/ya.make4
-rw-r--r--ydb/core/testlib/tablet_helpers.cpp6
-rw-r--r--ydb/core/testlib/test_client.cpp28
-rw-r--r--ydb/core/testlib/test_client.h28
-rw-r--r--ydb/core/testlib/ya.make6
-rw-r--r--ydb/core/tx/balance_coverage/ut/ya.make4
-rw-r--r--ydb/core/tx/coordinator/coordinator_impl.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_common.cpp4
-rw-r--r--ydb/core/tx/mediator/tablet_queue.cpp18
-rw-r--r--ydb/core/util/serializable_access_check.h12
-rw-r--r--ydb/core/viewer/content/index.html2
-rw-r--r--ydb/core/ymq/ya.make2
-rw-r--r--ydb/library/aclib/protos/ya.make4
-rw-r--r--ydb/library/aclib/ya.make4
-rw-r--r--ydb/library/pdisk_io/buffers.cpp2
-rw-r--r--ydb/library/schlab/ya.make2
-rw-r--r--ydb/library/yql/ast/ut/ya.make4
-rw-r--r--ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp4
-rw-r--r--ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp8
-rw-r--r--ydb/library/yql/minikql/computation/ut/ya.make10
-rw-r--r--ydb/library/yql/minikql/computation/ya.make4
-rw-r--r--ydb/library/yql/minikql/ut/ya.make10
-rw-r--r--ydb/library/yql/utils/fp_bits_ut.cpp14
-rw-r--r--ydb/public/lib/deprecated/kicli/cpp_ut.cpp42
-rw-r--r--ydb/public/lib/deprecated/kicli/error.cpp2
-rw-r--r--ydb/public/lib/deprecated/kicli/kicli.h6
-rw-r--r--ydb/public/lib/deprecated/kicli/ut/ya.make6
-rw-r--r--ydb/public/lib/deprecated/kicli/ya.make6
-rwxr-xr-xydb/tests/functional/blobstorage/pdisk_format_info.py14
-rw-r--r--ydb/tests/functional/blobstorage/tablet_channel_migration.py138
-rw-r--r--ydb/tests/functional/blobstorage/ya.make30
-rw-r--r--ydb/tests/functional/hive/create_tablets.py152
-rw-r--r--ydb/tests/functional/hive/hive_matchers.py76
-rw-r--r--ydb/tests/functional/hive/test_kill_tablets.py62
-rw-r--r--ydb/tests/functional/hive/ya.make22
-rw-r--r--ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py94
-rw-r--r--ydb/tests/functional/scheme_shard/ya.make34
-rw-r--r--ydb/tests/functional/scheme_tests/tablet_scheme_tests.py6
-rw-r--r--ydb/tests/library/common/composite_assert.py90
-rw-r--r--ydb/tests/library/common/delayed.py20
-rw-r--r--ydb/tests/library/common/helpers.py124
-rw-r--r--ydb/tests/library/common/msgbus_types.py92
-rw-r--r--ydb/tests/library/common/protobuf.py382
-rw-r--r--ydb/tests/library/common/protobuf_kv.py62
-rw-r--r--ydb/tests/library/common/protobuf_ss.py306
-rw-r--r--ydb/tests/library/common/types.py354
-rw-r--r--ydb/tests/library/common/wait_for.py120
-rw-r--r--ydb/tests/library/common/yatest_common.py124
-rw-r--r--ydb/tests/library/harness/daemon.py138
-rw-r--r--ydb/tests/library/harness/kikimr_client.py46
-rw-r--r--ydb/tests/library/harness/kikimr_cluster.py28
-rw-r--r--ydb/tests/library/harness/kikimr_config.py38
-rw-r--r--ydb/tests/library/harness/kikimr_http_client.py202
-rw-r--r--ydb/tests/library/harness/kikimr_monitoring.py80
-rw-r--r--ydb/tests/library/harness/kikimr_runner.py244
-rw-r--r--ydb/tests/library/harness/param_constants.py12
-rw-r--r--ydb/tests/library/harness/util.py118
-rw-r--r--ydb/tests/library/matchers/datashard_matchers.py40
-rw-r--r--ydb/tests/library/matchers/response.py280
-rw-r--r--ydb/tests/library/matchers/response_matchers.py246
-rw-r--r--ydb/tests/library/matchers/tablets.py12
-rw-r--r--ydb/tests/library/nemesis/__init__.py8
-rw-r--r--ydb/tests/library/nemesis/nemesis_core.py334
-rw-r--r--ydb/tests/library/nemesis/nemesis_network.py72
-rw-r--r--ydb/tests/library/nemesis/nemesis_process_killers.py42
-rw-r--r--ydb/tests/library/nemesis/nemesis_time_terrorist.py2
-rw-r--r--ydb/tests/library/nemesis/network/__init__.py8
-rw-r--r--ydb/tests/library/nemesis/network/client.py158
-rw-r--r--ydb/tests/library/nemesis/remote_execution.py90
-rw-r--r--ydb/tests/library/nemesis/safety_warden.py316
204 files changed, 5986 insertions, 5986 deletions
diff --git a/build/scripts/coverage-info.py b/build/scripts/coverage-info.py
index 94491d92564..c43e7aeff8a 100644
--- a/build/scripts/coverage-info.py
+++ b/build/scripts/coverage-info.py
@@ -12,18 +12,18 @@ GCNO_EXT = '.gcno'
def suffixes(path):
- """
- >>> list(suffixes('/a/b/c'))
- ['c', 'b/c', '/a/b/c']
- >>> list(suffixes('/a/b/c/'))
- ['c', 'b/c', '/a/b/c']
- >>> list(suffixes('/a'))
- ['/a']
- >>> list(suffixes('/a/'))
- ['/a']
- >>> list(suffixes('/'))
- []
- """
+ """
+ >>> list(suffixes('/a/b/c'))
+ ['c', 'b/c', '/a/b/c']
+ >>> list(suffixes('/a/b/c/'))
+ ['c', 'b/c', '/a/b/c']
+ >>> list(suffixes('/a'))
+ ['/a']
+ >>> list(suffixes('/a/'))
+ ['/a']
+ >>> list(suffixes('/'))
+ []
+ """
path = os.path.normpath(path)
def up_dirs(cur_path):
@@ -85,21 +85,21 @@ def print_stat(da, fnda, teamcity_stat_output):
tc_file.write("##teamcity[blockClosed name='Code Coverage Summary']\n")
-def chunks(l, n):
- """
- >>> list(chunks(range(10), 3))
- [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
- >>> list(chunks(range(10), 5))
- [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
- """
- for i in xrange(0, len(l), n):
- yield l[i:i + n]
-
-
+def chunks(l, n):
+ """
+ >>> list(chunks(range(10), 3))
+ [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
+ >>> list(chunks(range(10), 5))
+ [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
+ """
+ for i in xrange(0, len(l), n):
+ yield l[i:i + n]
+
+
def combine_info_files(lcov, files, out_file):
chunk_size = 50
files = list(set(files))
-
+
for chunk in chunks(files, chunk_size):
combine_cmd = [lcov]
if os.path.exists(out_file):
@@ -116,39 +116,39 @@ def combine_info_files(lcov, files, out_file):
os.rename(out_file_tmp, out_file)
-def probe_path_global(path, source_root, prefix_filter, exclude_files):
- if path.endswith('_ut.cpp'):
+def probe_path_global(path, source_root, prefix_filter, exclude_files):
+ if path.endswith('_ut.cpp'):
return None
- for suff in reversed(list(suffixes(path))):
- if (not prefix_filter or suff.startswith(prefix_filter)) and (not exclude_files or not exclude_files.match(suff)):
- full_path = source_root + os.sep + suff
- if os.path.isfile(full_path):
- return full_path
-
- return None
-
-
-def update_stat_global(src_file, line, fnda, da):
- if line.startswith("FNDA:"):
- visits, func_name = line[len("FNDA:"):].split(',')
- fnda[src_file + func_name] += int(visits)
-
- if line.startswith("DA"):
- line_number, visits = line[len("DA:"):].split(',')
- if visits == '=====':
- visits = 0
-
- da[src_file + line_number] += int(visits)
-
-
-def gen_info_global(cmd, cov_info, probe_path, update_stat, lcov_args):
- print >>sys.stderr, '## geninfo', ' '.join(cmd)
- subprocess.check_call(cmd)
- if recast(cov_info + '.tmp', cov_info, probe_path, update_stat):
- lcov_args.append(cov_info)
-
-
+ for suff in reversed(list(suffixes(path))):
+ if (not prefix_filter or suff.startswith(prefix_filter)) and (not exclude_files or not exclude_files.match(suff)):
+ full_path = source_root + os.sep + suff
+ if os.path.isfile(full_path):
+ return full_path
+
+ return None
+
+
+def update_stat_global(src_file, line, fnda, da):
+ if line.startswith("FNDA:"):
+ visits, func_name = line[len("FNDA:"):].split(',')
+ fnda[src_file + func_name] += int(visits)
+
+ if line.startswith("DA"):
+ line_number, visits = line[len("DA:"):].split(',')
+ if visits == '=====':
+ visits = 0
+
+ da[src_file + line_number] += int(visits)
+
+
+def gen_info_global(cmd, cov_info, probe_path, update_stat, lcov_args):
+ print >>sys.stderr, '## geninfo', ' '.join(cmd)
+ subprocess.check_call(cmd)
+ if recast(cov_info + '.tmp', cov_info, probe_path, update_stat):
+ lcov_args.append(cov_info)
+
+
def init_all_coverage_files(gcno_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info, prefix_filter, exclude_files):
with tarfile.open(gcno_archive) as gcno_tf:
for gcno_item in gcno_tf:
@@ -177,8 +177,8 @@ def init_all_coverage_files(gcno_archive, fname2gcno, fname2info, geninfo_execut
]
gen_info(geninfo_cmd, coverage_info)
-
-def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info):
+
+def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info):
with tarfile.open(gcda_archive) as gcda_tf:
for gcda_item in gcda_tf:
if gcda_item.isfile() and gcda_item.name.endswith(GCDA_EXT):
@@ -200,7 +200,7 @@ def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_exe
]
gen_info(geninfo_cmd, coverage_info)
-
+
def gen_cobertura(tool, output, combined_info):
cmd = [
tool,
@@ -215,28 +215,28 @@ def gen_cobertura(tool, output, combined_info):
def main(source_root, output, gcno_archive, gcda_archive, gcov_tool, prefix_filter, exclude_regexp, teamcity_stat_output, coverage_report_path, gcov_report, lcov_cobertura):
- exclude_files = re.compile(exclude_regexp) if exclude_regexp else None
-
- fname2gcno = {}
- fname2info = collections.defaultdict(list)
- lcov_args = []
- geninfo_executable = os.path.join(source_root, 'devtools', 'lcov', 'geninfo')
-
- def probe_path(path):
- return probe_path_global(path, source_root, prefix_filter, exclude_files)
-
- fnda = collections.defaultdict(int)
- da = collections.defaultdict(int)
-
- def update_stat(src_file, line):
- update_stat_global(src_file, line, da, fnda)
-
- def gen_info(cmd, cov_info):
- gen_info_global(cmd, cov_info, probe_path, update_stat, lcov_args)
-
+ exclude_files = re.compile(exclude_regexp) if exclude_regexp else None
+
+ fname2gcno = {}
+ fname2info = collections.defaultdict(list)
+ lcov_args = []
+ geninfo_executable = os.path.join(source_root, 'devtools', 'lcov', 'geninfo')
+
+ def probe_path(path):
+ return probe_path_global(path, source_root, prefix_filter, exclude_files)
+
+ fnda = collections.defaultdict(int)
+ da = collections.defaultdict(int)
+
+ def update_stat(src_file, line):
+ update_stat_global(src_file, line, da, fnda)
+
+ def gen_info(cmd, cov_info):
+ gen_info_global(cmd, cov_info, probe_path, update_stat, lcov_args)
+
init_all_coverage_files(gcno_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info, prefix_filter, exclude_files)
- process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info)
-
+ process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info)
+
if coverage_report_path:
output_dir = coverage_report_path
else:
diff --git a/contrib/libs/crcutil/interface.cc b/contrib/libs/crcutil/interface.cc
index dfefebba06a..6125bb08379 100644
--- a/contrib/libs/crcutil/interface.cc
+++ b/contrib/libs/crcutil/interface.cc
@@ -28,7 +28,7 @@ static size_t kAlign = 4 * 1024;
using namespace crcutil;
-#if (!defined(__clang__) && defined(__GNUC__))
+#if (!defined(__clang__) && defined(__GNUC__))
// Suppress 'invalid access to non-static data member ... of NULL object'
#undef offsetof
#define offsetof(TYPE, MEMBER) (reinterpret_cast <size_t> \
diff --git a/contrib/python/PyHamcrest/LICENSE.txt b/contrib/python/PyHamcrest/LICENSE.txt
index 0bea089e5ca..70cb236cfde 100644
--- a/contrib/python/PyHamcrest/LICENSE.txt
+++ b/contrib/python/PyHamcrest/LICENSE.txt
@@ -1,27 +1,27 @@
-BSD License
-
-Copyright 2011 hamcrest.org
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of
-conditions and the following disclaimer. Redistributions in binary form must reproduce
-the above copyright notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the distribution.
-
-Neither the name of Hamcrest nor the names of its contributors may be used to endorse
-or promote products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
-WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
+BSD License
+
+Copyright 2011 hamcrest.org
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of
+conditions and the following disclaimer. Redistributions in binary form must reproduce
+the above copyright notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the distribution.
+
+Neither the name of Hamcrest nor the names of its contributors may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
diff --git a/contrib/python/PyHamcrest/src/hamcrest/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/__init__.py
index 3a751d44f62..77ced68d0d0 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/__init__.py
@@ -1,8 +1,8 @@
-from __future__ import absolute_import
-from hamcrest.core import *
-from hamcrest.library import *
-
+from __future__ import absolute_import
+from hamcrest.core import *
+from hamcrest.library import *
+
__version__ = "1.9.0"
-__author__ = "Chris Rose"
+__author__ = "Chris Rose"
__copyright__ = "Copyright 2015 hamcrest.org"
-__license__ = "BSD, see License.txt"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/core/__init__.py
index 779fa723459..6b91f4ae740 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/__init__.py
@@ -1,7 +1,7 @@
-from __future__ import absolute_import
-from hamcrest.core.assert_that import assert_that
-from hamcrest.core.core import *
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
+from __future__ import absolute_import
+from hamcrest.core.assert_that import assert_that
+from hamcrest.core.core import *
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/assert_that.py b/contrib/python/PyHamcrest/src/hamcrest/core/assert_that.py
index b38bc243ca0..e062e78091c 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/assert_that.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/assert_that.py
@@ -1,64 +1,64 @@
-from __future__ import absolute_import
-from hamcrest.core.matcher import Matcher
-from hamcrest.core.string_description import StringDescription
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-# unittest integration; hide these frames from tracebacks
-__unittest = True
-# py.test integration; hide these frames from tracebacks
-__tracebackhide__ = True
-
-def assert_that(arg1, arg2=None, arg3=''):
- """Asserts that actual value satisfies matcher. (Can also assert plain
- boolean condition.)
-
- :param actual: The object to evaluate as the actual value.
- :param matcher: The matcher to satisfy as the expected condition.
- :param reason: Optional explanation to include in failure description.
-
- ``assert_that`` passes the actual value to the matcher for evaluation. If
- the matcher is not satisfied, an exception is thrown describing the
- mismatch.
-
- ``assert_that`` is designed to integrate well with PyUnit and other unit
- testing frameworks. The exception raised for an unmet assertion is an
- :py:exc:`AssertionError`, which PyUnit reports as a test failure.
-
- With a different set of parameters, ``assert_that`` can also verify a
- boolean condition:
-
- .. function:: assert_that(assertion[, reason])
-
- :param assertion: Boolean condition to verify.
- :param reason: Optional explanation to include in failure description.
-
- This is equivalent to the :py:meth:`~unittest.TestCase.assertTrue` method
- of :py:class:`unittest.TestCase`, but offers greater flexibility in test
- writing by being a standalone function.
-
- """
- if isinstance(arg2, Matcher):
- _assert_match(actual=arg1, matcher=arg2, reason=arg3)
- else:
- _assert_bool(assertion=arg1, reason=arg2)
-
-
-def _assert_match(actual, matcher, reason):
- if not matcher.matches(actual):
- description = StringDescription()
- description.append_text(reason) \
- .append_text('\nExpected: ') \
- .append_description_of(matcher) \
- .append_text('\n but: ')
- matcher.describe_mismatch(actual, description)
- description.append_text('\n')
- raise AssertionError(description)
-
-
-def _assert_bool(assertion, reason=None):
- if not assertion:
- if not reason:
- reason = 'Assertion failed'
- raise AssertionError(reason)
+from __future__ import absolute_import
+from hamcrest.core.matcher import Matcher
+from hamcrest.core.string_description import StringDescription
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+# unittest integration; hide these frames from tracebacks
+__unittest = True
+# py.test integration; hide these frames from tracebacks
+__tracebackhide__ = True
+
+def assert_that(arg1, arg2=None, arg3=''):
+ """Asserts that actual value satisfies matcher. (Can also assert plain
+ boolean condition.)
+
+ :param actual: The object to evaluate as the actual value.
+ :param matcher: The matcher to satisfy as the expected condition.
+ :param reason: Optional explanation to include in failure description.
+
+ ``assert_that`` passes the actual value to the matcher for evaluation. If
+ the matcher is not satisfied, an exception is thrown describing the
+ mismatch.
+
+ ``assert_that`` is designed to integrate well with PyUnit and other unit
+ testing frameworks. The exception raised for an unmet assertion is an
+ :py:exc:`AssertionError`, which PyUnit reports as a test failure.
+
+ With a different set of parameters, ``assert_that`` can also verify a
+ boolean condition:
+
+ .. function:: assert_that(assertion[, reason])
+
+ :param assertion: Boolean condition to verify.
+ :param reason: Optional explanation to include in failure description.
+
+ This is equivalent to the :py:meth:`~unittest.TestCase.assertTrue` method
+ of :py:class:`unittest.TestCase`, but offers greater flexibility in test
+ writing by being a standalone function.
+
+ """
+ if isinstance(arg2, Matcher):
+ _assert_match(actual=arg1, matcher=arg2, reason=arg3)
+ else:
+ _assert_bool(assertion=arg1, reason=arg2)
+
+
+def _assert_match(actual, matcher, reason):
+ if not matcher.matches(actual):
+ description = StringDescription()
+ description.append_text(reason) \
+ .append_text('\nExpected: ') \
+ .append_description_of(matcher) \
+ .append_text('\n but: ')
+ matcher.describe_mismatch(actual, description)
+ description.append_text('\n')
+ raise AssertionError(description)
+
+
+def _assert_bool(assertion, reason=None):
+ if not assertion:
+ if not reason:
+ reason = 'Assertion failed'
+ raise AssertionError(reason)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/base_description.py b/contrib/python/PyHamcrest/src/hamcrest/core/base_description.py
index 8c7c51364de..62b13ccfe18 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/base_description.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/base_description.py
@@ -1,92 +1,92 @@
-from __future__ import absolute_import
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-import warnings
-import six
-
-from hamcrest.core.description import Description
-from hamcrest.core.selfdescribingvalue import SelfDescribingValue
-from hamcrest.core.helpers.hasmethod import hasmethod
-
-class BaseDescription(Description):
- """Base class for all :py:class:`~hamcrest.core.description.Description`
- implementations.
-
- """
-
- def append_text(self, text):
- self.append(text)
- return self
-
- def append_description_of(self, value):
- if hasmethod(value, 'describe_to'):
- value.describe_to(self)
- elif six.PY3 and isinstance(value, six.text_type):
- self.append(repr(value))
- elif six.PY2 and isinstance(value, six.binary_type):
- self.append_string_in_python_syntax(value)
- elif isinstance(value, six.text_type):
- self.append_string_in_python_syntax(value)
- else:
- description = str(value)
- if description[:1] == '<' and description[-1:] == '>':
- self.append(description)
- else:
- self.append('<')
- self.append(description)
- self.append('>')
- return self
-
- def append_value(self, value):
- warnings.warn('Call append_description_of instead of append_value',
- DeprecationWarning)
- if isinstance(value, str):
- self.append_string_in_python_syntax(value)
- else:
- self.append('<')
- self.append(str(value))
- self.append('>')
- return self
-
- def append_value_list(self, start, separator, end, list):
- warnings.warn('Call append_list instead of append_value_list',
- DeprecationWarning)
- return self.append_list(start, separator, end,
- map(SelfDescribingValue, list))
-
- def append_list(self, start, separator, end, list):
- separate = False
-
- self.append(start)
- for item in list:
- if separate:
- self.append(separator)
- self.append_description_of(item)
- separate = True
- self.append(end)
- return self
-
- def append(self, string):
- """Append the string to the description."""
- raise NotImplementedError('append')
-
- def append_string_in_python_syntax(self, string):
- self.append("'")
- for ch in string:
- self.append(character_in_python_syntax(ch))
- self.append("'")
-
-
-def character_in_python_syntax(ch):
- if ch == "'":
- return "\'"
- elif ch == '\n':
- return '\\n'
- elif ch == '\r':
- return '\\r'
- elif ch == '\t':
- return '\\t'
- else:
- return ch
+from __future__ import absolute_import
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+import warnings
+import six
+
+from hamcrest.core.description import Description
+from hamcrest.core.selfdescribingvalue import SelfDescribingValue
+from hamcrest.core.helpers.hasmethod import hasmethod
+
+class BaseDescription(Description):
+ """Base class for all :py:class:`~hamcrest.core.description.Description`
+ implementations.
+
+ """
+
+ def append_text(self, text):
+ self.append(text)
+ return self
+
+ def append_description_of(self, value):
+ if hasmethod(value, 'describe_to'):
+ value.describe_to(self)
+ elif six.PY3 and isinstance(value, six.text_type):
+ self.append(repr(value))
+ elif six.PY2 and isinstance(value, six.binary_type):
+ self.append_string_in_python_syntax(value)
+ elif isinstance(value, six.text_type):
+ self.append_string_in_python_syntax(value)
+ else:
+ description = str(value)
+ if description[:1] == '<' and description[-1:] == '>':
+ self.append(description)
+ else:
+ self.append('<')
+ self.append(description)
+ self.append('>')
+ return self
+
+ def append_value(self, value):
+ warnings.warn('Call append_description_of instead of append_value',
+ DeprecationWarning)
+ if isinstance(value, str):
+ self.append_string_in_python_syntax(value)
+ else:
+ self.append('<')
+ self.append(str(value))
+ self.append('>')
+ return self
+
+ def append_value_list(self, start, separator, end, list):
+ warnings.warn('Call append_list instead of append_value_list',
+ DeprecationWarning)
+ return self.append_list(start, separator, end,
+ map(SelfDescribingValue, list))
+
+ def append_list(self, start, separator, end, list):
+ separate = False
+
+ self.append(start)
+ for item in list:
+ if separate:
+ self.append(separator)
+ self.append_description_of(item)
+ separate = True
+ self.append(end)
+ return self
+
+ def append(self, string):
+ """Append the string to the description."""
+ raise NotImplementedError('append')
+
+ def append_string_in_python_syntax(self, string):
+ self.append("'")
+ for ch in string:
+ self.append(character_in_python_syntax(ch))
+ self.append("'")
+
+
+def character_in_python_syntax(ch):
+ if ch == "'":
+ return "\'"
+ elif ch == '\n':
+ return '\\n'
+ elif ch == '\r':
+ return '\\r'
+ elif ch == '\t':
+ return '\\t'
+ else:
+ return ch
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/base_matcher.py b/contrib/python/PyHamcrest/src/hamcrest/core/base_matcher.py
index 951e2a7b95d..c41cf3a893e 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/base_matcher.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/base_matcher.py
@@ -1,34 +1,34 @@
-from __future__ import absolute_import
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.matcher import Matcher
-from hamcrest.core.string_description import tostring
-
-
-class BaseMatcher(Matcher):
- """Base class for all :py:class:`~hamcrest.core.matcher.Matcher`
- implementations.
-
- Most implementations can just implement :py:obj:`_matches`, leaving the
- handling of any mismatch description to the ``matches`` method. But if it
- makes more sense to generate the mismatch description during the matching,
- override :py:meth:`~hamcrest.core.matcher.Matcher.matches` instead.
-
- """
-
- def __str__(self):
- return tostring(self)
-
- def _matches(self, item):
- raise NotImplementedError('_matches')
-
- def matches(self, item, mismatch_description=None):
- match_result = self._matches(item)
- if not match_result and mismatch_description:
- self.describe_mismatch(item, mismatch_description)
- return match_result
-
- def describe_mismatch(self, item, mismatch_description):
- mismatch_description.append_text('was ').append_description_of(item)
+from __future__ import absolute_import
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.matcher import Matcher
+from hamcrest.core.string_description import tostring
+
+
+class BaseMatcher(Matcher):
+ """Base class for all :py:class:`~hamcrest.core.matcher.Matcher`
+ implementations.
+
+ Most implementations can just implement :py:obj:`_matches`, leaving the
+ handling of any mismatch description to the ``matches`` method. But if it
+ makes more sense to generate the mismatch description during the matching,
+ override :py:meth:`~hamcrest.core.matcher.Matcher.matches` instead.
+
+ """
+
+ def __str__(self):
+ return tostring(self)
+
+ def _matches(self, item):
+ raise NotImplementedError('_matches')
+
+ def matches(self, item, mismatch_description=None):
+ match_result = self._matches(item)
+ if not match_result and mismatch_description:
+ self.describe_mismatch(item, mismatch_description)
+ return match_result
+
+ def describe_mismatch(self, item, mismatch_description):
+ mismatch_description.append_text('was ').append_description_of(item)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/compat.py b/contrib/python/PyHamcrest/src/hamcrest/core/compat.py
index 2c6d1fa74c8..be39bb29063 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/compat.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/compat.py
@@ -1,19 +1,19 @@
-__author__ = "Per Fagrell"
-__copyright__ = "Copyright 2013 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-__all__ = ['is_callable']
-
-import sys
-
-# callable was not part of py3k until 3.2, so we create this
-# generic is_callable to use callable if possible, otherwise
-# we use generic homebrew.
-if sys.version_info[0] == 3 and sys.version_info[1] < 2:
- def is_callable(function):
- """Return whether the object is callable (i.e., some kind of function)."""
- if function is None:
- return False
- return any("__call__" in klass.__dict__ for klass in type(function).__mro__)
-else:
- is_callable = callable
+__author__ = "Per Fagrell"
+__copyright__ = "Copyright 2013 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+__all__ = ['is_callable']
+
+import sys
+
+# callable was not part of py3k until 3.2, so we create this
+# generic is_callable to use callable if possible, otherwise
+# we use generic homebrew.
+if sys.version_info[0] == 3 and sys.version_info[1] < 2:
+ def is_callable(function):
+ """Return whether the object is callable (i.e., some kind of function)."""
+ if function is None:
+ return False
+ return any("__call__" in klass.__dict__ for klass in type(function).__mro__)
+else:
+ is_callable = callable
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/__init__.py
index 38e93e249a7..4afac9934d7 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/__init__.py
@@ -1,18 +1,18 @@
-from __future__ import absolute_import
-"""Fundamental matchers of objects and values, and composite matchers."""
-
-from hamcrest.core.core.allof import all_of
-from hamcrest.core.core.anyof import any_of
-from hamcrest.core.core.described_as import described_as
-from hamcrest.core.core.is_ import is_
-from hamcrest.core.core.isanything import anything
-from hamcrest.core.core.isequal import equal_to
-from hamcrest.core.core.isinstanceof import instance_of
-from hamcrest.core.core.isnone import none, not_none
-from hamcrest.core.core.isnot import is_not, not_
-from hamcrest.core.core.issame import same_instance
-from hamcrest.core.core.raises import calling, raises
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
+from __future__ import absolute_import
+"""Fundamental matchers of objects and values, and composite matchers."""
+
+from hamcrest.core.core.allof import all_of
+from hamcrest.core.core.anyof import any_of
+from hamcrest.core.core.described_as import described_as
+from hamcrest.core.core.is_ import is_
+from hamcrest.core.core.isanything import anything
+from hamcrest.core.core.isequal import equal_to
+from hamcrest.core.core.isinstanceof import instance_of
+from hamcrest.core.core.isnone import none, not_none
+from hamcrest.core.core.isnot import is_not, not_
+from hamcrest.core.core.issame import same_instance
+from hamcrest.core.core.raises import calling, raises
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/allof.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/allof.py
index 35c5d0bfeb6..fc7fc230fe9 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/allof.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/allof.py
@@ -1,44 +1,44 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class AllOf(BaseMatcher):
-
- def __init__(self, *matchers):
- self.matchers = matchers
-
- def matches(self, item, mismatch_description=None):
- for matcher in self.matchers:
- if not matcher.matches(item):
- if mismatch_description:
- mismatch_description.append_description_of(matcher) \
- .append_text(' ')
- matcher.describe_mismatch(item, mismatch_description)
- return False
- return True
-
- def describe_mismatch(self, item, mismatch_description):
- self.matches(item, mismatch_description)
-
- def describe_to(self, description):
- description.append_list('(', ' and ', ')', self.matchers)
-
-
-def all_of(*items):
- """Matches if all of the given matchers evaluate to ``True``.
-
- :param matcher1,...: A comma-separated list of matchers.
-
- The matchers are evaluated from left to right using short-circuit
- evaluation, so evaluation stops as soon as a matcher returns ``False``.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- """
- return AllOf(*[wrap_matcher(item) for item in items])
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class AllOf(BaseMatcher):
+
+ def __init__(self, *matchers):
+ self.matchers = matchers
+
+ def matches(self, item, mismatch_description=None):
+ for matcher in self.matchers:
+ if not matcher.matches(item):
+ if mismatch_description:
+ mismatch_description.append_description_of(matcher) \
+ .append_text(' ')
+ matcher.describe_mismatch(item, mismatch_description)
+ return False
+ return True
+
+ def describe_mismatch(self, item, mismatch_description):
+ self.matches(item, mismatch_description)
+
+ def describe_to(self, description):
+ description.append_list('(', ' and ', ')', self.matchers)
+
+
+def all_of(*items):
+ """Matches if all of the given matchers evaluate to ``True``.
+
+ :param matcher1,...: A comma-separated list of matchers.
+
+ The matchers are evaluated from left to right using short-circuit
+ evaluation, so evaluation stops as soon as a matcher returns ``False``.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ """
+ return AllOf(*[wrap_matcher(item) for item in items])
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/anyof.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/anyof.py
index 7a2bfc6627d..10a37e7c43e 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/anyof.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/anyof.py
@@ -1,37 +1,37 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class AnyOf(BaseMatcher):
-
- def __init__(self, *matchers):
- self.matchers = matchers
-
- def _matches(self, item):
- for matcher in self.matchers:
- if matcher.matches(item):
- return True
- return False
-
- def describe_to(self, description):
- description.append_list('(', ' or ', ')', self.matchers)
-
-
-def any_of(*items):
- """Matches if any of the given matchers evaluate to ``True``.
-
- :param matcher1,...: A comma-separated list of matchers.
-
- The matchers are evaluated from left to right using short-circuit
- evaluation, so evaluation stops as soon as a matcher returns ``True``.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- """
- return AnyOf(*[wrap_matcher(item) for item in items])
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class AnyOf(BaseMatcher):
+
+ def __init__(self, *matchers):
+ self.matchers = matchers
+
+ def _matches(self, item):
+ for matcher in self.matchers:
+ if matcher.matches(item):
+ return True
+ return False
+
+ def describe_to(self, description):
+ description.append_list('(', ' or ', ')', self.matchers)
+
+
+def any_of(*items):
+ """Matches if any of the given matchers evaluate to ``True``.
+
+ :param matcher1,...: A comma-separated list of matchers.
+
+ The matchers are evaluated from left to right using short-circuit
+ evaluation, so evaluation stops as soon as a matcher returns ``True``.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ """
+ return AnyOf(*[wrap_matcher(item) for item in items])
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/described_as.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/described_as.py
index 93b4d6ac458..0cc2aeddb4d 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/described_as.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/described_as.py
@@ -1,48 +1,48 @@
-from hamcrest.core.base_matcher import BaseMatcher
-import re
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-ARG_PATTERN = re.compile('%([0-9]+)')
-
-
-class DescribedAs(BaseMatcher):
-
- def __init__(self, description_template, matcher, *values):
- self.template = description_template
- self.matcher = matcher
- self.values = values
-
- def matches(self, item, mismatch_description=None):
- return self.matcher.matches(item, mismatch_description)
-
- def describe_mismatch(self, item, mismatch_description):
- self.matcher.describe_mismatch(item, mismatch_description)
-
- def describe_to(self, description):
- text_start = 0
- for match in re.finditer(ARG_PATTERN, self.template):
- description.append_text(self.template[text_start:match.start()])
- arg_index = int(match.group()[1:])
- description.append_description_of(self.values[arg_index])
- text_start = match.end()
-
- if text_start < len(self.template):
- description.append_text(self.template[text_start:])
-
-
-def described_as(description, matcher, *values):
- """Adds custom failure description to a given matcher.
-
- :param description: Overrides the matcher's description.
- :param matcher: The matcher to satisfy.
- :param value1,...: Optional comma-separated list of substitution values.
-
- The description may contain substitution placeholders %0, %1, etc. These
- will be replaced by any values that follow the matcher.
-
- """
- return DescribedAs(description, matcher, *values)
+from hamcrest.core.base_matcher import BaseMatcher
+import re
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+ARG_PATTERN = re.compile('%([0-9]+)')
+
+
+class DescribedAs(BaseMatcher):
+
+ def __init__(self, description_template, matcher, *values):
+ self.template = description_template
+ self.matcher = matcher
+ self.values = values
+
+ def matches(self, item, mismatch_description=None):
+ return self.matcher.matches(item, mismatch_description)
+
+ def describe_mismatch(self, item, mismatch_description):
+ self.matcher.describe_mismatch(item, mismatch_description)
+
+ def describe_to(self, description):
+ text_start = 0
+ for match in re.finditer(ARG_PATTERN, self.template):
+ description.append_text(self.template[text_start:match.start()])
+ arg_index = int(match.group()[1:])
+ description.append_description_of(self.values[arg_index])
+ text_start = match.end()
+
+ if text_start < len(self.template):
+ description.append_text(self.template[text_start:])
+
+
+def described_as(description, matcher, *values):
+ """Adds custom failure description to a given matcher.
+
+ :param description: Overrides the matcher's description.
+ :param matcher: The matcher to satisfy.
+ :param value1,...: Optional comma-separated list of substitution values.
+
+ The description may contain substitution placeholders %0, %1, etc. These
+ will be replaced by any values that follow the matcher.
+
+ """
+ return DescribedAs(description, matcher, *values)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/is_.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/is_.py
index ba11a762aeb..c536c657172 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/is_.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/is_.py
@@ -1,76 +1,76 @@
-from __future__ import absolute_import
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher, is_matchable_type
-from .isinstanceof import instance_of
-
-
-class Is(BaseMatcher):
-
- def __init__(self, matcher):
- self.matcher = matcher
-
- def matches(self, item, mismatch_description=None):
- return self.matcher.matches(item, mismatch_description)
-
- def describe_mismatch(self, item, mismatch_description):
- return self.matcher.describe_mismatch(item, mismatch_description)
-
- def describe_to(self, description):
- description.append_description_of(self.matcher)
-
-
-def wrap_value_or_type(x):
- if is_matchable_type(x):
- return instance_of(x)
- else:
- return wrap_matcher(x)
-
-
-def is_(x):
- """Decorates another matcher, or provides shortcuts to the frequently used
- ``is(equal_to(x))`` and ``is(instance_of(x))``.
-
- :param x: The matcher to satisfy, or a type for
- :py:func:`~hamcrest.core.core.isinstanceof.instance_of` matching, or an
- expected value for :py:func:`~hamcrest.core.core.isequal.equal_to`
- matching.
-
- This matcher compares the evaluated object to the given matcher.
-
- .. note::
-
- PyHamcrest's ``is_`` matcher is unrelated to Python's ``is`` operator.
- The matcher for object identity is
- :py:func:`~hamcrest.core.core.issame.same_instance`.
-
- If the ``x`` argument is a matcher, its behavior is retained, but the test
- may be more expressive. For example::
-
- assert_that(value, less_than(5))
- assert_that(value, is_(less_than(5)))
-
- If the ``x`` argument is a type, it is wrapped in an
- :py:func:`~hamcrest.core.core.isinstanceof.instance_of` matcher. This makes
- the following statements equivalent::
-
- assert_that(cheese, instance_of(Cheddar))
- assert_that(cheese, is_(instance_of(Cheddar)))
- assert_that(cheese, is_(Cheddar))
-
- Otherwise, if the ``x`` argument is not a matcher, it is wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher. This makes the
- following statements equivalent::
-
- assert_that(cheese, equal_to(smelly))
- assert_that(cheese, is_(equal_to(smelly)))
- assert_that(cheese, is_(smelly))
-
- Choose the style that makes your expression most readable. This will vary
- depending on context.
-
- """
- return Is(wrap_value_or_type(x))
+from __future__ import absolute_import
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher, is_matchable_type
+from .isinstanceof import instance_of
+
+
+class Is(BaseMatcher):
+
+ def __init__(self, matcher):
+ self.matcher = matcher
+
+ def matches(self, item, mismatch_description=None):
+ return self.matcher.matches(item, mismatch_description)
+
+ def describe_mismatch(self, item, mismatch_description):
+ return self.matcher.describe_mismatch(item, mismatch_description)
+
+ def describe_to(self, description):
+ description.append_description_of(self.matcher)
+
+
+def wrap_value_or_type(x):
+ if is_matchable_type(x):
+ return instance_of(x)
+ else:
+ return wrap_matcher(x)
+
+
+def is_(x):
+ """Decorates another matcher, or provides shortcuts to the frequently used
+ ``is(equal_to(x))`` and ``is(instance_of(x))``.
+
+ :param x: The matcher to satisfy, or a type for
+ :py:func:`~hamcrest.core.core.isinstanceof.instance_of` matching, or an
+ expected value for :py:func:`~hamcrest.core.core.isequal.equal_to`
+ matching.
+
+ This matcher compares the evaluated object to the given matcher.
+
+ .. note::
+
+ PyHamcrest's ``is_`` matcher is unrelated to Python's ``is`` operator.
+ The matcher for object identity is
+ :py:func:`~hamcrest.core.core.issame.same_instance`.
+
+ If the ``x`` argument is a matcher, its behavior is retained, but the test
+ may be more expressive. For example::
+
+ assert_that(value, less_than(5))
+ assert_that(value, is_(less_than(5)))
+
+ If the ``x`` argument is a type, it is wrapped in an
+ :py:func:`~hamcrest.core.core.isinstanceof.instance_of` matcher. This makes
+ the following statements equivalent::
+
+ assert_that(cheese, instance_of(Cheddar))
+ assert_that(cheese, is_(instance_of(Cheddar)))
+ assert_that(cheese, is_(Cheddar))
+
+ Otherwise, if the ``x`` argument is not a matcher, it is wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher. This makes the
+ following statements equivalent::
+
+ assert_that(cheese, equal_to(smelly))
+ assert_that(cheese, is_(equal_to(smelly)))
+ assert_that(cheese, is_(smelly))
+
+ Choose the style that makes your expression most readable. This will vary
+ depending on context.
+
+ """
+ return Is(wrap_value_or_type(x))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/isanything.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/isanything.py
index f916811bc97..b2bb8939f2f 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/isanything.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/isanything.py
@@ -1,31 +1,31 @@
-from hamcrest.core.base_matcher import BaseMatcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsAnything(BaseMatcher):
-
- def __init__(self, description):
- self.description = description
- if not description:
- self.description = 'ANYTHING'
-
- def _matches(self, item):
- return True
-
- def describe_to(self, description):
- description.append_text(self.description)
-
-
-def anything(description=None):
- """Matches anything.
-
- :param description: Optional string used to describe this matcher.
-
- This matcher always evaluates to ``True``. Specify this in composite
- matchers when the value of a particular element is unimportant.
-
- """
- return IsAnything(description)
+from hamcrest.core.base_matcher import BaseMatcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsAnything(BaseMatcher):
+
+ def __init__(self, description):
+ self.description = description
+ if not description:
+ self.description = 'ANYTHING'
+
+ def _matches(self, item):
+ return True
+
+ def describe_to(self, description):
+ description.append_text(self.description)
+
+
+def anything(description=None):
+ """Matches anything.
+
+ :param description: Optional string used to describe this matcher.
+
+ This matcher always evaluates to ``True``. Specify this in composite
+ matchers when the value of a particular element is unimportant.
+
+ """
+ return IsAnything(description)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/isequal.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/isequal.py
index 119fd58a482..f3764b0acd8 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/isequal.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/isequal.py
@@ -1,32 +1,32 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.matcher import Matcher
-
-
-class IsEqual(BaseMatcher):
-
- def __init__(self, equals):
- self.object = equals
-
- def _matches(self, item):
- return item == self.object
-
- def describe_to(self, description):
- nested_matcher = isinstance(self.object, Matcher)
- if nested_matcher:
- description.append_text('<')
- description.append_description_of(self.object)
- if nested_matcher:
- description.append_text('>')
-
-
-def equal_to(obj):
- """Matches if object is equal to a given object.
-
- :param obj: The object to compare against as the expected value.
-
- This matcher compares the evaluated object to ``obj`` for equality."""
- return IsEqual(obj)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.matcher import Matcher
+
+
+class IsEqual(BaseMatcher):
+
+ def __init__(self, equals):
+ self.object = equals
+
+ def _matches(self, item):
+ return item == self.object
+
+ def describe_to(self, description):
+ nested_matcher = isinstance(self.object, Matcher)
+ if nested_matcher:
+ description.append_text('<')
+ description.append_description_of(self.object)
+ if nested_matcher:
+ description.append_text('>')
+
+
+def equal_to(obj):
+ """Matches if object is equal to a given object.
+
+ :param obj: The object to compare against as the expected value.
+
+ This matcher compares the evaluated object to ``obj`` for equality."""
+ return IsEqual(obj)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/isinstanceof.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/isinstanceof.py
index f8eb4a2fd10..d30e36bd3fc 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/isinstanceof.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/isinstanceof.py
@@ -1,43 +1,43 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.wrap_matcher import is_matchable_type
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-import types
-
-class IsInstanceOf(BaseMatcher):
-
- def __init__(self, expected_type):
- if not is_matchable_type(expected_type):
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.wrap_matcher import is_matchable_type
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+import types
+
+class IsInstanceOf(BaseMatcher):
+
+ def __init__(self, expected_type):
+ if not is_matchable_type(expected_type):
raise TypeError('IsInstanceOf requires type or a tuple of classes and types')
- self.expected_type = expected_type
-
- def _matches(self, item):
- return isinstance(item, self.expected_type)
-
- def describe_to(self, description):
+ self.expected_type = expected_type
+
+ def _matches(self, item):
+ return isinstance(item, self.expected_type)
+
+ def describe_to(self, description):
try:
type_description = self.expected_type.__name__
except AttributeError:
type_description = "one of %s" % ",".join(str(e) for e in self.expected_type)
- description.append_text('an instance of ') \
+ description.append_text('an instance of ') \
.append_text(type_description)
-
-
-def instance_of(atype):
- """Matches if object is an instance of, or inherits from, a given type.
-
+
+
+def instance_of(atype):
+ """Matches if object is an instance of, or inherits from, a given type.
+
:param atype: The type to compare against as the expected type or a tuple
of types.
-
- This matcher checks whether the evaluated object is an instance of
- ``atype`` or an instance of any class that inherits from ``atype``.
-
- Example::
-
- instance_of(str)
-
- """
- return IsInstanceOf(atype)
+
+ This matcher checks whether the evaluated object is an instance of
+ ``atype`` or an instance of any class that inherits from ``atype``.
+
+ Example::
+
+ instance_of(str)
+
+ """
+ return IsInstanceOf(atype)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/isnone.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/isnone.py
index 511fd5ae461..505168289d4 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/isnone.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/isnone.py
@@ -1,26 +1,26 @@
-from __future__ import absolute_import
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-from .isnot import is_not
-
-
-class IsNone(BaseMatcher):
-
- def _matches(self, item):
- return item is None
-
- def describe_to(self, description):
- description.append_text('None')
-
-
-def none():
- """Matches if object is ``None``."""
- return IsNone()
-
-
-def not_none():
- """Matches if object is not ``None``."""
- return is_not(none())
+from __future__ import absolute_import
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+from .isnot import is_not
+
+
+class IsNone(BaseMatcher):
+
+ def _matches(self, item):
+ return item is None
+
+ def describe_to(self, description):
+ description.append_text('None')
+
+
+def none():
+ """Matches if object is ``None``."""
+ return IsNone()
+
+
+def not_none():
+ """Matches if object is not ``None``."""
+ return is_not(none())
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/isnot.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/isnot.py
index 7567e6f325d..bb90df77876 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/isnot.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/isnot.py
@@ -1,57 +1,57 @@
-from __future__ import absolute_import
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher, Matcher
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher, is_matchable_type
-from .isequal import equal_to
-from .isinstanceof import instance_of
-
-
-class IsNot(BaseMatcher):
-
- def __init__(self, matcher):
- self.matcher = matcher
-
- def _matches(self, item):
- return not self.matcher.matches(item)
-
- def describe_to(self, description):
- description.append_text('not ').append_description_of(self.matcher)
-
-
-def wrap_value_or_type(x):
- if is_matchable_type(x):
- return instance_of(x)
- else:
- return wrap_matcher(x)
-
-
-def is_not(match):
- """Inverts the given matcher to its logical negation.
-
- :param match: The matcher to negate.
-
- This matcher compares the evaluated object to the negation of the given
- matcher. If the ``match`` argument is not a matcher, it is implicitly
- wrapped in an :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to
- check for equality, and thus matches for inequality.
-
- Examples::
-
- assert_that(cheese, is_not(equal_to(smelly)))
- assert_that(cheese, is_not(smelly))
-
- """
- return IsNot(wrap_value_or_type(match))
-
-def not_(match):
- """Alias of :py:func:`is_not` for better readability of negations.
-
- Examples::
-
- assert_that(alist, not_(has_item(item)))
-
- """
- return is_not(match)
+from __future__ import absolute_import
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher, Matcher
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher, is_matchable_type
+from .isequal import equal_to
+from .isinstanceof import instance_of
+
+
+class IsNot(BaseMatcher):
+
+ def __init__(self, matcher):
+ self.matcher = matcher
+
+ def _matches(self, item):
+ return not self.matcher.matches(item)
+
+ def describe_to(self, description):
+ description.append_text('not ').append_description_of(self.matcher)
+
+
+def wrap_value_or_type(x):
+ if is_matchable_type(x):
+ return instance_of(x)
+ else:
+ return wrap_matcher(x)
+
+
+def is_not(match):
+ """Inverts the given matcher to its logical negation.
+
+ :param match: The matcher to negate.
+
+ This matcher compares the evaluated object to the negation of the given
+ matcher. If the ``match`` argument is not a matcher, it is implicitly
+ wrapped in an :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to
+ check for equality, and thus matches for inequality.
+
+ Examples::
+
+ assert_that(cheese, is_not(equal_to(smelly)))
+ assert_that(cheese, is_not(smelly))
+
+ """
+ return IsNot(wrap_value_or_type(match))
+
+def not_(match):
+ """Alias of :py:func:`is_not` for better readability of negations.
+
+ Examples::
+
+ assert_that(alist, not_(has_item(item)))
+
+ """
+ return is_not(match)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/issame.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/issame.py
index b1f85427d7a..6a607439d75 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/issame.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/issame.py
@@ -1,39 +1,39 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-
-
-class IsSame(BaseMatcher):
-
- def __init__(self, object):
- self.object = object
-
- def _matches(self, item):
- return item is self.object
-
- def describe_to(self, description):
- description.append_text('same instance as ') \
- .append_text(hex(id(self.object))) \
- .append_text(' ') \
- .append_description_of(self.object)
-
- def describe_mismatch(self, item, mismatch_description):
- mismatch_description.append_text('was ')
- if item is not None:
- mismatch_description.append_text(hex(id(item))) \
- .append_text(' ')
- mismatch_description.append_description_of(item)
-
-
-def same_instance(obj):
- """Matches if evaluated object is the same instance as a given object.
-
- :param obj: The object to compare against as the expected value.
-
- This matcher invokes the ``is`` identity operator to determine if the
- evaluated object is the the same object as ``obj``.
-
- """
- return IsSame(obj)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+
+
+class IsSame(BaseMatcher):
+
+ def __init__(self, object):
+ self.object = object
+
+ def _matches(self, item):
+ return item is self.object
+
+ def describe_to(self, description):
+ description.append_text('same instance as ') \
+ .append_text(hex(id(self.object))) \
+ .append_text(' ') \
+ .append_description_of(self.object)
+
+ def describe_mismatch(self, item, mismatch_description):
+ mismatch_description.append_text('was ')
+ if item is not None:
+ mismatch_description.append_text(hex(id(item))) \
+ .append_text(' ')
+ mismatch_description.append_description_of(item)
+
+
+def same_instance(obj):
+ """Matches if evaluated object is the same instance as a given object.
+
+ :param obj: The object to compare against as the expected value.
+
+ This matcher invokes the ``is`` identity operator to determine if the
+ evaluated object is the the same object as ``obj``.
+
+ """
+ return IsSame(obj)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/core/raises.py b/contrib/python/PyHamcrest/src/hamcrest/core/core/raises.py
index 878e2af87aa..06236f179b0 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/core/raises.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/core/raises.py
@@ -1,121 +1,121 @@
-from weakref import ref
-import re
-import sys
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-from hamcrest.core.compat import is_callable
-
-__author__ = "Per Fagrell"
-__copyright__ = "Copyright 2013 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class Raises(BaseMatcher):
- def __init__(self, expected, pattern=None, matcher=None):
- self.pattern = pattern
- self.expected = expected
- self.actual = None
- self.function = None
- self.matcher = matcher
- self.actual_return_value = None
-
- def _matches(self, function):
- if not is_callable(function):
- return False
-
- self.function = ref(function)
- return self._call_function(function)
-
- def _call_function(self, function):
- self.actual = None
- try:
- self.actual_return_value = function()
- except Exception:
- self.actual = sys.exc_info()[1]
-
- if isinstance(self.actual, self.expected):
- if self.pattern is not None:
- return (
- re.search(self.pattern, str(self.actual)) is not None
- and (self.matcher is None or self.matcher.matches(self.actual))
- )
- return self.matcher is None or self.matcher.matches(self.actual)
- return False
-
- def describe_to(self, description):
- description.append_text('Expected a callable raising %s' % self.expected)
- if self.matcher is not None:
- description.append_text("\n and ")
- description.append_description_of(self.matcher)
-
- def describe_mismatch(self, item, description):
- if not is_callable(item):
- description.append_text('%s is not callable' % item)
- return
-
- function = None if self.function is None else self.function()
- if function is None or function is not item:
- self.function = ref(item)
- if not self._call_function(item):
- return
-
- if self.actual is None:
- description.append_text('No exception raised and actual return value = ')
- description.append_value(self.actual_return_value)
- elif isinstance(self.actual, self.expected):
- if self.pattern is not None:
- description.append_text('Correct assertion type raised, but the expected pattern ("%s") not found.' % self.pattern)
- description.append_text('\n message was: "%s"' % str(self.actual))
- if self.matcher is not None:
- description.append_text("\nAdditional exception matcher: ")
- self.matcher.describe_mismatch(self.actual, description)
- else:
- description.append_text('%s was raised instead' % type(self.actual))
-
-
-def raises(exception, pattern=None, matcher=None):
- """Matches if the called function raised the expected exception.
-
- :param exception: The class of the expected exception
- :param pattern: Optional regular expression to match exception message.
-
- Expects the actual to be wrapped by using :py:func:`~hamcrest.core.core.raises.calling`,
- or a callable taking no arguments.
- Optional argument pattern should be a string containing a regular expression. If provided,
- the string representation of the actual exception - e.g. `str(actual)` - must match pattern.
-
- Examples::
-
- assert_that(calling(int).with_args('q'), raises(TypeError))
- assert_that(calling(parse, broken_input), raises(ValueError))
- """
- return Raises(exception, pattern, matcher)
-
-
-class DeferredCallable(object):
- def __init__(self, func):
- self.func = func
- self.args = tuple()
- self.kwargs = {}
-
- def __call__(self):
+from weakref import ref
+import re
+import sys
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+from hamcrest.core.compat import is_callable
+
+__author__ = "Per Fagrell"
+__copyright__ = "Copyright 2013 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class Raises(BaseMatcher):
+ def __init__(self, expected, pattern=None, matcher=None):
+ self.pattern = pattern
+ self.expected = expected
+ self.actual = None
+ self.function = None
+ self.matcher = matcher
+ self.actual_return_value = None
+
+ def _matches(self, function):
+ if not is_callable(function):
+ return False
+
+ self.function = ref(function)
+ return self._call_function(function)
+
+ def _call_function(self, function):
+ self.actual = None
+ try:
+ self.actual_return_value = function()
+ except Exception:
+ self.actual = sys.exc_info()[1]
+
+ if isinstance(self.actual, self.expected):
+ if self.pattern is not None:
+ return (
+ re.search(self.pattern, str(self.actual)) is not None
+ and (self.matcher is None or self.matcher.matches(self.actual))
+ )
+ return self.matcher is None or self.matcher.matches(self.actual)
+ return False
+
+ def describe_to(self, description):
+ description.append_text('Expected a callable raising %s' % self.expected)
+ if self.matcher is not None:
+ description.append_text("\n and ")
+ description.append_description_of(self.matcher)
+
+ def describe_mismatch(self, item, description):
+ if not is_callable(item):
+ description.append_text('%s is not callable' % item)
+ return
+
+ function = None if self.function is None else self.function()
+ if function is None or function is not item:
+ self.function = ref(item)
+ if not self._call_function(item):
+ return
+
+ if self.actual is None:
+ description.append_text('No exception raised and actual return value = ')
+ description.append_value(self.actual_return_value)
+ elif isinstance(self.actual, self.expected):
+ if self.pattern is not None:
+ description.append_text('Correct assertion type raised, but the expected pattern ("%s") not found.' % self.pattern)
+ description.append_text('\n message was: "%s"' % str(self.actual))
+ if self.matcher is not None:
+ description.append_text("\nAdditional exception matcher: ")
+ self.matcher.describe_mismatch(self.actual, description)
+ else:
+ description.append_text('%s was raised instead' % type(self.actual))
+
+
+def raises(exception, pattern=None, matcher=None):
+ """Matches if the called function raised the expected exception.
+
+ :param exception: The class of the expected exception
+ :param pattern: Optional regular expression to match exception message.
+
+ Expects the actual to be wrapped by using :py:func:`~hamcrest.core.core.raises.calling`,
+ or a callable taking no arguments.
+ Optional argument pattern should be a string containing a regular expression. If provided,
+ the string representation of the actual exception - e.g. `str(actual)` - must match pattern.
+
+ Examples::
+
+ assert_that(calling(int).with_args('q'), raises(TypeError))
+ assert_that(calling(parse, broken_input), raises(ValueError))
+ """
+ return Raises(exception, pattern, matcher)
+
+
+class DeferredCallable(object):
+ def __init__(self, func):
+ self.func = func
+ self.args = tuple()
+ self.kwargs = {}
+
+ def __call__(self):
return self.func(*self.args, **self.kwargs)
-
- def with_args(self, *args, **kwargs):
- self.args = args
- self.kwargs = kwargs
- return self
-
-
-def calling(func):
- """Wrapper for function call that delays the actual execution so that
- :py:func:`~hamcrest.core.core.raises.raises` matcher can catch any thrown exception.
-
- :param func: The function or method to be called
-
- The arguments can be provided with a call to the `with_args` function on the returned
- object::
-
- calling(my_method).with_args(arguments, and_='keywords')
- """
- return DeferredCallable(func)
+
+ def with_args(self, *args, **kwargs):
+ self.args = args
+ self.kwargs = kwargs
+ return self
+
+
+def calling(func):
+ """Wrapper for function call that delays the actual execution so that
+ :py:func:`~hamcrest.core.core.raises.raises` matcher can catch any thrown exception.
+
+ :param func: The function or method to be called
+
+ The arguments can be provided with a call to the `with_args` function on the returned
+ object::
+
+ calling(my_method).with_args(arguments, and_='keywords')
+ """
+ return DeferredCallable(func)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/description.py b/contrib/python/PyHamcrest/src/hamcrest/core/description.py
index 6201b7f70f9..58c935643a7 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/description.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/description.py
@@ -1,58 +1,58 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class Description(object):
- """A description of a :py:class:`~hamcrest.core.matcher.Matcher`.
-
- A :py:class:`~hamcrest.core.matcher.Matcher` will describe itself to a
- description which can later be used for reporting.
-
- """
-
- def append_text(self, text):
- """Appends some plain text to the description.
-
- :returns: ``self``, for chaining
-
- """
- raise NotImplementedError('append_text')
-
- def append_description_of(self, value):
- """Appends description of given value to this description.
-
- If the value implements
- :py:meth:`~hamcrest.core.selfdescribing.SelfDescribing.describe_to`,
- then it will be used.
-
- :returns: ``self``, for chaining
-
- """
- raise NotImplementedError('append_description_of')
-
- def append_value(self, value):
- """Appends an arbitary value to the description.
-
- **Deprecated:** Call
- :py:meth:`~hamcrest.core.description.Description.append_description_of`
- instead.
-
- :returns: ``self``, for chaining
-
- """
- raise NotImplementedError('append_value')
-
- def append_list(self, start, separator, end, list):
- """Appends a list of objects to the description.
-
- :param start: String that will begin the list description.
- :param separator: String that will separate each object in the
- description.
- :param end: String that will end the list description.
- :param list: List of objects to be described.
-
- :returns: ``self``, for chaining
-
- """
- raise NotImplementedError('append_list')
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class Description(object):
+ """A description of a :py:class:`~hamcrest.core.matcher.Matcher`.
+
+ A :py:class:`~hamcrest.core.matcher.Matcher` will describe itself to a
+ description which can later be used for reporting.
+
+ """
+
+ def append_text(self, text):
+ """Appends some plain text to the description.
+
+ :returns: ``self``, for chaining
+
+ """
+ raise NotImplementedError('append_text')
+
+ def append_description_of(self, value):
+ """Appends description of given value to this description.
+
+ If the value implements
+ :py:meth:`~hamcrest.core.selfdescribing.SelfDescribing.describe_to`,
+ then it will be used.
+
+ :returns: ``self``, for chaining
+
+ """
+ raise NotImplementedError('append_description_of')
+
+ def append_value(self, value):
+ """Appends an arbitary value to the description.
+
+ **Deprecated:** Call
+ :py:meth:`~hamcrest.core.description.Description.append_description_of`
+ instead.
+
+ :returns: ``self``, for chaining
+
+ """
+ raise NotImplementedError('append_value')
+
+ def append_list(self, start, separator, end, list):
+ """Appends a list of objects to the description.
+
+ :param start: String that will begin the list description.
+ :param separator: String that will separate each object in the
+ description.
+ :param end: String that will end the list description.
+ :param list: List of objects to be described.
+
+ :returns: ``self``, for chaining
+
+ """
+ raise NotImplementedError('append_list')
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/helpers/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/core/helpers/__init__.py
index 61cb82d43b5..6dfd8c22205 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/helpers/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/helpers/__init__.py
@@ -1,5 +1,5 @@
-"""Utilities for writing Matchers."""
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
+"""Utilities for writing Matchers."""
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/helpers/hasmethod.py b/contrib/python/PyHamcrest/src/hamcrest/core/helpers/hasmethod.py
index a1f3bfb1549..8f88beb1ac3 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/helpers/hasmethod.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/helpers/hasmethod.py
@@ -1,12 +1,12 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-def hasmethod(obj, methodname):
- """Does ``obj`` have a method named ``methodname``?"""
-
- if not hasattr(obj, methodname):
- return False
- method = getattr(obj, methodname)
- return callable(method)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+def hasmethod(obj, methodname):
+ """Does ``obj`` have a method named ``methodname``?"""
+
+ if not hasattr(obj, methodname):
+ return False
+ method = getattr(obj, methodname)
+ return callable(method)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/helpers/wrap_matcher.py b/contrib/python/PyHamcrest/src/hamcrest/core/helpers/wrap_matcher.py
index a5b506fb395..9eb0e355d27 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/helpers/wrap_matcher.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/helpers/wrap_matcher.py
@@ -1,36 +1,36 @@
-import six
-
-from hamcrest.core.base_matcher import Matcher
-from hamcrest.core.core.isequal import equal_to
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-import types
-
-def wrap_matcher(x):
- """Wraps argument in a matcher, if necessary.
-
- :returns: the argument as-is if it is already a matcher, otherwise wrapped
- in an :py:func:`~hamcrest.core.core.isequal.equal_to` matcher.
-
- """
- if isinstance(x, Matcher):
- return x
- else:
- return equal_to(x)
-
-def is_matchable_type(expected_type):
- if isinstance(expected_type, type):
- return True
-
- if isinstance(expected_type, six.class_types):
- return True
-
+import six
+
+from hamcrest.core.base_matcher import Matcher
+from hamcrest.core.core.isequal import equal_to
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+import types
+
+def wrap_matcher(x):
+ """Wraps argument in a matcher, if necessary.
+
+ :returns: the argument as-is if it is already a matcher, otherwise wrapped
+ in an :py:func:`~hamcrest.core.core.isequal.equal_to` matcher.
+
+ """
+ if isinstance(x, Matcher):
+ return x
+ else:
+ return equal_to(x)
+
+def is_matchable_type(expected_type):
+ if isinstance(expected_type, type):
+ return True
+
+ if isinstance(expected_type, six.class_types):
+ return True
+
if isinstance(expected_type, tuple) and \
expected_type and \
all(map(is_matchable_type, expected_type)):
return True
- return False
+ return False
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/matcher.py b/contrib/python/PyHamcrest/src/hamcrest/core/matcher.py
index 81ee27c6d9d..48e5636fa9e 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/matcher.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/matcher.py
@@ -1,52 +1,52 @@
-from __future__ import absolute_import
-from .selfdescribing import SelfDescribing
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class Matcher(SelfDescribing):
- """A matcher over acceptable values.
-
- A matcher is able to describe itself to give feedback when it fails.
-
- Matcher implementations should *not* directly implement this protocol.
- Instead, *extend* the :py:class:`~hamcrest.core.base_matcher.BaseMatcher`
- class, which will ensure that the
- :py:class:`~hamcrest.core.matcher.Matcher` API can grow to support new
- features and remain compatible with all
- :py:class:`~hamcrest.core.matcher.Matcher` implementations.
-
- """
-
- def matches(self, item, mismatch_description=None):
- """Evaluates the matcher for argument item.
-
- If a mismatch is detected and argument ``mismatch_description`` is
- provided, it will generate a description of why the matcher has not
- accepted the item.
-
- :param item: The object against which the matcher is evaluated.
- :returns: ``True`` if ``item`` matches, otherwise ``False``.
-
- """
- raise NotImplementedError('matches')
-
- def describe_mismatch(self, item, mismatch_description):
- """Generates a description of why the matcher has not accepted the
- item.
-
- The description will be part of a larger description of why a matching
- failed, so it should be concise.
-
- This method assumes that ``matches(item)`` is ``False``, but will not
- check this.
-
- :param item: The item that the
- :py:class:`~hamcrest.core.matcher.Matcher` has rejected.
- :param mismatch_description: The description to be built or appended
- to.
-
- """
- raise NotImplementedError('describe_mismatch')
+from __future__ import absolute_import
+from .selfdescribing import SelfDescribing
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class Matcher(SelfDescribing):
+ """A matcher over acceptable values.
+
+ A matcher is able to describe itself to give feedback when it fails.
+
+ Matcher implementations should *not* directly implement this protocol.
+ Instead, *extend* the :py:class:`~hamcrest.core.base_matcher.BaseMatcher`
+ class, which will ensure that the
+ :py:class:`~hamcrest.core.matcher.Matcher` API can grow to support new
+ features and remain compatible with all
+ :py:class:`~hamcrest.core.matcher.Matcher` implementations.
+
+ """
+
+ def matches(self, item, mismatch_description=None):
+ """Evaluates the matcher for argument item.
+
+ If a mismatch is detected and argument ``mismatch_description`` is
+ provided, it will generate a description of why the matcher has not
+ accepted the item.
+
+ :param item: The object against which the matcher is evaluated.
+ :returns: ``True`` if ``item`` matches, otherwise ``False``.
+
+ """
+ raise NotImplementedError('matches')
+
+ def describe_mismatch(self, item, mismatch_description):
+ """Generates a description of why the matcher has not accepted the
+ item.
+
+ The description will be part of a larger description of why a matching
+ failed, so it should be concise.
+
+ This method assumes that ``matches(item)`` is ``False``, but will not
+ check this.
+
+ :param item: The item that the
+ :py:class:`~hamcrest.core.matcher.Matcher` has rejected.
+ :param mismatch_description: The description to be built or appended
+ to.
+
+ """
+ raise NotImplementedError('describe_mismatch')
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/selfdescribing.py b/contrib/python/PyHamcrest/src/hamcrest/core/selfdescribing.py
index e77b0e0fdb6..4b0d6e9fbf5 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/selfdescribing.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/selfdescribing.py
@@ -1,18 +1,18 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class SelfDescribing(object):
- """The ability of an object to describe itself."""
-
- def describe_to(self, description):
- """Generates a description of the object.
-
- The description may be part of a description of a larger object of
- which this is just a component, so it should be worded appropriately.
-
- :param description: The description to be built or appended to.
-
- """
- raise NotImplementedError('describe_to')
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class SelfDescribing(object):
+ """The ability of an object to describe itself."""
+
+ def describe_to(self, description):
+ """Generates a description of the object.
+
+ The description may be part of a description of a larger object of
+ which this is just a component, so it should be worded appropriately.
+
+ :param description: The description to be built or appended to.
+
+ """
+ raise NotImplementedError('describe_to')
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/selfdescribingvalue.py b/contrib/python/PyHamcrest/src/hamcrest/core/selfdescribingvalue.py
index dfa4e3a20e4..c3f31d43b40 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/selfdescribingvalue.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/selfdescribingvalue.py
@@ -1,27 +1,27 @@
-from hamcrest.core.selfdescribing import SelfDescribing
-
-import warnings
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class SelfDescribingValue(SelfDescribing):
- """Wrap any value in a ``SelfDescribingValue`` to satisfy the
- :py:class:`~hamcrest.core.selfdescribing.SelfDescribing` interface.
-
- **Deprecated:** No need for this class now that
- :py:meth:`~hamcrest.core.description.Description.append_description_of`
- handles any type of value.
-
- """
-
- def __init__(self, value):
- warnings.warn('SelfDescribingValue no longer needed',
- DeprecationWarning)
- self.value = value
-
- def describe_to(self, description):
- """Generates a description of the value."""
- description.append_value(self.value)
+from hamcrest.core.selfdescribing import SelfDescribing
+
+import warnings
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class SelfDescribingValue(SelfDescribing):
+ """Wrap any value in a ``SelfDescribingValue`` to satisfy the
+ :py:class:`~hamcrest.core.selfdescribing.SelfDescribing` interface.
+
+ **Deprecated:** No need for this class now that
+ :py:meth:`~hamcrest.core.description.Description.append_description_of`
+ handles any type of value.
+
+ """
+
+ def __init__(self, value):
+ warnings.warn('SelfDescribingValue no longer needed',
+ DeprecationWarning)
+ self.value = value
+
+ def describe_to(self, description):
+ """Generates a description of the value."""
+ description.append_value(self.value)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/core/string_description.py b/contrib/python/PyHamcrest/src/hamcrest/core/string_description.py
index 7626bf91e8e..780fdac7c36 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/core/string_description.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/core/string_description.py
@@ -1,37 +1,37 @@
-from __future__ import absolute_import
-
-import codecs
-import six
-
-from .base_description import BaseDescription
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-def tostring(selfdescribing):
- """Returns the description of a
- :py:class:`~hamcrest.core.selfdescribing.SelfDescribing` object as a
- string.
-
- :param selfdescribing: The object to be described.
- :returns: The description of the object.
- """
- return str(StringDescription().append_description_of(selfdescribing))
-
-
-class StringDescription(BaseDescription):
- """A :py:class:`~hamcrest.core.description.Description` that is stored as a
- string.
- """
-
- def __init__(self):
- self.__out_list = []
-
- def __str__(self):
- """Returns the description."""
- return ''.join(self.__out_list)
-
- def append(self, string):
- self.__out_list.append(six.text_type(string))
+from __future__ import absolute_import
+
+import codecs
+import six
+
+from .base_description import BaseDescription
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+def tostring(selfdescribing):
+ """Returns the description of a
+ :py:class:`~hamcrest.core.selfdescribing.SelfDescribing` object as a
+ string.
+
+ :param selfdescribing: The object to be described.
+ :returns: The description of the object.
+ """
+ return str(StringDescription().append_description_of(selfdescribing))
+
+
+class StringDescription(BaseDescription):
+ """A :py:class:`~hamcrest.core.description.Description` that is stored as a
+ string.
+ """
+
+ def __init__(self):
+ self.__out_list = []
+
+ def __str__(self):
+ """Returns the description."""
+ return ''.join(self.__out_list)
+
+ def append(self, string):
+ self.__out_list.append(six.text_type(string))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/library/__init__.py
index a5a7963521f..15c46401fc7 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/__init__.py
@@ -1,44 +1,44 @@
-from __future__ import absolute_import
-"""Library of Matcher implementations."""
-
-from hamcrest.core import *
-from hamcrest.library.collection import *
-from hamcrest.library.integration import *
-from hamcrest.library.number import *
-from hamcrest.library.object import *
-from hamcrest.library.text import *
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-__all__ = [
- 'has_entry',
- 'has_entries',
- 'has_key',
- 'has_value',
- 'is_in',
- 'empty',
- 'has_item',
- 'has_items',
- 'contains_inanyorder',
- 'contains',
- 'only_contains',
- 'match_equality',
- 'matches_regexp',
- 'close_to',
- 'greater_than',
- 'greater_than_or_equal_to',
- 'less_than',
- 'less_than_or_equal_to',
- 'has_length',
- 'has_property',
- 'has_properties',
- 'has_string',
- 'equal_to_ignoring_case',
- 'equal_to_ignoring_whitespace',
- 'contains_string',
- 'ends_with',
- 'starts_with',
- 'string_contains_in_order',
-]
+from __future__ import absolute_import
+"""Library of Matcher implementations."""
+
+from hamcrest.core import *
+from hamcrest.library.collection import *
+from hamcrest.library.integration import *
+from hamcrest.library.number import *
+from hamcrest.library.object import *
+from hamcrest.library.text import *
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+__all__ = [
+ 'has_entry',
+ 'has_entries',
+ 'has_key',
+ 'has_value',
+ 'is_in',
+ 'empty',
+ 'has_item',
+ 'has_items',
+ 'contains_inanyorder',
+ 'contains',
+ 'only_contains',
+ 'match_equality',
+ 'matches_regexp',
+ 'close_to',
+ 'greater_than',
+ 'greater_than_or_equal_to',
+ 'less_than',
+ 'less_than_or_equal_to',
+ 'has_length',
+ 'has_property',
+ 'has_properties',
+ 'has_string',
+ 'equal_to_ignoring_case',
+ 'equal_to_ignoring_whitespace',
+ 'contains_string',
+ 'ends_with',
+ 'starts_with',
+ 'string_contains_in_order',
+]
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/__init__.py
index 2f899877883..ac72268ef41 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/__init__.py
@@ -1,16 +1,16 @@
-"""Matchers of collections."""
-from __future__ import absolute_import
-from .isdict_containing import has_entry
-from .isdict_containingentries import has_entries
-from .isdict_containingkey import has_key
-from .isdict_containingvalue import has_value
-from .isin import is_in
-from .issequence_containing import has_item, has_items
-from .issequence_containinginanyorder import contains_inanyorder
-from .issequence_containinginorder import contains
-from .issequence_onlycontaining import only_contains
-from .is_empty import empty
-
-__author__ = "Chris Rose"
-__copyright__ = "Copyright 2013 hamcrest.org"
-__license__ = "BSD, see License.txt"
+"""Matchers of collections."""
+from __future__ import absolute_import
+from .isdict_containing import has_entry
+from .isdict_containingentries import has_entries
+from .isdict_containingkey import has_key
+from .isdict_containingvalue import has_value
+from .isin import is_in
+from .issequence_containing import has_item, has_items
+from .issequence_containinginanyorder import contains_inanyorder
+from .issequence_containinginorder import contains
+from .issequence_onlycontaining import only_contains
+from .is_empty import empty
+
+__author__ = "Chris Rose"
+__copyright__ = "Copyright 2013 hamcrest.org"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/is_empty.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/is_empty.py
index bc99b633730..45ac32cec18 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/is_empty.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/is_empty.py
@@ -1,35 +1,35 @@
-from hamcrest.core.base_matcher import BaseMatcher
-
-__author__ = "Chris Rose"
-__copyright__ = "Copyright 2012 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsEmpty(BaseMatcher):
-
- def matches(self, item, mismatch_description=None):
- try:
- if len(item) == 0:
- return True
-
- if mismatch_description:
- mismatch_description \
- .append_text('has %d item(s)' % len(item))
-
- except TypeError:
- if mismatch_description:
- mismatch_description \
- .append_text('does not support length')
-
- return False
-
- def describe_to(self, description):
- description.append_text('an empty collection')
-
-
-def empty():
- """
- This matcher matches any collection-like object that responds to the
- __len__ method, and has a length of 0.
- """
- return IsEmpty()
+from hamcrest.core.base_matcher import BaseMatcher
+
+__author__ = "Chris Rose"
+__copyright__ = "Copyright 2012 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsEmpty(BaseMatcher):
+
+ def matches(self, item, mismatch_description=None):
+ try:
+ if len(item) == 0:
+ return True
+
+ if mismatch_description:
+ mismatch_description \
+ .append_text('has %d item(s)' % len(item))
+
+ except TypeError:
+ if mismatch_description:
+ mismatch_description \
+ .append_text('does not support length')
+
+ return False
+
+ def describe_to(self, description):
+ description.append_text('an empty collection')
+
+
+def empty():
+ """
+ This matcher matches any collection-like object that responds to the
+ __len__ method, and has a length of 0.
+ """
+ return IsEmpty()
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containing.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containing.py
index 95281973fb5..f24a119cd59 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containing.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containing.py
@@ -1,54 +1,54 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsDictContaining(BaseMatcher):
-
- def __init__(self, key_matcher, value_matcher):
- self.key_matcher = key_matcher
- self.value_matcher = value_matcher
-
- def _matches(self, dictionary):
- if hasmethod(dictionary, 'items'):
- for key, value in dictionary.items():
- if self.key_matcher.matches(key) and self.value_matcher.matches(value):
- return True
- return False
-
- def describe_to(self, description):
- description.append_text('a dictionary containing [') \
- .append_description_of(self.key_matcher) \
- .append_text(': ') \
- .append_description_of(self.value_matcher) \
- .append_text(']')
-
-
-def has_entry(key_match, value_match):
- """Matches if dictionary contains key-value entry satisfying a given pair
- of matchers.
-
- :param key_match: The matcher to satisfy for the key, or an expected value
- for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
- :param value_match: The matcher to satisfy for the value, or an expected
- value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- This matcher iterates the evaluated dictionary, searching for any key-value
- entry that satisfies ``key_match`` and ``value_match``. If a matching entry
- is found, ``has_entry`` is satisfied.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- Examples::
-
- has_entry(equal_to('foo'), equal_to(1))
- has_entry('foo', 1)
-
- """
- return IsDictContaining(wrap_matcher(key_match), wrap_matcher(value_match))
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsDictContaining(BaseMatcher):
+
+ def __init__(self, key_matcher, value_matcher):
+ self.key_matcher = key_matcher
+ self.value_matcher = value_matcher
+
+ def _matches(self, dictionary):
+ if hasmethod(dictionary, 'items'):
+ for key, value in dictionary.items():
+ if self.key_matcher.matches(key) and self.value_matcher.matches(value):
+ return True
+ return False
+
+ def describe_to(self, description):
+ description.append_text('a dictionary containing [') \
+ .append_description_of(self.key_matcher) \
+ .append_text(': ') \
+ .append_description_of(self.value_matcher) \
+ .append_text(']')
+
+
+def has_entry(key_match, value_match):
+ """Matches if dictionary contains key-value entry satisfying a given pair
+ of matchers.
+
+ :param key_match: The matcher to satisfy for the key, or an expected value
+ for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+ :param value_match: The matcher to satisfy for the value, or an expected
+ value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ This matcher iterates the evaluated dictionary, searching for any key-value
+ entry that satisfies ``key_match`` and ``value_match``. If a matching entry
+ is found, ``has_entry`` is satisfied.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ Examples::
+
+ has_entry(equal_to('foo'), equal_to(1))
+ has_entry('foo', 1)
+
+ """
+ return IsDictContaining(wrap_matcher(key_match), wrap_matcher(value_match))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingentries.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingentries.py
index eb83ade52de..5e6ec9b9057 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingentries.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingentries.py
@@ -1,133 +1,133 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsDictContainingEntries(BaseMatcher):
-
- def __init__(self, value_matchers):
- self.value_matchers = sorted(value_matchers.items())
-
- def _not_a_dictionary(self, dictionary, mismatch_description):
- if mismatch_description:
- mismatch_description.append_description_of(dictionary) \
- .append_text(' is not a mapping object')
- return False
-
- def matches(self, dictionary, mismatch_description=None):
- for key, value_matcher in self.value_matchers:
-
- try:
- if not key in dictionary:
- if mismatch_description:
- mismatch_description.append_text('no ') \
- .append_description_of(key) \
- .append_text(' key in ') \
- .append_description_of(dictionary)
- return False
- except TypeError:
- return self._not_a_dictionary(dictionary, mismatch_description)
-
- try:
- actual_value = dictionary[key]
- except TypeError:
- return self._not_a_dictionary(dictionary, mismatch_description)
-
- if not value_matcher.matches(actual_value):
- if mismatch_description:
- mismatch_description.append_text('value for ') \
- .append_description_of(key) \
- .append_text(' ')
- value_matcher.describe_mismatch(actual_value, mismatch_description)
- return False
-
- return True
-
- def describe_mismatch(self, item, mismatch_description):
- self.matches(item, mismatch_description)
-
- def describe_keyvalue(self, index, value, description):
- """Describes key-value pair at given index."""
- description.append_description_of(index) \
- .append_text(': ') \
- .append_description_of(value)
-
- def describe_to(self, description):
- description.append_text('a dictionary containing {')
- first = True
- for key, value in self.value_matchers:
- if not first:
- description.append_text(', ')
- self.describe_keyvalue(key, value, description)
- first = False
- description.append_text('}')
-
-
-def has_entries(*keys_valuematchers, **kv_args):
- """Matches if dictionary contains entries satisfying a dictionary of keys
- and corresponding value matchers.
-
- :param matcher_dict: A dictionary mapping keys to associated value matchers,
- or to expected values for
- :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- Note that the keys must be actual keys, not matchers. Any value argument
- that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- Examples::
-
- has_entries({'foo':equal_to(1), 'bar':equal_to(2)})
- has_entries({'foo':1, 'bar':2})
-
- ``has_entries`` also accepts a list of keyword arguments:
-
- .. function:: has_entries(keyword1=value_matcher1[, keyword2=value_matcher2[, ...]])
-
- :param keyword1: A keyword to look up.
- :param valueMatcher1: The matcher to satisfy for the value, or an expected
- value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- Examples::
-
- has_entries(foo=equal_to(1), bar=equal_to(2))
- has_entries(foo=1, bar=2)
-
- Finally, ``has_entries`` also accepts a list of alternating keys and their
- value matchers:
-
- .. function:: has_entries(key1, value_matcher1[, ...])
-
- :param key1: A key (not a matcher) to look up.
- :param valueMatcher1: The matcher to satisfy for the value, or an expected
- value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- Examples::
-
- has_entries('foo', equal_to(1), 'bar', equal_to(2))
- has_entries('foo', 1, 'bar', 2)
-
- """
- if len(keys_valuematchers) == 1:
- try:
- base_dict = keys_valuematchers[0].copy()
- for key in base_dict:
- base_dict[key] = wrap_matcher(base_dict[key])
- except AttributeError:
- raise ValueError('single-argument calls to has_entries must pass a dict as the argument')
- else:
- if len(keys_valuematchers) % 2:
- raise ValueError('has_entries requires key-value pairs')
- base_dict = {}
- for index in range(int(len(keys_valuematchers) / 2)):
- base_dict[keys_valuematchers[2 * index]] = wrap_matcher(keys_valuematchers[2 * index + 1])
-
- for key, value in kv_args.items():
- base_dict[key] = wrap_matcher(value)
-
- return IsDictContainingEntries(base_dict)
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsDictContainingEntries(BaseMatcher):
+
+ def __init__(self, value_matchers):
+ self.value_matchers = sorted(value_matchers.items())
+
+ def _not_a_dictionary(self, dictionary, mismatch_description):
+ if mismatch_description:
+ mismatch_description.append_description_of(dictionary) \
+ .append_text(' is not a mapping object')
+ return False
+
+ def matches(self, dictionary, mismatch_description=None):
+ for key, value_matcher in self.value_matchers:
+
+ try:
+ if not key in dictionary:
+ if mismatch_description:
+ mismatch_description.append_text('no ') \
+ .append_description_of(key) \
+ .append_text(' key in ') \
+ .append_description_of(dictionary)
+ return False
+ except TypeError:
+ return self._not_a_dictionary(dictionary, mismatch_description)
+
+ try:
+ actual_value = dictionary[key]
+ except TypeError:
+ return self._not_a_dictionary(dictionary, mismatch_description)
+
+ if not value_matcher.matches(actual_value):
+ if mismatch_description:
+ mismatch_description.append_text('value for ') \
+ .append_description_of(key) \
+ .append_text(' ')
+ value_matcher.describe_mismatch(actual_value, mismatch_description)
+ return False
+
+ return True
+
+ def describe_mismatch(self, item, mismatch_description):
+ self.matches(item, mismatch_description)
+
+ def describe_keyvalue(self, index, value, description):
+ """Describes key-value pair at given index."""
+ description.append_description_of(index) \
+ .append_text(': ') \
+ .append_description_of(value)
+
+ def describe_to(self, description):
+ description.append_text('a dictionary containing {')
+ first = True
+ for key, value in self.value_matchers:
+ if not first:
+ description.append_text(', ')
+ self.describe_keyvalue(key, value, description)
+ first = False
+ description.append_text('}')
+
+
+def has_entries(*keys_valuematchers, **kv_args):
+ """Matches if dictionary contains entries satisfying a dictionary of keys
+ and corresponding value matchers.
+
+ :param matcher_dict: A dictionary mapping keys to associated value matchers,
+ or to expected values for
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ Note that the keys must be actual keys, not matchers. Any value argument
+ that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ Examples::
+
+ has_entries({'foo':equal_to(1), 'bar':equal_to(2)})
+ has_entries({'foo':1, 'bar':2})
+
+ ``has_entries`` also accepts a list of keyword arguments:
+
+ .. function:: has_entries(keyword1=value_matcher1[, keyword2=value_matcher2[, ...]])
+
+ :param keyword1: A keyword to look up.
+ :param valueMatcher1: The matcher to satisfy for the value, or an expected
+ value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ Examples::
+
+ has_entries(foo=equal_to(1), bar=equal_to(2))
+ has_entries(foo=1, bar=2)
+
+ Finally, ``has_entries`` also accepts a list of alternating keys and their
+ value matchers:
+
+ .. function:: has_entries(key1, value_matcher1[, ...])
+
+ :param key1: A key (not a matcher) to look up.
+ :param valueMatcher1: The matcher to satisfy for the value, or an expected
+ value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ Examples::
+
+ has_entries('foo', equal_to(1), 'bar', equal_to(2))
+ has_entries('foo', 1, 'bar', 2)
+
+ """
+ if len(keys_valuematchers) == 1:
+ try:
+ base_dict = keys_valuematchers[0].copy()
+ for key in base_dict:
+ base_dict[key] = wrap_matcher(base_dict[key])
+ except AttributeError:
+ raise ValueError('single-argument calls to has_entries must pass a dict as the argument')
+ else:
+ if len(keys_valuematchers) % 2:
+ raise ValueError('has_entries requires key-value pairs')
+ base_dict = {}
+ for index in range(int(len(keys_valuematchers) / 2)):
+ base_dict[keys_valuematchers[2 * index]] = wrap_matcher(keys_valuematchers[2 * index + 1])
+
+ for key, value in kv_args.items():
+ base_dict[key] = wrap_matcher(value)
+
+ return IsDictContainingEntries(base_dict)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingkey.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingkey.py
index ccb51e6396d..6d5cca43890 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingkey.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingkey.py
@@ -1,48 +1,48 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsDictContainingKey(BaseMatcher):
-
- def __init__(self, key_matcher):
- self.key_matcher = key_matcher
-
- def _matches(self, dictionary):
- if hasmethod(dictionary, 'keys'):
- for key in dictionary.keys():
- if self.key_matcher.matches(key):
- return True
- return False
-
- def describe_to(self, description):
- description.append_text('a dictionary containing key ') \
- .append_description_of(self.key_matcher)
-
-
-def has_key(key_match):
- """Matches if dictionary contains an entry whose key satisfies a given
- matcher.
-
- :param key_match: The matcher to satisfy for the key, or an expected value
- for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- This matcher iterates the evaluated dictionary, searching for any key-value
- entry whose key satisfies the given matcher. If a matching entry is found,
- ``has_key`` is satisfied.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- Examples::
-
- has_key(equal_to('foo'))
- has_key('foo')
-
- """
- return IsDictContainingKey(wrap_matcher(key_match))
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsDictContainingKey(BaseMatcher):
+
+ def __init__(self, key_matcher):
+ self.key_matcher = key_matcher
+
+ def _matches(self, dictionary):
+ if hasmethod(dictionary, 'keys'):
+ for key in dictionary.keys():
+ if self.key_matcher.matches(key):
+ return True
+ return False
+
+ def describe_to(self, description):
+ description.append_text('a dictionary containing key ') \
+ .append_description_of(self.key_matcher)
+
+
+def has_key(key_match):
+ """Matches if dictionary contains an entry whose key satisfies a given
+ matcher.
+
+ :param key_match: The matcher to satisfy for the key, or an expected value
+ for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ This matcher iterates the evaluated dictionary, searching for any key-value
+ entry whose key satisfies the given matcher. If a matching entry is found,
+ ``has_key`` is satisfied.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ Examples::
+
+ has_key(equal_to('foo'))
+ has_key('foo')
+
+ """
+ return IsDictContainingKey(wrap_matcher(key_match))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingvalue.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingvalue.py
index e5288841b26..cd0441d2ebc 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingvalue.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isdict_containingvalue.py
@@ -1,48 +1,48 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsDictContainingValue(BaseMatcher):
-
- def __init__(self, value_matcher):
- self.value_matcher = value_matcher
-
- def _matches(self, dictionary):
- if hasmethod(dictionary, 'values'):
- for value in dictionary.values():
- if self.value_matcher.matches(value):
- return True
- return False
-
- def describe_to(self, description):
- description.append_text('a dictionary containing value ') \
- .append_description_of(self.value_matcher)
-
-
-def has_value(value):
- """Matches if dictionary contains an entry whose value satisfies a given
- matcher.
-
- :param value_match: The matcher to satisfy for the value, or an expected
- value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- This matcher iterates the evaluated dictionary, searching for any key-value
- entry whose value satisfies the given matcher. If a matching entry is
- found, ``has_value`` is satisfied.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- Examples::
-
- has_value(equal_to('bar'))
- has_value('bar')
-
- """
- return IsDictContainingValue(wrap_matcher(value))
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsDictContainingValue(BaseMatcher):
+
+ def __init__(self, value_matcher):
+ self.value_matcher = value_matcher
+
+ def _matches(self, dictionary):
+ if hasmethod(dictionary, 'values'):
+ for value in dictionary.values():
+ if self.value_matcher.matches(value):
+ return True
+ return False
+
+ def describe_to(self, description):
+ description.append_text('a dictionary containing value ') \
+ .append_description_of(self.value_matcher)
+
+
+def has_value(value):
+ """Matches if dictionary contains an entry whose value satisfies a given
+ matcher.
+
+ :param value_match: The matcher to satisfy for the value, or an expected
+ value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ This matcher iterates the evaluated dictionary, searching for any key-value
+ entry whose value satisfies the given matcher. If a matching entry is
+ found, ``has_value`` is satisfied.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ Examples::
+
+ has_value(equal_to('bar'))
+ has_value('bar')
+
+ """
+ return IsDictContainingValue(wrap_matcher(value))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isin.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isin.py
index 87962a2474b..438ac9b1441 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/isin.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/isin.py
@@ -1,30 +1,30 @@
-from hamcrest.core.base_matcher import BaseMatcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsIn(BaseMatcher):
-
- def __init__(self, sequence):
- self.sequence = sequence
-
- def _matches(self, item):
- return item in self.sequence
-
- def describe_to(self, description):
- description.append_text('one of ') \
- .append_list('(', ', ', ')', self.sequence)
-
-
-def is_in(sequence):
- """Matches if evaluated object is present in a given sequence.
-
- :param sequence: The sequence to search.
-
- This matcher invokes the ``in`` membership operator to determine if the
- evaluated object is a member of the sequence.
-
- """
- return IsIn(sequence)
+from hamcrest.core.base_matcher import BaseMatcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsIn(BaseMatcher):
+
+ def __init__(self, sequence):
+ self.sequence = sequence
+
+ def _matches(self, item):
+ return item in self.sequence
+
+ def describe_to(self, description):
+ description.append_text('one of ') \
+ .append_list('(', ', ', ')', self.sequence)
+
+
+def is_in(sequence):
+ """Matches if evaluated object is present in a given sequence.
+
+ :param sequence: The sequence to search.
+
+ This matcher invokes the ``in`` membership operator to determine if the
+ evaluated object is a member of the sequence.
+
+ """
+ return IsIn(sequence)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containing.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containing.py
index 21939b3f3f3..dfd6d6b1731 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containing.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containing.py
@@ -1,89 +1,89 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.core.allof import all_of
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-
-class IsSequenceContaining(BaseMatcher):
-
- def __init__(self, element_matcher):
- self.element_matcher = element_matcher
-
- def _matches(self, sequence):
- try:
- for item in sequence:
- if self.element_matcher.matches(item):
- return True
- except TypeError: # not a sequence
- return False
-
- def describe_to(self, description):
- description.append_text('a sequence containing ') \
- .append_description_of(self.element_matcher)
-
-
-# It'd be great to make use of all_of, but we can't be sure we won't
-# be seeing a one-time sequence here (like a generator); see issue #20
-# Instead, we wrap it inside a class that will convert the sequence into
-# a concrete list and then hand it off to the all_of matcher.
-class IsSequenceContainingEvery(BaseMatcher):
-
- def __init__(self, *element_matchers):
- delegates = [has_item(e) for e in element_matchers]
- self.matcher = all_of(*delegates)
-
- def _matches(self, sequence):
- try:
- return self.matcher.matches(list(sequence))
- except TypeError:
- return False
-
- def describe_mismatch(self, item, mismatch_description):
- self.matcher.describe_mismatch(item, mismatch_description)
-
- def describe_to(self, description):
- self.matcher.describe_to(description)
-
-
-
-def has_item(match):
- """Matches if any element of sequence satisfies a given matcher.
-
- :param match: The matcher to satisfy, or an expected value for
- :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- This matcher iterates the evaluated sequence, searching for any element
- that satisfies a given matcher. If a matching element is found,
- ``has_item`` is satisfied.
-
- If the ``match`` argument is not a matcher, it is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- """
- return IsSequenceContaining(wrap_matcher(match))
-
-
-def has_items(*items):
- """Matches if all of the given matchers are satisfied by any elements of
- the sequence.
-
- :param match1,...: A comma-separated list of matchers.
-
- This matcher iterates the given matchers, searching for any elements in the
- evaluated sequence that satisfy them. If each matcher is satisfied, then
- ``has_items`` is satisfied.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- """
- matchers = []
- for item in items:
- matchers.append(wrap_matcher(item))
- return IsSequenceContainingEvery(*matchers)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.core.allof import all_of
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+
+class IsSequenceContaining(BaseMatcher):
+
+ def __init__(self, element_matcher):
+ self.element_matcher = element_matcher
+
+ def _matches(self, sequence):
+ try:
+ for item in sequence:
+ if self.element_matcher.matches(item):
+ return True
+ except TypeError: # not a sequence
+ return False
+
+ def describe_to(self, description):
+ description.append_text('a sequence containing ') \
+ .append_description_of(self.element_matcher)
+
+
+# It'd be great to make use of all_of, but we can't be sure we won't
+# be seeing a one-time sequence here (like a generator); see issue #20
+# Instead, we wrap it inside a class that will convert the sequence into
+# a concrete list and then hand it off to the all_of matcher.
+class IsSequenceContainingEvery(BaseMatcher):
+
+ def __init__(self, *element_matchers):
+ delegates = [has_item(e) for e in element_matchers]
+ self.matcher = all_of(*delegates)
+
+ def _matches(self, sequence):
+ try:
+ return self.matcher.matches(list(sequence))
+ except TypeError:
+ return False
+
+ def describe_mismatch(self, item, mismatch_description):
+ self.matcher.describe_mismatch(item, mismatch_description)
+
+ def describe_to(self, description):
+ self.matcher.describe_to(description)
+
+
+
+def has_item(match):
+ """Matches if any element of sequence satisfies a given matcher.
+
+ :param match: The matcher to satisfy, or an expected value for
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ This matcher iterates the evaluated sequence, searching for any element
+ that satisfies a given matcher. If a matching element is found,
+ ``has_item`` is satisfied.
+
+ If the ``match`` argument is not a matcher, it is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ """
+ return IsSequenceContaining(wrap_matcher(match))
+
+
+def has_items(*items):
+ """Matches if all of the given matchers are satisfied by any elements of
+ the sequence.
+
+ :param match1,...: A comma-separated list of matchers.
+
+ This matcher iterates the given matchers, searching for any elements in the
+ evaluated sequence that satisfy them. If each matcher is satisfied, then
+ ``has_items`` is satisfied.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ """
+ matchers = []
+ for item in items:
+ matchers.append(wrap_matcher(item))
+ return IsSequenceContainingEvery(*matchers)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginanyorder.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginanyorder.py
index 78e2b006fcc..48a0fcc607b 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginanyorder.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginanyorder.py
@@ -1,97 +1,97 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class MatchInAnyOrder(object):
- def __init__(self, matchers, mismatch_description):
- self.matchers = matchers[:]
- self.mismatch_description = mismatch_description
-
- def matches(self, item):
- return self.isnotsurplus(item) and self.ismatched(item)
-
- def isfinished(self, sequence):
- if not self.matchers:
- return True
- if self.mismatch_description:
- self.mismatch_description.append_text('no item matches: ') \
- .append_list('', ', ', '', self.matchers) \
- .append_text(' in ') \
- .append_list('[', ', ', ']', sequence)
- return False
-
- def isnotsurplus(self, item):
- if not self.matchers:
- if self.mismatch_description:
- self.mismatch_description.append_text('not matched: ') \
- .append_description_of(item)
- return False
- return True
-
- def ismatched(self, item):
- for index, matcher in enumerate(self.matchers):
- if matcher.matches(item):
- del self.matchers[index]
- return True
-
- if self.mismatch_description:
- self.mismatch_description.append_text('not matched: ') \
- .append_description_of(item)
- return False
-
-
-class IsSequenceContainingInAnyOrder(BaseMatcher):
-
- def __init__(self, matchers):
- self.matchers = matchers
-
- def matches(self, sequence, mismatch_description=None):
- try:
- sequence = list(sequence)
- matchsequence = MatchInAnyOrder(self.matchers, mismatch_description)
- for item in sequence:
- if not matchsequence.matches(item):
- return False
- return matchsequence.isfinished(sequence)
- except TypeError:
- if mismatch_description:
- super(IsSequenceContainingInAnyOrder, self) \
- .describe_mismatch(sequence, mismatch_description)
- return False
-
- def describe_mismatch(self, item, mismatch_description):
- self.matches(item, mismatch_description)
-
- def describe_to(self, description):
- description.append_text('a sequence over ') \
- .append_list('[', ', ', ']', self.matchers) \
- .append_text(' in any order')
-
-
-def contains_inanyorder(*items):
- """Matches if sequences's elements, in any order, satisfy a given list of
- matchers.
-
- :param match1,...: A comma-separated list of matchers.
-
- This matcher iterates the evaluated sequence, seeing if each element
- satisfies any of the given matchers. The matchers are tried from left to
- right, and when a satisfied matcher is found, it is no longer a candidate
- for the remaining elements. If a one-to-one correspondence is established
- between elements and matchers, ``contains_inanyorder`` is satisfied.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- """
-
- matchers = []
- for item in items:
- matchers.append(wrap_matcher(item))
- return IsSequenceContainingInAnyOrder(matchers)
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class MatchInAnyOrder(object):
+ def __init__(self, matchers, mismatch_description):
+ self.matchers = matchers[:]
+ self.mismatch_description = mismatch_description
+
+ def matches(self, item):
+ return self.isnotsurplus(item) and self.ismatched(item)
+
+ def isfinished(self, sequence):
+ if not self.matchers:
+ return True
+ if self.mismatch_description:
+ self.mismatch_description.append_text('no item matches: ') \
+ .append_list('', ', ', '', self.matchers) \
+ .append_text(' in ') \
+ .append_list('[', ', ', ']', sequence)
+ return False
+
+ def isnotsurplus(self, item):
+ if not self.matchers:
+ if self.mismatch_description:
+ self.mismatch_description.append_text('not matched: ') \
+ .append_description_of(item)
+ return False
+ return True
+
+ def ismatched(self, item):
+ for index, matcher in enumerate(self.matchers):
+ if matcher.matches(item):
+ del self.matchers[index]
+ return True
+
+ if self.mismatch_description:
+ self.mismatch_description.append_text('not matched: ') \
+ .append_description_of(item)
+ return False
+
+
+class IsSequenceContainingInAnyOrder(BaseMatcher):
+
+ def __init__(self, matchers):
+ self.matchers = matchers
+
+ def matches(self, sequence, mismatch_description=None):
+ try:
+ sequence = list(sequence)
+ matchsequence = MatchInAnyOrder(self.matchers, mismatch_description)
+ for item in sequence:
+ if not matchsequence.matches(item):
+ return False
+ return matchsequence.isfinished(sequence)
+ except TypeError:
+ if mismatch_description:
+ super(IsSequenceContainingInAnyOrder, self) \
+ .describe_mismatch(sequence, mismatch_description)
+ return False
+
+ def describe_mismatch(self, item, mismatch_description):
+ self.matches(item, mismatch_description)
+
+ def describe_to(self, description):
+ description.append_text('a sequence over ') \
+ .append_list('[', ', ', ']', self.matchers) \
+ .append_text(' in any order')
+
+
+def contains_inanyorder(*items):
+ """Matches if sequences's elements, in any order, satisfy a given list of
+ matchers.
+
+ :param match1,...: A comma-separated list of matchers.
+
+ This matcher iterates the evaluated sequence, seeing if each element
+ satisfies any of the given matchers. The matchers are tried from left to
+ right, and when a satisfied matcher is found, it is no longer a candidate
+ for the remaining elements. If a one-to-one correspondence is established
+ between elements and matchers, ``contains_inanyorder`` is satisfied.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ """
+
+ matchers = []
+ for item in items:
+ matchers.append(wrap_matcher(item))
+ return IsSequenceContainingInAnyOrder(matchers)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginorder.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginorder.py
index 3fd91a6c925..5c860eeb732 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginorder.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_containinginorder.py
@@ -1,88 +1,88 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-
-class MatchingInOrder(object):
- def __init__(self, matchers, mismatch_description):
- self.matchers = matchers
- self.mismatch_description = mismatch_description
- self.next_match_index = 0
-
- def matches(self, item):
- return self.isnotsurplus(item) and self.ismatched(item)
-
- def isfinished(self):
- if self.next_match_index < len(self.matchers):
- if self.mismatch_description:
- self.mismatch_description.append_text('No item matched: ') \
- .append_description_of(self.matchers[self.next_match_index])
- return False
- return True
-
- def ismatched(self, item):
- matcher = self.matchers[self.next_match_index]
- if not matcher.matches(item):
- if self.mismatch_description:
- self.mismatch_description.append_text('item ' + str(self.next_match_index) + ': ')
- matcher.describe_mismatch(item, self.mismatch_description)
- return False
- self.next_match_index += 1
- return True
-
- def isnotsurplus(self, item):
- if len(self.matchers) <= self.next_match_index:
- if self.mismatch_description:
- self.mismatch_description.append_text('Not matched: ') \
- .append_description_of(item)
- return False
- return True
-
-
-class IsSequenceContainingInOrder(BaseMatcher):
-
- def __init__(self, matchers):
- self.matchers = matchers
-
- def matches(self, sequence, mismatch_description=None):
- try:
- matchsequence = MatchingInOrder(self.matchers, mismatch_description)
- for item in sequence:
- if not matchsequence.matches(item):
- return False
- return matchsequence.isfinished()
- except TypeError:
- if mismatch_description:
- super(IsSequenceContainingInOrder, self) \
- .describe_mismatch(sequence, mismatch_description)
- return False
-
- def describe_mismatch(self, item, mismatch_description):
- self.matches(item, mismatch_description)
-
- def describe_to(self, description):
- description.append_text('a sequence containing ') \
- .append_list('[', ', ', ']', self.matchers)
-
-
-def contains(*items):
- """Matches if sequence's elements satisfy a given list of matchers, in order.
-
- :param match1,...: A comma-separated list of matchers.
-
- This matcher iterates the evaluated sequence and a given list of matchers,
- seeing if each element satisfies its corresponding matcher.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- """
- matchers = []
- for item in items:
- matchers.append(wrap_matcher(item))
- return IsSequenceContainingInOrder(matchers)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+
+class MatchingInOrder(object):
+ def __init__(self, matchers, mismatch_description):
+ self.matchers = matchers
+ self.mismatch_description = mismatch_description
+ self.next_match_index = 0
+
+ def matches(self, item):
+ return self.isnotsurplus(item) and self.ismatched(item)
+
+ def isfinished(self):
+ if self.next_match_index < len(self.matchers):
+ if self.mismatch_description:
+ self.mismatch_description.append_text('No item matched: ') \
+ .append_description_of(self.matchers[self.next_match_index])
+ return False
+ return True
+
+ def ismatched(self, item):
+ matcher = self.matchers[self.next_match_index]
+ if not matcher.matches(item):
+ if self.mismatch_description:
+ self.mismatch_description.append_text('item ' + str(self.next_match_index) + ': ')
+ matcher.describe_mismatch(item, self.mismatch_description)
+ return False
+ self.next_match_index += 1
+ return True
+
+ def isnotsurplus(self, item):
+ if len(self.matchers) <= self.next_match_index:
+ if self.mismatch_description:
+ self.mismatch_description.append_text('Not matched: ') \
+ .append_description_of(item)
+ return False
+ return True
+
+
+class IsSequenceContainingInOrder(BaseMatcher):
+
+ def __init__(self, matchers):
+ self.matchers = matchers
+
+ def matches(self, sequence, mismatch_description=None):
+ try:
+ matchsequence = MatchingInOrder(self.matchers, mismatch_description)
+ for item in sequence:
+ if not matchsequence.matches(item):
+ return False
+ return matchsequence.isfinished()
+ except TypeError:
+ if mismatch_description:
+ super(IsSequenceContainingInOrder, self) \
+ .describe_mismatch(sequence, mismatch_description)
+ return False
+
+ def describe_mismatch(self, item, mismatch_description):
+ self.matches(item, mismatch_description)
+
+ def describe_to(self, description):
+ description.append_text('a sequence containing ') \
+ .append_list('[', ', ', ']', self.matchers)
+
+
+def contains(*items):
+ """Matches if sequence's elements satisfy a given list of matchers, in order.
+
+ :param match1,...: A comma-separated list of matchers.
+
+ This matcher iterates the evaluated sequence and a given list of matchers,
+ seeing if each element satisfies its corresponding matcher.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ """
+ matchers = []
+ for item in items:
+ matchers.append(wrap_matcher(item))
+ return IsSequenceContainingInOrder(matchers)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_onlycontaining.py b/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_onlycontaining.py
index bd52c10419e..f1e40fa8c5e 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_onlycontaining.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/collection/issequence_onlycontaining.py
@@ -1,55 +1,55 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.core.anyof import any_of
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsSequenceOnlyContaining(BaseMatcher):
-
- def __init__(self, matcher):
- self.matcher = matcher
-
- def _matches(self, sequence):
- try:
- sequence = list(sequence)
- if len(sequence) == 0:
- return False
- for item in sequence:
- if not self.matcher.matches(item):
- return False
- return True
- except TypeError:
- return False
-
- def describe_to(self, description):
- description.append_text('a sequence containing items matching ') \
- .append_description_of(self.matcher)
-
-
-def only_contains(*items):
- """Matches if each element of sequence satisfies any of the given matchers.
-
- :param match1,...: A comma-separated list of matchers.
-
- This matcher iterates the evaluated sequence, confirming whether each
- element satisfies any of the given matchers.
-
- Example::
-
- only_contains(less_than(4))
-
- will match ``[3,1,2]``.
-
- Any argument that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- """
- matchers = []
- for item in items:
- matchers.append(wrap_matcher(item))
- return IsSequenceOnlyContaining(any_of(*matchers))
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.core.anyof import any_of
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsSequenceOnlyContaining(BaseMatcher):
+
+ def __init__(self, matcher):
+ self.matcher = matcher
+
+ def _matches(self, sequence):
+ try:
+ sequence = list(sequence)
+ if len(sequence) == 0:
+ return False
+ for item in sequence:
+ if not self.matcher.matches(item):
+ return False
+ return True
+ except TypeError:
+ return False
+
+ def describe_to(self, description):
+ description.append_text('a sequence containing items matching ') \
+ .append_description_of(self.matcher)
+
+
+def only_contains(*items):
+ """Matches if each element of sequence satisfies any of the given matchers.
+
+ :param match1,...: A comma-separated list of matchers.
+
+ This matcher iterates the evaluated sequence, confirming whether each
+ element satisfies any of the given matchers.
+
+ Example::
+
+ only_contains(less_than(4))
+
+ will match ``[3,1,2]``.
+
+ Any argument that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ """
+ matchers = []
+ for item in items:
+ matchers.append(wrap_matcher(item))
+ return IsSequenceOnlyContaining(any_of(*matchers))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/integration/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/library/integration/__init__.py
index cc1e1321635..ce39993e01f 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/integration/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/integration/__init__.py
@@ -1,8 +1,8 @@
-from __future__ import absolute_import
-"""Utilities for integrating Hamcrest with other libraries."""
-
-from .match_equality import match_equality
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
+from __future__ import absolute_import
+"""Utilities for integrating Hamcrest with other libraries."""
+
+from .match_equality import match_equality
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/integration/match_equality.py b/contrib/python/PyHamcrest/src/hamcrest/library/integration/match_equality.py
index 52da0547605..e000dee2e2a 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/integration/match_equality.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/integration/match_equality.py
@@ -1,42 +1,42 @@
-from hamcrest.core.string_description import tostring
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Chris Rose"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-__unittest = True
-
-
-class EqualityWrapper(object):
-
- def __init__(self, matcher):
- self.matcher = matcher
-
- def __eq__(self, object):
- return self.matcher.matches(object)
-
- def __str__(self):
- return repr(self)
-
- def __repr__(self):
- return tostring(self.matcher)
-
-
-def match_equality(matcher):
- """Wraps a matcher to define equality in terms of satisfying the matcher.
-
- ``match_equality`` allows Hamcrest matchers to be used in libraries that
- are not Hamcrest-aware. They might use the equality operator::
-
- assert match_equality(matcher) == object
-
- Or they might provide a method that uses equality for its test::
-
- library.method_that_tests_eq(match_equality(matcher))
-
- One concrete example is integrating with the ``assert_called_with`` methods
- in Michael Foord's `mock <http://www.voidspace.org.uk/python/mock/>`_
- library.
-
- """
- return EqualityWrapper(wrap_matcher(matcher))
+from hamcrest.core.string_description import tostring
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Chris Rose"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+__unittest = True
+
+
+class EqualityWrapper(object):
+
+ def __init__(self, matcher):
+ self.matcher = matcher
+
+ def __eq__(self, object):
+ return self.matcher.matches(object)
+
+ def __str__(self):
+ return repr(self)
+
+ def __repr__(self):
+ return tostring(self.matcher)
+
+
+def match_equality(matcher):
+ """Wraps a matcher to define equality in terms of satisfying the matcher.
+
+ ``match_equality`` allows Hamcrest matchers to be used in libraries that
+ are not Hamcrest-aware. They might use the equality operator::
+
+ assert match_equality(matcher) == object
+
+ Or they might provide a method that uses equality for its test::
+
+ library.method_that_tests_eq(match_equality(matcher))
+
+ One concrete example is integrating with the ``assert_called_with`` methods
+ in Michael Foord's `mock <http://www.voidspace.org.uk/python/mock/>`_
+ library.
+
+ """
+ return EqualityWrapper(wrap_matcher(matcher))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/number/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/library/number/__init__.py
index 5087faf8468..9dcac139933 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/number/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/number/__init__.py
@@ -1,9 +1,9 @@
-from __future__ import absolute_import
-"""Matchers that perform numeric comparisons."""
-
-from .iscloseto import close_to
-from .ordering_comparison import greater_than, greater_than_or_equal_to, less_than, less_than_or_equal_to
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
+from __future__ import absolute_import
+"""Matchers that perform numeric comparisons."""
+
+from .iscloseto import close_to
+from .ordering_comparison import greater_than, greater_than_or_equal_to, less_than, less_than_or_equal_to
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/number/iscloseto.py b/contrib/python/PyHamcrest/src/hamcrest/library/number/iscloseto.py
index e401615e356..d1ebbf04207 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/number/iscloseto.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/number/iscloseto.py
@@ -1,74 +1,74 @@
-import six
-from hamcrest.core.base_matcher import BaseMatcher
-from math import fabs
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-def isnumeric(value):
- """Confirm that 'value' can be treated numerically; duck-test accordingly
- """
- if isinstance(value, (float, complex) + six.integer_types):
- return True
-
- try:
- _ = (fabs(value) + 0 - 0) * 1
- return True
- except ArithmeticError:
- return True
- except:
- return False
- return False
-
-
-class IsCloseTo(BaseMatcher):
-
- def __init__(self, value, delta):
- if not isnumeric(value):
- raise TypeError('IsCloseTo value must be numeric')
- if not isnumeric(delta):
- raise TypeError('IsCloseTo delta must be numeric')
-
- self.value = value
- self.delta = delta
-
- def _matches(self, item):
- if not isnumeric(item):
- return False
- return fabs(item - self.value) <= self.delta
-
- def describe_mismatch(self, item, mismatch_description):
- if not isnumeric(item):
- super(IsCloseTo, self).describe_mismatch(item, mismatch_description)
- else:
- actual_delta = fabs(item - self.value)
- mismatch_description.append_description_of(item) \
- .append_text(' differed by ') \
- .append_description_of(actual_delta)
-
- def describe_to(self, description):
- description.append_text('a numeric value within ') \
- .append_description_of(self.delta) \
- .append_text(' of ') \
- .append_description_of(self.value)
-
-
-def close_to(value, delta):
- """Matches if object is a number close to a given value, within a given
- delta.
-
- :param value: The value to compare against as the expected value.
- :param delta: The maximum delta between the values for which the numbers
- are considered close.
-
- This matcher compares the evaluated object against ``value`` to see if the
- difference is within a positive ``delta``.
-
- Example::
-
- close_to(3.0, 0.25)
-
- """
- return IsCloseTo(value, delta)
+import six
+from hamcrest.core.base_matcher import BaseMatcher
+from math import fabs
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+def isnumeric(value):
+ """Confirm that 'value' can be treated numerically; duck-test accordingly
+ """
+ if isinstance(value, (float, complex) + six.integer_types):
+ return True
+
+ try:
+ _ = (fabs(value) + 0 - 0) * 1
+ return True
+ except ArithmeticError:
+ return True
+ except:
+ return False
+ return False
+
+
+class IsCloseTo(BaseMatcher):
+
+ def __init__(self, value, delta):
+ if not isnumeric(value):
+ raise TypeError('IsCloseTo value must be numeric')
+ if not isnumeric(delta):
+ raise TypeError('IsCloseTo delta must be numeric')
+
+ self.value = value
+ self.delta = delta
+
+ def _matches(self, item):
+ if not isnumeric(item):
+ return False
+ return fabs(item - self.value) <= self.delta
+
+ def describe_mismatch(self, item, mismatch_description):
+ if not isnumeric(item):
+ super(IsCloseTo, self).describe_mismatch(item, mismatch_description)
+ else:
+ actual_delta = fabs(item - self.value)
+ mismatch_description.append_description_of(item) \
+ .append_text(' differed by ') \
+ .append_description_of(actual_delta)
+
+ def describe_to(self, description):
+ description.append_text('a numeric value within ') \
+ .append_description_of(self.delta) \
+ .append_text(' of ') \
+ .append_description_of(self.value)
+
+
+def close_to(value, delta):
+ """Matches if object is a number close to a given value, within a given
+ delta.
+
+ :param value: The value to compare against as the expected value.
+ :param delta: The maximum delta between the values for which the numbers
+ are considered close.
+
+ This matcher compares the evaluated object against ``value`` to see if the
+ difference is within a positive ``delta``.
+
+ Example::
+
+ close_to(3.0, 0.25)
+
+ """
+ return IsCloseTo(value, delta)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/number/ordering_comparison.py b/contrib/python/PyHamcrest/src/hamcrest/library/number/ordering_comparison.py
index c3c75f425d6..76a2eaaef77 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/number/ordering_comparison.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/number/ordering_comparison.py
@@ -1,59 +1,59 @@
-from hamcrest.core.base_matcher import BaseMatcher
-import operator
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class OrderingComparison(BaseMatcher):
-
- def __init__(self, value, comparison_function, comparison_description):
- self.value = value
- self.comparison_function = comparison_function
- self.comparison_description = comparison_description
-
- def _matches(self, item):
- return self.comparison_function(item, self.value)
-
- def describe_to(self, description):
- description.append_text('a value ') \
- .append_text(self.comparison_description) \
- .append_text(' ') \
- .append_description_of(self.value)
-
-
-def greater_than(value):
- """Matches if object is greater than a given value.
-
- :param value: The value to compare against.
-
- """
- return OrderingComparison(value, operator.gt, 'greater than')
-
-
-def greater_than_or_equal_to(value):
- """Matches if object is greater than or equal to a given value.
-
- :param value: The value to compare against.
-
- """
- return OrderingComparison(value, operator.ge, 'greater than or equal to')
-
-
-def less_than(value):
- """Matches if object is less than a given value.
-
- :param value: The value to compare against.
-
- """
- return OrderingComparison(value, operator.lt, 'less than')
-
-
-def less_than_or_equal_to(value):
- """Matches if object is less than or equal to a given value.
-
- :param value: The value to compare against.
-
- """
- return OrderingComparison(value, operator.le, 'less than or equal to')
+from hamcrest.core.base_matcher import BaseMatcher
+import operator
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class OrderingComparison(BaseMatcher):
+
+ def __init__(self, value, comparison_function, comparison_description):
+ self.value = value
+ self.comparison_function = comparison_function
+ self.comparison_description = comparison_description
+
+ def _matches(self, item):
+ return self.comparison_function(item, self.value)
+
+ def describe_to(self, description):
+ description.append_text('a value ') \
+ .append_text(self.comparison_description) \
+ .append_text(' ') \
+ .append_description_of(self.value)
+
+
+def greater_than(value):
+ """Matches if object is greater than a given value.
+
+ :param value: The value to compare against.
+
+ """
+ return OrderingComparison(value, operator.gt, 'greater than')
+
+
+def greater_than_or_equal_to(value):
+ """Matches if object is greater than or equal to a given value.
+
+ :param value: The value to compare against.
+
+ """
+ return OrderingComparison(value, operator.ge, 'greater than or equal to')
+
+
+def less_than(value):
+ """Matches if object is less than a given value.
+
+ :param value: The value to compare against.
+
+ """
+ return OrderingComparison(value, operator.lt, 'less than')
+
+
+def less_than_or_equal_to(value):
+ """Matches if object is less than or equal to a given value.
+
+ :param value: The value to compare against.
+
+ """
+ return OrderingComparison(value, operator.le, 'less than or equal to')
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/object/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/library/object/__init__.py
index 5ca45566616..0e58a162bea 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/object/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/object/__init__.py
@@ -1,10 +1,10 @@
-from __future__ import absolute_import
-"""Matchers that inspect objects and classes."""
-
-from .haslength import has_length
-from .hasproperty import has_property, has_properties
-from .hasstring import has_string
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
+from __future__ import absolute_import
+"""Matchers that inspect objects and classes."""
+
+from .haslength import has_length
+from .hasproperty import has_property, has_properties
+from .hasstring import has_string
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/object/haslength.py b/contrib/python/PyHamcrest/src/hamcrest/library/object/haslength.py
index 3ef0ab5b81e..59f14816310 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/object/haslength.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/object/haslength.py
@@ -1,50 +1,50 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class HasLength(BaseMatcher):
-
- def __init__(self, len_matcher):
- self.len_matcher = len_matcher
-
- def _matches(self, item):
- if not hasmethod(item, '__len__'):
- return False
- return self.len_matcher.matches(len(item))
-
- def describe_mismatch(self, item, mismatch_description):
- super(HasLength, self).describe_mismatch(item, mismatch_description)
- if hasmethod(item, '__len__'):
- mismatch_description.append_text(' with length of ') \
- .append_description_of(len(item))
-
- def describe_to(self, description):
- description.append_text('an object with length of ') \
- .append_description_of(self.len_matcher)
-
-
-def has_length(match):
- """Matches if ``len(item)`` satisfies a given matcher.
-
- :param match: The matcher to satisfy, or an expected value for
- :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- This matcher invokes the :py:func:`len` function on the evaluated object to
- get its length, passing the result to a given matcher for evaluation.
-
- If the ``match`` argument is not a matcher, it is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- :equality.
-
- Examples::
-
- has_length(greater_than(6))
- has_length(5)
-
- """
- return HasLength(wrap_matcher(match))
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class HasLength(BaseMatcher):
+
+ def __init__(self, len_matcher):
+ self.len_matcher = len_matcher
+
+ def _matches(self, item):
+ if not hasmethod(item, '__len__'):
+ return False
+ return self.len_matcher.matches(len(item))
+
+ def describe_mismatch(self, item, mismatch_description):
+ super(HasLength, self).describe_mismatch(item, mismatch_description)
+ if hasmethod(item, '__len__'):
+ mismatch_description.append_text(' with length of ') \
+ .append_description_of(len(item))
+
+ def describe_to(self, description):
+ description.append_text('an object with length of ') \
+ .append_description_of(self.len_matcher)
+
+
+def has_length(match):
+ """Matches if ``len(item)`` satisfies a given matcher.
+
+ :param match: The matcher to satisfy, or an expected value for
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ This matcher invokes the :py:func:`len` function on the evaluated object to
+ get its length, passing the result to a given matcher for evaluation.
+
+ If the ``match`` argument is not a matcher, it is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ :equality.
+
+ Examples::
+
+ has_length(greater_than(6))
+ has_length(5)
+
+ """
+ return HasLength(wrap_matcher(match))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/object/hasproperty.py b/contrib/python/PyHamcrest/src/hamcrest/library/object/hasproperty.py
index d2536d69f40..d1cf5c64929 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/object/hasproperty.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/object/hasproperty.py
@@ -1,154 +1,154 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core import anything
-from hamcrest.core.core.allof import all_of
-from hamcrest.core.string_description import StringDescription
-from hamcrest.core.helpers.hasmethod import hasmethod
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher as wrap_shortcut
-
-__author__ = "Chris Rose"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class IsObjectWithProperty(BaseMatcher):
-
- def __init__(self, property_name, value_matcher):
- self.property_name = property_name
- self.value_matcher = value_matcher
-
- def _matches(self, o):
- if o is None:
- return False
-
- if not hasattr(o, self.property_name):
- return False
-
- value = getattr(o, self.property_name)
- return self.value_matcher.matches(value)
-
- def describe_to(self, description):
- description.append_text("an object with a property '") \
- .append_text(self.property_name) \
- .append_text("' matching ") \
- .append_description_of(self.value_matcher)
-
- def describe_mismatch(self, item, mismatch_description):
- if item is None:
- mismatch_description.append_text('was None')
- return
-
- if not hasattr(item, self.property_name):
- mismatch_description.append_value(item) \
- .append_text(' did not have the ') \
- .append_value(self.property_name) \
- .append_text(' property')
- return
-
- mismatch_description.append_text('property ').append_value(self.property_name).append_text(' ')
- value = getattr(item, self.property_name)
- self.value_matcher.describe_mismatch(value, mismatch_description)
-
- def __str__(self):
- d = StringDescription()
- self.describe_to(d)
- return str(d)
-
-
-def has_property(name, match=None):
- """Matches if object has a property with a given name whose value satisfies
- a given matcher.
-
- :param name: The name of the property.
- :param match: Optional matcher to satisfy.
-
- This matcher determines if the evaluated object has a property with a given
- name. If no such property is found, ``has_property`` is not satisfied.
-
- If the property is found, its value is passed to a given matcher for
- evaluation. If the ``match`` argument is not a matcher, it is implicitly
- wrapped in an :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to
- check for equality.
-
- If the ``match`` argument is not provided, the
- :py:func:`~hamcrest.core.core.isanything.anything` matcher is used so that
- ``has_property`` is satisfied if a matching property is found.
-
- Examples::
-
- has_property('name', starts_with('J'))
- has_property('name', 'Jon')
- has_property('name')
-
- """
-
- if match is None:
- match = anything()
-
- return IsObjectWithProperty(name, wrap_shortcut(match))
-
-
-def has_properties(*keys_valuematchers, **kv_args):
- """Matches if an object has properties satisfying all of a dictionary
- of string property names and corresponding value matchers.
-
- :param matcher_dict: A dictionary mapping keys to associated value matchers,
- or to expected values for
- :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- Note that the keys must be actual keys, not matchers. Any value argument
- that is not a matcher is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- Examples::
-
- has_properties({'foo':equal_to(1), 'bar':equal_to(2)})
- has_properties({'foo':1, 'bar':2})
-
- ``has_properties`` also accepts a list of keyword arguments:
-
- .. function:: has_properties(keyword1=value_matcher1[, keyword2=value_matcher2[, ...]])
-
- :param keyword1: A keyword to look up.
- :param valueMatcher1: The matcher to satisfy for the value, or an expected
- value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- Examples::
-
- has_properties(foo=equal_to(1), bar=equal_to(2))
- has_properties(foo=1, bar=2)
-
- Finally, ``has_properties`` also accepts a list of alternating keys and their
- value matchers:
-
- .. function:: has_properties(key1, value_matcher1[, ...])
-
- :param key1: A key (not a matcher) to look up.
- :param valueMatcher1: The matcher to satisfy for the value, or an expected
- value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- Examples::
-
- has_properties('foo', equal_to(1), 'bar', equal_to(2))
- has_properties('foo', 1, 'bar', 2)
-
- """
- if len(keys_valuematchers) == 1:
- try:
- base_dict = keys_valuematchers[0].copy()
- for key in base_dict:
- base_dict[key] = wrap_shortcut(base_dict[key])
- except AttributeError:
- raise ValueError('single-argument calls to has_properties must pass a dict as the argument')
- else:
- if len(keys_valuematchers) % 2:
- raise ValueError('has_properties requires key-value pairs')
- base_dict = {}
- for index in range(int(len(keys_valuematchers) / 2)):
- base_dict[keys_valuematchers[2 * index]] = wrap_shortcut(keys_valuematchers[2 * index + 1])
-
- for key, value in kv_args.items():
- base_dict[key] = wrap_shortcut(value)
-
- return all_of(*[has_property(property_name, property_value_matcher) for \
- property_name, property_value_matcher in base_dict.items()])
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core import anything
+from hamcrest.core.core.allof import all_of
+from hamcrest.core.string_description import StringDescription
+from hamcrest.core.helpers.hasmethod import hasmethod
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher as wrap_shortcut
+
+__author__ = "Chris Rose"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class IsObjectWithProperty(BaseMatcher):
+
+ def __init__(self, property_name, value_matcher):
+ self.property_name = property_name
+ self.value_matcher = value_matcher
+
+ def _matches(self, o):
+ if o is None:
+ return False
+
+ if not hasattr(o, self.property_name):
+ return False
+
+ value = getattr(o, self.property_name)
+ return self.value_matcher.matches(value)
+
+ def describe_to(self, description):
+ description.append_text("an object with a property '") \
+ .append_text(self.property_name) \
+ .append_text("' matching ") \
+ .append_description_of(self.value_matcher)
+
+ def describe_mismatch(self, item, mismatch_description):
+ if item is None:
+ mismatch_description.append_text('was None')
+ return
+
+ if not hasattr(item, self.property_name):
+ mismatch_description.append_value(item) \
+ .append_text(' did not have the ') \
+ .append_value(self.property_name) \
+ .append_text(' property')
+ return
+
+ mismatch_description.append_text('property ').append_value(self.property_name).append_text(' ')
+ value = getattr(item, self.property_name)
+ self.value_matcher.describe_mismatch(value, mismatch_description)
+
+ def __str__(self):
+ d = StringDescription()
+ self.describe_to(d)
+ return str(d)
+
+
+def has_property(name, match=None):
+ """Matches if object has a property with a given name whose value satisfies
+ a given matcher.
+
+ :param name: The name of the property.
+ :param match: Optional matcher to satisfy.
+
+ This matcher determines if the evaluated object has a property with a given
+ name. If no such property is found, ``has_property`` is not satisfied.
+
+ If the property is found, its value is passed to a given matcher for
+ evaluation. If the ``match`` argument is not a matcher, it is implicitly
+ wrapped in an :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to
+ check for equality.
+
+ If the ``match`` argument is not provided, the
+ :py:func:`~hamcrest.core.core.isanything.anything` matcher is used so that
+ ``has_property`` is satisfied if a matching property is found.
+
+ Examples::
+
+ has_property('name', starts_with('J'))
+ has_property('name', 'Jon')
+ has_property('name')
+
+ """
+
+ if match is None:
+ match = anything()
+
+ return IsObjectWithProperty(name, wrap_shortcut(match))
+
+
+def has_properties(*keys_valuematchers, **kv_args):
+ """Matches if an object has properties satisfying all of a dictionary
+ of string property names and corresponding value matchers.
+
+ :param matcher_dict: A dictionary mapping keys to associated value matchers,
+ or to expected values for
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ Note that the keys must be actual keys, not matchers. Any value argument
+ that is not a matcher is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ Examples::
+
+ has_properties({'foo':equal_to(1), 'bar':equal_to(2)})
+ has_properties({'foo':1, 'bar':2})
+
+ ``has_properties`` also accepts a list of keyword arguments:
+
+ .. function:: has_properties(keyword1=value_matcher1[, keyword2=value_matcher2[, ...]])
+
+ :param keyword1: A keyword to look up.
+ :param valueMatcher1: The matcher to satisfy for the value, or an expected
+ value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ Examples::
+
+ has_properties(foo=equal_to(1), bar=equal_to(2))
+ has_properties(foo=1, bar=2)
+
+ Finally, ``has_properties`` also accepts a list of alternating keys and their
+ value matchers:
+
+ .. function:: has_properties(key1, value_matcher1[, ...])
+
+ :param key1: A key (not a matcher) to look up.
+ :param valueMatcher1: The matcher to satisfy for the value, or an expected
+ value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ Examples::
+
+ has_properties('foo', equal_to(1), 'bar', equal_to(2))
+ has_properties('foo', 1, 'bar', 2)
+
+ """
+ if len(keys_valuematchers) == 1:
+ try:
+ base_dict = keys_valuematchers[0].copy()
+ for key in base_dict:
+ base_dict[key] = wrap_shortcut(base_dict[key])
+ except AttributeError:
+ raise ValueError('single-argument calls to has_properties must pass a dict as the argument')
+ else:
+ if len(keys_valuematchers) % 2:
+ raise ValueError('has_properties requires key-value pairs')
+ base_dict = {}
+ for index in range(int(len(keys_valuematchers) / 2)):
+ base_dict[keys_valuematchers[2 * index]] = wrap_shortcut(keys_valuematchers[2 * index + 1])
+
+ for key, value in kv_args.items():
+ base_dict[key] = wrap_shortcut(value)
+
+ return all_of(*[has_property(property_name, property_value_matcher) for \
+ property_name, property_value_matcher in base_dict.items()])
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/object/hasstring.py b/contrib/python/PyHamcrest/src/hamcrest/library/object/hasstring.py
index 8b50547e21c..e48b31f1802 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/object/hasstring.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/object/hasstring.py
@@ -1,40 +1,40 @@
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class HasString(BaseMatcher):
-
- def __init__(self, str_matcher):
- self.str_matcher = str_matcher
-
- def _matches(self, item):
- return self.str_matcher.matches(str(item))
-
- def describe_to(self, description):
- description.append_text('an object with str ') \
- .append_description_of(self.str_matcher)
-
-
-def has_string(match):
- """Matches if ``str(item)`` satisfies a given matcher.
-
- :param match: The matcher to satisfy, or an expected value for
- :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
-
- This matcher invokes the :py:func:`str` function on the evaluated object to
- get its length, passing the result to a given matcher for evaluation. If
- the ``match`` argument is not a matcher, it is implicitly wrapped in an
- :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
- equality.
-
- Examples::
-
- has_string(starts_with('foo'))
- has_string('bar')
-
- """
- return HasString(wrap_matcher(match))
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class HasString(BaseMatcher):
+
+ def __init__(self, str_matcher):
+ self.str_matcher = str_matcher
+
+ def _matches(self, item):
+ return self.str_matcher.matches(str(item))
+
+ def describe_to(self, description):
+ description.append_text('an object with str ') \
+ .append_description_of(self.str_matcher)
+
+
+def has_string(match):
+ """Matches if ``str(item)`` satisfies a given matcher.
+
+ :param match: The matcher to satisfy, or an expected value for
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
+
+ This matcher invokes the :py:func:`str` function on the evaluated object to
+ get its length, passing the result to a given matcher for evaluation. If
+ the ``match`` argument is not a matcher, it is implicitly wrapped in an
+ :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
+ equality.
+
+ Examples::
+
+ has_string(starts_with('foo'))
+ has_string('bar')
+
+ """
+ return HasString(wrap_matcher(match))
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/__init__.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/__init__.py
index 39d0e8b3822..dbdd04f24fe 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/__init__.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/__init__.py
@@ -1,14 +1,14 @@
-from __future__ import absolute_import
-"""Matchers that perform text comparisons."""
-
-from .isequal_ignoring_case import equal_to_ignoring_case
-from .isequal_ignoring_whitespace import equal_to_ignoring_whitespace
-from .stringcontains import contains_string
-from .stringendswith import ends_with
-from .stringstartswith import starts_with
-from .stringmatches import matches_regexp
-from .stringcontainsinorder import string_contains_in_order
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
+from __future__ import absolute_import
+"""Matchers that perform text comparisons."""
+
+from .isequal_ignoring_case import equal_to_ignoring_case
+from .isequal_ignoring_whitespace import equal_to_ignoring_whitespace
+from .stringcontains import contains_string
+from .stringendswith import ends_with
+from .stringstartswith import starts_with
+from .stringmatches import matches_regexp
+from .stringcontainsinorder import string_contains_in_order
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_case.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_case.py
index d1ee2d17fc3..114996092bd 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_case.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_case.py
@@ -1,43 +1,43 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-
-import six
-
-class IsEqualIgnoringCase(BaseMatcher):
-
- def __init__(self, string):
- if not isinstance(string, six.string_types):
- raise TypeError('IsEqualIgnoringCase requires string')
- self.original_string = string
- self.lowered_string = string.lower()
-
- def _matches(self, item):
- if not isinstance(item, six.string_types):
- return False
- return self.lowered_string == item.lower()
-
- def describe_to(self, description):
- description.append_description_of(self.original_string) \
- .append_text(' ignoring case')
-
-
-def equal_to_ignoring_case(string):
- """Matches if object is a string equal to a given string, ignoring case
- differences.
-
- :param string: The string to compare against as the expected value.
-
- This matcher first checks whether the evaluated object is a string. If so,
- it compares it with ``string``, ignoring differences of case.
-
- Example::
-
- equal_to_ignoring_case("hello world")
-
- will match "heLLo WorlD".
-
- """
- return IsEqualIgnoringCase(string)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+
+import six
+
+class IsEqualIgnoringCase(BaseMatcher):
+
+ def __init__(self, string):
+ if not isinstance(string, six.string_types):
+ raise TypeError('IsEqualIgnoringCase requires string')
+ self.original_string = string
+ self.lowered_string = string.lower()
+
+ def _matches(self, item):
+ if not isinstance(item, six.string_types):
+ return False
+ return self.lowered_string == item.lower()
+
+ def describe_to(self, description):
+ description.append_description_of(self.original_string) \
+ .append_text(' ignoring case')
+
+
+def equal_to_ignoring_case(string):
+ """Matches if object is a string equal to a given string, ignoring case
+ differences.
+
+ :param string: The string to compare against as the expected value.
+
+ This matcher first checks whether the evaluated object is a string. If so,
+ it compares it with ``string``, ignoring differences of case.
+
+ Example::
+
+ equal_to_ignoring_case("hello world")
+
+ will match "heLLo WorlD".
+
+ """
+ return IsEqualIgnoringCase(string)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_whitespace.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_whitespace.py
index 86fa997601b..3350803621f 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_whitespace.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/isequal_ignoring_whitespace.py
@@ -1,57 +1,57 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-
-import six
-
-def stripspace(string):
- result = ''
- last_was_space = True
- for character in string:
- if character.isspace():
- if not last_was_space:
- result += ' '
- last_was_space = True
- else:
- result += character
- last_was_space = False
- return result.strip()
-
-
-class IsEqualIgnoringWhiteSpace(BaseMatcher):
-
- def __init__(self, string):
- if not isinstance(string, six.string_types):
- raise TypeError('IsEqualIgnoringWhiteSpace requires string')
- self.original_string = string
- self.stripped_string = stripspace(string)
-
- def _matches(self, item):
- if not isinstance(item, six.string_types):
- return False
- return self.stripped_string == stripspace(item)
-
- def describe_to(self, description):
- description.append_description_of(self.original_string) \
- .append_text(' ignoring whitespace')
-
-
-def equal_to_ignoring_whitespace(string):
- """Matches if object is a string equal to a given string, ignoring
- differences in whitespace.
-
- :param string: The string to compare against as the expected value.
-
- This matcher first checks whether the evaluated object is a string. If so,
- it compares it with ``string``, ignoring differences in runs of whitespace.
-
- Example::
-
- equal_to_ignoring_whitespace("hello world")
-
- will match ``"hello world"``.
-
- """
- return IsEqualIgnoringWhiteSpace(string)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+
+import six
+
+def stripspace(string):
+ result = ''
+ last_was_space = True
+ for character in string:
+ if character.isspace():
+ if not last_was_space:
+ result += ' '
+ last_was_space = True
+ else:
+ result += character
+ last_was_space = False
+ return result.strip()
+
+
+class IsEqualIgnoringWhiteSpace(BaseMatcher):
+
+ def __init__(self, string):
+ if not isinstance(string, six.string_types):
+ raise TypeError('IsEqualIgnoringWhiteSpace requires string')
+ self.original_string = string
+ self.stripped_string = stripspace(string)
+
+ def _matches(self, item):
+ if not isinstance(item, six.string_types):
+ return False
+ return self.stripped_string == stripspace(item)
+
+ def describe_to(self, description):
+ description.append_description_of(self.original_string) \
+ .append_text(' ignoring whitespace')
+
+
+def equal_to_ignoring_whitespace(string):
+ """Matches if object is a string equal to a given string, ignoring
+ differences in whitespace.
+
+ :param string: The string to compare against as the expected value.
+
+ This matcher first checks whether the evaluated object is a string. If so,
+ it compares it with ``string``, ignoring differences in runs of whitespace.
+
+ Example::
+
+ equal_to_ignoring_whitespace("hello world")
+
+ will match ``"hello world"``.
+
+ """
+ return IsEqualIgnoringWhiteSpace(string)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py
index 58ffd283c66..e309b5a1162 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py
@@ -1,38 +1,38 @@
-from hamcrest.library.text.substringmatcher import SubstringMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class StringContains(SubstringMatcher):
-
- def __init__(self, substring):
- super(StringContains, self).__init__(substring)
-
- def _matches(self, item):
- if not hasmethod(item, 'find'):
- return False
- return item.find(self.substring) >= 0
-
- def relationship(self):
- return 'containing'
-
-
-def contains_string(substring):
- """Matches if object is a string containing a given string.
-
- :param string: The string to search for.
-
- This matcher first checks whether the evaluated object is a string. If so,
- it checks whether it contains ``string``.
-
- Example::
-
- contains_string("def")
-
- will match "abcdefg".
-
- """
- return StringContains(substring)
+from hamcrest.library.text.substringmatcher import SubstringMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class StringContains(SubstringMatcher):
+
+ def __init__(self, substring):
+ super(StringContains, self).__init__(substring)
+
+ def _matches(self, item):
+ if not hasmethod(item, 'find'):
+ return False
+ return item.find(self.substring) >= 0
+
+ def relationship(self):
+ return 'containing'
+
+
+def contains_string(substring):
+ """Matches if object is a string containing a given string.
+
+ :param string: The string to search for.
+
+ This matcher first checks whether the evaluated object is a string. If so,
+ it checks whether it contains ``string``.
+
+ Example::
+
+ contains_string("def")
+
+ will match "abcdefg".
+
+ """
+ return StringContains(substring)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontainsinorder.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontainsinorder.py
index 516b1043ab2..9d23193882e 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontainsinorder.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontainsinorder.py
@@ -1,52 +1,52 @@
-__author__ = "Romilly Cocking"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-
-import six
-
-class StringContainsInOrder(BaseMatcher):
-
- def __init__(self, *substrings):
- for substring in substrings:
- if not isinstance(substring, six.string_types):
- raise TypeError(self.__class__.__name__
- + ' requires string arguments')
- self.substrings = substrings
-
- def _matches(self, item):
- if not hasmethod(item, 'find'):
- return False
- from_index = 0
- for substring in self.substrings:
- from_index = item.find(substring, from_index)
- if from_index == -1:
- return False
- return True
-
- def describe_to(self, description):
- description.append_list('a string containing ', ', ', ' in order',
- self.substrings)
-
-
-def string_contains_in_order(*substrings):
- """Matches if object is a string containing a given list of substrings in
- relative order.
-
- :param string1,...: A comma-separated list of strings.
-
- This matcher first checks whether the evaluated object is a string. If so,
- it checks whether it contains a given list of strings, in relative order to
- each other. The searches are performed starting from the beginning of the
- evaluated string.
-
- Example::
-
- string_contains_in_order("bc", "fg", "jkl")
-
- will match "abcdefghijklm".
-
- """
- return StringContainsInOrder(*substrings)
+__author__ = "Romilly Cocking"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+
+import six
+
+class StringContainsInOrder(BaseMatcher):
+
+ def __init__(self, *substrings):
+ for substring in substrings:
+ if not isinstance(substring, six.string_types):
+ raise TypeError(self.__class__.__name__
+ + ' requires string arguments')
+ self.substrings = substrings
+
+ def _matches(self, item):
+ if not hasmethod(item, 'find'):
+ return False
+ from_index = 0
+ for substring in self.substrings:
+ from_index = item.find(substring, from_index)
+ if from_index == -1:
+ return False
+ return True
+
+ def describe_to(self, description):
+ description.append_list('a string containing ', ', ', ' in order',
+ self.substrings)
+
+
+def string_contains_in_order(*substrings):
+ """Matches if object is a string containing a given list of substrings in
+ relative order.
+
+ :param string1,...: A comma-separated list of strings.
+
+ This matcher first checks whether the evaluated object is a string. If so,
+ it checks whether it contains a given list of strings, in relative order to
+ each other. The searches are performed starting from the beginning of the
+ evaluated string.
+
+ Example::
+
+ string_contains_in_order("bc", "fg", "jkl")
+
+ will match "abcdefghijklm".
+
+ """
+ return StringContainsInOrder(*substrings)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py
index 43f9c3d3021..6ccfbb2de0e 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py
@@ -1,39 +1,39 @@
-from hamcrest.library.text.substringmatcher import SubstringMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-
-class StringEndsWith(SubstringMatcher):
-
- def __init__(self, substring):
- super(StringEndsWith, self).__init__(substring)
-
- def _matches(self, item):
- if not hasmethod(item, 'endswith'):
- return False
- return item.endswith(self.substring)
-
- def relationship(self):
- return 'ending with'
-
-
-def ends_with(string):
- """Matches if object is a string ending with a given string.
-
- :param string: The string to search for.
-
- This matcher first checks whether the evaluated object is a string. If so,
- it checks if ``string`` matches the ending characters of the evaluated
- object.
-
- Example::
-
- ends_with("bar")
-
- will match "foobar".
-
- """
- return StringEndsWith(string)
+from hamcrest.library.text.substringmatcher import SubstringMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+
+class StringEndsWith(SubstringMatcher):
+
+ def __init__(self, substring):
+ super(StringEndsWith, self).__init__(substring)
+
+ def _matches(self, item):
+ if not hasmethod(item, 'endswith'):
+ return False
+ return item.endswith(self.substring)
+
+ def relationship(self):
+ return 'ending with'
+
+
+def ends_with(string):
+ """Matches if object is a string ending with a given string.
+
+ :param string: The string to search for.
+
+ This matcher first checks whether the evaluated object is a string. If so,
+ it checks if ``string`` matches the ending characters of the evaluated
+ object.
+
+ Example::
+
+ ends_with("bar")
+
+ will match "foobar".
+
+ """
+ return StringEndsWith(string)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py
index 2a16e29729b..0f66b9dce5a 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py
@@ -1,40 +1,40 @@
-__author__ = "Chris Rose"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-import re
-
-import six
-
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-
-class StringMatchesPattern(BaseMatcher):
-
- def __init__(self, pattern):
- self.pattern = pattern
-
- def describe_to(self, description):
- description.append_text("a string matching '") \
- .append_text(self.pattern.pattern) \
- .append_text("'")
-
- def _matches(self, item):
- return self.pattern.search(item) is not None
-
-
-def matches_regexp(pattern):
- """Matches if object is a string containing a match for a given regular
- expression.
-
- :param pattern: The regular expression to search for.
-
- This matcher first checks whether the evaluated object is a string. If so,
- it checks if the regular expression ``pattern`` matches anywhere within the
- evaluated object.
-
- """
- if isinstance(pattern, six.string_types):
- pattern = re.compile(pattern)
-
- return StringMatchesPattern(pattern)
+__author__ = "Chris Rose"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+import re
+
+import six
+
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+
+class StringMatchesPattern(BaseMatcher):
+
+ def __init__(self, pattern):
+ self.pattern = pattern
+
+ def describe_to(self, description):
+ description.append_text("a string matching '") \
+ .append_text(self.pattern.pattern) \
+ .append_text("'")
+
+ def _matches(self, item):
+ return self.pattern.search(item) is not None
+
+
+def matches_regexp(pattern):
+ """Matches if object is a string containing a match for a given regular
+ expression.
+
+ :param pattern: The regular expression to search for.
+
+ This matcher first checks whether the evaluated object is a string. If so,
+ it checks if the regular expression ``pattern`` matches anywhere within the
+ evaluated object.
+
+ """
+ if isinstance(pattern, six.string_types):
+ pattern = re.compile(pattern)
+
+ return StringMatchesPattern(pattern)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py
index a0af49c9c2a..19a1ec4f060 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py
@@ -1,39 +1,39 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.library.text.substringmatcher import SubstringMatcher
-from hamcrest.core.helpers.hasmethod import hasmethod
-
-
-class StringStartsWith(SubstringMatcher):
-
- def __init__(self, substring):
- super(StringStartsWith, self).__init__(substring)
-
- def _matches(self, item):
- if not hasmethod(item, 'startswith'):
- return False
- return item.startswith(self.substring)
-
- def relationship(self):
- return 'starting with'
-
-
-def starts_with(substring):
- """Matches if object is a string starting with a given string.
-
- :param string: The string to search for.
-
- This matcher first checks whether the evaluated object is a string. If so,
- it checks if ``string`` matches the beginning characters of the evaluated
- object.
-
- Example::
-
- starts_with("foo")
-
- will match "foobar".
-
- """
- return StringStartsWith(substring)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.library.text.substringmatcher import SubstringMatcher
+from hamcrest.core.helpers.hasmethod import hasmethod
+
+
+class StringStartsWith(SubstringMatcher):
+
+ def __init__(self, substring):
+ super(StringStartsWith, self).__init__(substring)
+
+ def _matches(self, item):
+ if not hasmethod(item, 'startswith'):
+ return False
+ return item.startswith(self.substring)
+
+ def relationship(self):
+ return 'starting with'
+
+
+def starts_with(substring):
+ """Matches if object is a string starting with a given string.
+
+ :param string: The string to search for.
+
+ This matcher first checks whether the evaluated object is a string. If so,
+ it checks if ``string`` matches the beginning characters of the evaluated
+ object.
+
+ Example::
+
+ starts_with("foo")
+
+ will match "foobar".
+
+ """
+ return StringStartsWith(substring)
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/substringmatcher.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/substringmatcher.py
index 63ea359a51c..968919aa93a 100644
--- a/contrib/python/PyHamcrest/src/hamcrest/library/text/substringmatcher.py
+++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/substringmatcher.py
@@ -1,20 +1,20 @@
-__author__ = "Jon Reid"
-__copyright__ = "Copyright 2011 hamcrest.org"
-__license__ = "BSD, see License.txt"
-
-from hamcrest.core.base_matcher import BaseMatcher
-
-import six
-
-class SubstringMatcher(BaseMatcher):
-
- def __init__(self, substring):
- if not isinstance(substring, six.string_types):
- raise TypeError(self.__class__.__name__ + ' requires string')
- self.substring = substring
-
- def describe_to(self, description):
- description.append_text('a string ') \
- .append_text(self.relationship()) \
- .append_text(' ') \
- .append_description_of(self.substring)
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.base_matcher import BaseMatcher
+
+import six
+
+class SubstringMatcher(BaseMatcher):
+
+ def __init__(self, substring):
+ if not isinstance(substring, six.string_types):
+ raise TypeError(self.__class__.__name__ + ' requires string')
+ self.substring = substring
+
+ def describe_to(self, description):
+ description.append_text('a string ') \
+ .append_text(self.relationship()) \
+ .append_text(' ') \
+ .append_description_of(self.substring)
diff --git a/contrib/python/PyHamcrest/tests/test_raises.py b/contrib/python/PyHamcrest/tests/test_raises.py
index 4c9ff4e040e..c1a1d4c9070 100644
--- a/contrib/python/PyHamcrest/tests/test_raises.py
+++ b/contrib/python/PyHamcrest/tests/test_raises.py
@@ -1,45 +1,45 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-
-__author__ = '[email protected]'
-
-
-class TestException(RuntimeError):
- def __init__(self, *args, **kwargs):
- super(TestException, self).__init__(*args, **kwargs)
- self.prop = "property"
-
-
-def raises_exception():
- raise TestException()
-
-
-def returns_value():
- return 'my_return_value'
-
-
-def test_raises():
- """
- >>> from hamcrest import assert_that
- >>> from hamcrest import has_property
- >>> from hamcrest import not_, raises
- >>> raises(TestException).matches(raises_exception)
- True
- >>> raises(TestException, matcher=has_property("prop", "property")).matches(raises_exception)
- True
- >>> raises(TestException, matcher=has_property("prop", "fail")).matches(raises_exception)
- False
- >>> raises(TestException, matcher=not_(has_property("prop", "fail"))).matches(raises_exception)
- True
- >>> raises(TestException, matcher=not_(has_property("prop", "property"))).matches(raises_exception)
- False
-
- >>> assert_that(returns_value, raises(TestException), 'message')
- Traceback (most recent call last):
- ...
- AssertionError: message
- Expected: Expected a callable raising <class '__tests__.test_raises.TestException'>
- but: No exception raised and actual return value = 'my_return_value'
- <BLANKLINE>
- """
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+__author__ = '[email protected]'
+
+
+class TestException(RuntimeError):
+ def __init__(self, *args, **kwargs):
+ super(TestException, self).__init__(*args, **kwargs)
+ self.prop = "property"
+
+
+def raises_exception():
+ raise TestException()
+
+
+def returns_value():
+ return 'my_return_value'
+
+
+def test_raises():
+ """
+ >>> from hamcrest import assert_that
+ >>> from hamcrest import has_property
+ >>> from hamcrest import not_, raises
+ >>> raises(TestException).matches(raises_exception)
+ True
+ >>> raises(TestException, matcher=has_property("prop", "property")).matches(raises_exception)
+ True
+ >>> raises(TestException, matcher=has_property("prop", "fail")).matches(raises_exception)
+ False
+ >>> raises(TestException, matcher=not_(has_property("prop", "fail"))).matches(raises_exception)
+ True
+ >>> raises(TestException, matcher=not_(has_property("prop", "property"))).matches(raises_exception)
+ False
+
+ >>> assert_that(returns_value, raises(TestException), 'message')
+ Traceback (most recent call last):
+ ...
+ AssertionError: message
+ Expected: Expected a callable raising <class '__tests__.test_raises.TestException'>
+ but: No exception raised and actual return value = 'my_return_value'
+ <BLANKLINE>
+ """
diff --git a/contrib/python/PyHamcrest/tests/test_string_description.py b/contrib/python/PyHamcrest/tests/test_string_description.py
index 40cbdd226eb..012d2a502ff 100644
--- a/contrib/python/PyHamcrest/tests/test_string_description.py
+++ b/contrib/python/PyHamcrest/tests/test_string_description.py
@@ -1,17 +1,17 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from hamcrest import assert_that, empty, equal_to
-
-__author__ = '[email protected]'
-
-
-def test_string_description_is_fast():
- list_of_very_long_strings = ["aa"*1000 for _ in range(10000)]
- try:
- assert_that(list_of_very_long_strings, empty())
- x = 0
- except AssertionError as e:
- x = len(str(e))
-
- assert_that(x, equal_to(20040048))
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from hamcrest import assert_that, empty, equal_to
+
+__author__ = '[email protected]'
+
+
+def test_string_description_is_fast():
+ list_of_very_long_strings = ["aa"*1000 for _ in range(10000)]
+ try:
+ assert_that(list_of_very_long_strings, empty())
+ x = 0
+ except AssertionError as e:
+ x = len(str(e))
+
+ assert_that(x, equal_to(20040048))
diff --git a/contrib/python/PyHamcrest/tests/ya.make b/contrib/python/PyHamcrest/tests/ya.make
index 65193017939..360348e96a7 100644
--- a/contrib/python/PyHamcrest/tests/ya.make
+++ b/contrib/python/PyHamcrest/tests/ya.make
@@ -1,16 +1,16 @@
OWNER(g:python-contrib)
-
+
PY23_TEST()
-
+
NO_LINT()
-TEST_SRCS(
- test_raises.py
- test_string_description.py
-)
-
-PEERDIR(
- contrib/python/PyHamcrest
-)
-
-END()
+TEST_SRCS(
+ test_raises.py
+ test_string_description.py
+)
+
+PEERDIR(
+ contrib/python/PyHamcrest
+)
+
+END()
diff --git a/contrib/python/PyHamcrest/ya.make b/contrib/python/PyHamcrest/ya.make
index c24f0fbef8b..88b23f7b39b 100644
--- a/contrib/python/PyHamcrest/ya.make
+++ b/contrib/python/PyHamcrest/ya.make
@@ -3,13 +3,13 @@ PY23_LIBRARY()
LICENSE(BSD-3-Clause)
OWNER(g:python-contrib)
-
+
VERSION(1.9.0)
-PEERDIR (
- contrib/python/six
-)
-
+PEERDIR (
+ contrib/python/six
+)
+
SRCDIR(
contrib/python/PyHamcrest/src
)
@@ -77,7 +77,7 @@ PY_SRCS(
NO_LINT()
-END()
+END()
RECURSE_FOR_TESTS(
tests
diff --git a/library/cpp/actors/core/actor_coroutine_ut.cpp b/library/cpp/actors/core/actor_coroutine_ut.cpp
index 951512b8772..3397987bc80 100644
--- a/library/cpp/actors/core/actor_coroutine_ut.cpp
+++ b/library/cpp/actors/core/actor_coroutine_ut.cpp
@@ -7,8 +7,8 @@
#include "hfunc.h"
#include <library/cpp/testing/unittest/registar.h>
-#include <util/system/sanitizers.h>
-
+#include <util/system/sanitizers.h>
+
using namespace NActors;
Y_UNIT_TEST_SUITE(ActorCoro) {
@@ -128,10 +128,10 @@ Y_UNIT_TEST_SUITE(ActorCoro) {
}
Y_UNIT_TEST(Basic) {
- if (NSan::TSanIsOn()) {
- // TODO https://st.yandex-team.ru/DEVTOOLS-3154
- return;
- }
+ if (NSan::TSanIsOn()) {
+ // TODO https://st.yandex-team.ru/DEVTOOLS-3154
+ return;
+ }
Check(MakeHolder<TEvEnough>());
}
diff --git a/library/cpp/actors/core/mailbox.cpp b/library/cpp/actors/core/mailbox.cpp
index d84b4f9e466..f3a0b482877 100644
--- a/library/cpp/actors/core/mailbox.cpp
+++ b/library/cpp/actors/core/mailbox.cpp
@@ -3,8 +3,8 @@
#include <library/cpp/actors/util/datetime.h>
-#include <util/system/sanitizers.h>
-
+#include <util/system/sanitizers.h>
+
namespace NActors {
TMailboxTable::TMailboxTable()
: LastAllocatedLine(0)
@@ -178,7 +178,7 @@ namespace NActors {
switch (x->MailboxType) {
case TMailboxType::Simple: {
TSimpleMailbox* const mailbox = TSimpleMailbox::Get(lineHint, x);
-#if (!defined(_tsan_enabled_))
+#if (!defined(_tsan_enabled_))
Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType);
#endif
mailbox->Queue.Push(ev.Release());
@@ -202,7 +202,7 @@ namespace NActors {
return false;
TRevolvingMailbox* const mailbox = TRevolvingMailbox::Get(lineHint, x);
-#if (!defined(_tsan_enabled_))
+#if (!defined(_tsan_enabled_))
Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType);
#endif
mailbox->QueueWriter.Push(ev.Release());
diff --git a/library/cpp/actors/memory_log/memlog.cpp b/library/cpp/actors/memory_log/memlog.cpp
index 8e6b46727d6..d7aa94d7625 100644
--- a/library/cpp/actors/memory_log/memlog.cpp
+++ b/library/cpp/actors/memory_log/memlog.cpp
@@ -198,32 +198,32 @@ void NoCacheMemcpy(char* dst, const char* src, size_t size) noexcept {
}
memcpy(dst, src, size);
}
-
-NO_SANITIZE_THREAD
-void NoWCacheMemcpy(char* dst, const char* src, size_t size) noexcept {
- constexpr ui16 ITEMS_COUNT = 1024;
- alignas(TMemoryLog::MemcpyAlignment) __m128 buf[ITEMS_COUNT];
- while (size >= sizeof(buf)) {
- memcpy(&buf, src, sizeof(buf));
-
- for (ui16 i = 0; i < ITEMS_COUNT; ++i) {
- _mm_stream_ps((float*)dst, buf[i]);
- dst += sizeof(__m128);
- }
-
- size -= sizeof(buf);
- src += sizeof(buf);
- }
-
- memcpy(&buf, src, size);
- // no problem to copy few bytes more
- size = AlignUp(size, sizeof(__m128));
- for (ui16 i = 0; i < size / sizeof(__m128); ++i) {
- _mm_stream_ps((float*)dst, buf[i]);
- dst += sizeof(__m128);
- }
-}
-
+
+NO_SANITIZE_THREAD
+void NoWCacheMemcpy(char* dst, const char* src, size_t size) noexcept {
+ constexpr ui16 ITEMS_COUNT = 1024;
+ alignas(TMemoryLog::MemcpyAlignment) __m128 buf[ITEMS_COUNT];
+ while (size >= sizeof(buf)) {
+ memcpy(&buf, src, sizeof(buf));
+
+ for (ui16 i = 0; i < ITEMS_COUNT; ++i) {
+ _mm_stream_ps((float*)dst, buf[i]);
+ dst += sizeof(__m128);
+ }
+
+ size -= sizeof(buf);
+ src += sizeof(buf);
+ }
+
+ memcpy(&buf, src, size);
+ // no problem to copy few bytes more
+ size = AlignUp(size, sizeof(__m128));
+ for (ui16 i = 0; i < size / sizeof(__m128); ++i) {
+ _mm_stream_ps((float*)dst, buf[i]);
+ dst += sizeof(__m128);
+ }
+}
+
#endif
NO_SANITIZE_THREAD
@@ -240,12 +240,12 @@ char* BareMemLogWrite(const char* begin, size_t msgSize, bool isLast) noexcept {
#if defined(_x86_64_) || defined(_i386_)
if (AlignDown(begin, TMemoryLog::MemcpyAlignment) == begin) {
NoCacheMemcpy(buffer, begin, msgSize);
- } else {
- NoWCacheMemcpy(buffer, begin, msgSize);
- }
-#else
- memcpy(buffer, begin, msgSize);
-#endif
+ } else {
+ NoWCacheMemcpy(buffer, begin, msgSize);
+ }
+#else
+ memcpy(buffer, begin, msgSize);
+#endif
if (lastMark) {
TMemoryLog::ChangeLastMark(buffer + msgSize);
@@ -267,7 +267,7 @@ bool MemLogWrite(const char* begin, size_t msgSize, bool addLF) noexcept {
// check for format for snprintf
constexpr size_t prologSize = 48;
alignas(TMemoryLog::MemcpyAlignment) char prolog[prologSize + 1];
- Y_VERIFY(AlignDown(&prolog, TMemoryLog::MemcpyAlignment) == &prolog);
+ Y_VERIFY(AlignDown(&prolog, TMemoryLog::MemcpyAlignment) == &prolog);
int snprintfResult = snprintf(prolog, prologSize + 1,
"TS %020" PRIu64 " TI %020" PRIu64 " ", GetCycleCountFast(), threadId);
@@ -288,18 +288,18 @@ bool MemLogWrite(const char* begin, size_t msgSize, bool addLF) noexcept {
}
#if defined(_x86_64_) || defined(_i386_)
- // warning: copy prolog first to avoid corruption of the message
- // by prolog tail
- NoCacheMemcpy(buffer, prolog, prologSize);
+ // warning: copy prolog first to avoid corruption of the message
+ // by prolog tail
+ NoCacheMemcpy(buffer, prolog, prologSize);
if (AlignDown(begin + prologSize, TMemoryLog::MemcpyAlignment) == begin + prologSize) {
- NoCacheMemcpy(buffer + prologSize, begin, msgSize);
+ NoCacheMemcpy(buffer + prologSize, begin, msgSize);
} else {
- NoWCacheMemcpy(buffer + prologSize, begin, msgSize);
- }
-#else
- memcpy(buffer, prolog, prologSize);
- memcpy(buffer + prologSize, begin, msgSize);
-#endif
+ NoWCacheMemcpy(buffer + prologSize, begin, msgSize);
+ }
+#else
+ memcpy(buffer, prolog, prologSize);
+ memcpy(buffer + prologSize, begin, msgSize);
+#endif
if (addLF) {
buffer[prologSize + msgSize] = '\n';
@@ -336,9 +336,9 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept {
// alignment required by NoCacheMemcpy
alignas(TMemoryLog::MemcpyAlignment) char buf[TMemoryLog::MAX_MESSAGE_SIZE];
- Y_VERIFY(AlignDown(&buf, TMemoryLog::MemcpyAlignment) == &buf);
+ Y_VERIFY(AlignDown(&buf, TMemoryLog::MemcpyAlignment) == &buf);
- int prologSize = snprintf(buf,
+ int prologSize = snprintf(buf,
TMemoryLog::MAX_MESSAGE_SIZE - 2,
"TS %020" PRIu64 " TI %020" PRIu64 " ",
GetCycleCountFast(),
@@ -350,7 +350,7 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept {
Y_VERIFY((ui32)prologSize <= TMemoryLog::MAX_MESSAGE_SIZE);
int add = vsnprintf(
- &buf[prologSize],
+ &buf[prologSize],
TMemoryLog::MAX_MESSAGE_SIZE - prologSize - 2,
format, params);
@@ -360,8 +360,8 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept {
Y_VERIFY(add >= 0);
auto totalSize = prologSize + add;
- buf[totalSize++] = '\n';
+ buf[totalSize++] = '\n';
Y_VERIFY((ui32)totalSize <= TMemoryLog::MAX_MESSAGE_SIZE);
- return BareMemLogWrite(buf, totalSize) != nullptr;
+ return BareMemLogWrite(buf, totalSize) != nullptr;
}
diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp
index 6fa25b99656..eea97fb6137 100644
--- a/library/cpp/actors/testlib/test_runtime.cpp
+++ b/library/cpp/actors/testlib/test_runtime.cpp
@@ -12,7 +12,7 @@
#include <library/cpp/actors/interconnect/interconnect.h>
#include <library/cpp/actors/interconnect/interconnect_tcp_proxy.h>
#include <library/cpp/actors/interconnect/interconnect_proxy_wrapper.h>
-
+
#include <util/generic/maybe.h>
#include <util/generic/bt_exception.h>
#include <util/random/mersenne.h>
@@ -23,7 +23,7 @@ bool VERBOSE = false;
const bool PRINT_EVENT_BODY = false;
namespace {
-
+
TString MakeClusterId() {
pid_t pid = getpid();
TStringBuilder uuid;
@@ -457,7 +457,7 @@ namespace NActors {
TTestActorRuntimeBase::TTestActorRuntimeBase(ui32 nodeCount, ui32 dataCenterCount, bool useRealThreads)
: ScheduledCount(0)
- , ScheduledLimit(100000)
+ , ScheduledLimit(100000)
, MainThreadId(TThread::CurrentThreadId())
, ClusterUUID(MakeClusterId())
, FirstNodeId(NextNodeId)
@@ -472,7 +472,7 @@ namespace NActors {
, TimeProvider(new TTimeProvider(*this))
, ShouldContinue()
, CurrentTimestamp(0)
- , DispatchTimeout(DEFAULT_DISPATCH_TIMEOUT)
+ , DispatchTimeout(DEFAULT_DISPATCH_TIMEOUT)
, ReschedulingDelay(TDuration::MicroSeconds(0))
, ObserverFunc(&TTestActorRuntimeBase::DefaultObserverFunc)
, ScheduledEventsSelectorFunc(&CollapsedTimeScheduledEventsSelector)
@@ -1832,12 +1832,12 @@ namespace NActors {
while (Context->Queue->Head()) {
HasReply = false;
ctx.ExecutorThread.Send(GetForwardedEvent().Release());
- int count = 100;
- while (!HasReply && count > 0) {
+ int count = 100;
+ while (!HasReply && count > 0) {
try {
Runtime->DispatchEvents(DelegateeOptions);
} catch (TEmptyEventQueueException&) {
- count--;
+ count--;
Cerr << "No reply" << Endl;
}
}
diff --git a/library/cpp/actors/testlib/test_runtime.h b/library/cpp/actors/testlib/test_runtime.h
index 26e3b45c984..dabca4bac45 100644
--- a/library/cpp/actors/testlib/test_runtime.h
+++ b/library/cpp/actors/testlib/test_runtime.h
@@ -26,18 +26,18 @@
#include <util/system/mutex.h>
#include <util/system/condvar.h>
#include <util/system/thread.h>
-#include <util/system/sanitizers.h>
-#include <util/system/valgrind.h>
+#include <util/system/sanitizers.h>
+#include <util/system/valgrind.h>
#include <utility>
#include <functional>
-const TDuration DEFAULT_DISPATCH_TIMEOUT = NSan::PlainOrUnderSanitizer(
- NValgrind::PlainOrUnderValgrind(TDuration::Seconds(60), TDuration::Seconds(120)),
- TDuration::Seconds(120)
-);
-
-
+const TDuration DEFAULT_DISPATCH_TIMEOUT = NSan::PlainOrUnderSanitizer(
+ NValgrind::PlainOrUnderValgrind(TDuration::Seconds(60), TDuration::Seconds(120)),
+ TDuration::Seconds(120)
+);
+
+
namespace NActors {
struct THeSingleSystemEnv { };
diff --git a/library/cpp/bucket_quoter/bucket_quoter.h b/library/cpp/bucket_quoter/bucket_quoter.h
index 3d92ef8450e..0e0ac59f1bd 100644
--- a/library/cpp/bucket_quoter/bucket_quoter.h
+++ b/library/cpp/bucket_quoter/bucket_quoter.h
@@ -89,7 +89,7 @@ public:
, UsecWaited(usecWaited)
, AggregateInflow(aggregateInflow)
, Bucket(fill ? capacity : 0)
- , LastAdd(Timer::Now())
+ , LastAdd(Timer::Now())
, InflowTokensPerSecond(&FixedInflow)
, BucketTokensCapacity(&FixedCapacity)
, FixedInflow(inflow)
@@ -108,7 +108,7 @@ public:
, UsecWaited(usecWaited)
, AggregateInflow(aggregateInflow)
, Bucket(fill ? AtomicGet(*capacity) : 0)
- , LastAdd(Timer::Now())
+ , LastAdd(Timer::Now())
, InflowTokensPerSecond(inflow)
, BucketTokensCapacity(capacity)
{
diff --git a/library/cpp/messagebus/netaddr_ut.cpp b/library/cpp/messagebus/netaddr_ut.cpp
index e5c68bf402c..dcaeae3e8a1 100644
--- a/library/cpp/messagebus/netaddr_ut.cpp
+++ b/library/cpp/messagebus/netaddr_ut.cpp
@@ -1,13 +1,13 @@
#include <library/cpp/testing/unittest/registar.h>
#include "netaddr.h"
-#include "test_utils.h"
+#include "test_utils.h"
using namespace NBus;
Y_UNIT_TEST_SUITE(TNetAddr) {
Y_UNIT_TEST(ResolveIpv4) {
- ASSUME_IP_V4_ENABLED;
+ ASSUME_IP_V4_ENABLED;
UNIT_ASSERT(TNetAddr("ns1.yandex.ru", 80, EIP_VERSION_4).IsIpv4());
}
diff --git a/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp b/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp
index 3fdd175d736..afc99b05e48 100644
--- a/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp
+++ b/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp
@@ -15,8 +15,8 @@ protected:
UNIT_TEST_SUITE_REGISTRATION(TLocatorRegisterUniqTest);
void TLocatorRegisterUniqTest::TestRegister() {
- ASSUME_IP_V4_ENABLED;
-
+ ASSUME_IP_V4_ENABLED;
+
NBus::TBusLocator locator;
const char* serviceName = "TestService";
const char* hostName = "192.168.0.42";
diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp
index 9c21227e2bd..56f76977623 100644
--- a/library/cpp/messagebus/test/ut/one_way_ut.cpp
+++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp
@@ -65,9 +65,9 @@ struct NullClient : TBusClientHandlerError {
}
~NullClient() override {
- Session->Shutdown();
- }
-
+ Session->Shutdown();
+ }
+
/// dispatch of requests is done here
void Work() {
int batch = 10;
@@ -107,9 +107,9 @@ public:
}
~NullServer() override {
- Session->Shutdown();
- }
-
+ Session->Shutdown();
+ }
+
/// when message comes do not send reply, just acknowledge
void OnMessage(TOnMessageContext& mess) override {
TExampleRequest* fmess = static_cast<TExampleRequest*>(mess.GetMessage());
diff --git a/library/cpp/messagebus/test/ut/ya.make b/library/cpp/messagebus/test/ut/ya.make
index fe1b4961d69..672f3febbe7 100644
--- a/library/cpp/messagebus/test/ut/ya.make
+++ b/library/cpp/messagebus/test/ut/ya.make
@@ -11,46 +11,46 @@ TAG(
ya:fat
)
-FORK_SUBTESTS()
-
-PEERDIR(
+FORK_SUBTESTS()
+
+PEERDIR(
library/cpp/testing/unittest_main
library/cpp/messagebus
library/cpp/messagebus/test/helper
library/cpp/messagebus/www
-)
-
-SRCS(
- messagebus_ut.cpp
- module_client_ut.cpp
- module_client_one_way_ut.cpp
- module_server_ut.cpp
- one_way_ut.cpp
- starter_ut.cpp
- sync_client_ut.cpp
- locator_uniq_ut.cpp
- ../../actor/actor_ut.cpp
- ../../actor/ring_buffer_ut.cpp
- ../../actor/tasks_ut.cpp
- ../../actor/what_thread_does_guard_ut.cpp
- ../../async_result_ut.cpp
- ../../cc_semaphore_ut.cpp
- ../../coreconn_ut.cpp
- ../../duration_histogram_ut.cpp
- ../../message_status_counter_ut.cpp
- ../../misc/weak_ptr_ut.cpp
- ../../latch_ut.cpp
- ../../lfqueue_batch_ut.cpp
- ../../local_flags_ut.cpp
- ../../memory_ut.cpp
- ../../moved_ut.cpp
- ../../netaddr_ut.cpp
- ../../network_ut.cpp
- ../../nondestroying_holder_ut.cpp
- ../../scheduler_actor_ut.cpp
- ../../scheduler/scheduler_ut.cpp
- ../../socket_addr_ut.cpp
- ../../vector_swaps_ut.cpp
-)
-
-END()
+)
+
+SRCS(
+ messagebus_ut.cpp
+ module_client_ut.cpp
+ module_client_one_way_ut.cpp
+ module_server_ut.cpp
+ one_way_ut.cpp
+ starter_ut.cpp
+ sync_client_ut.cpp
+ locator_uniq_ut.cpp
+ ../../actor/actor_ut.cpp
+ ../../actor/ring_buffer_ut.cpp
+ ../../actor/tasks_ut.cpp
+ ../../actor/what_thread_does_guard_ut.cpp
+ ../../async_result_ut.cpp
+ ../../cc_semaphore_ut.cpp
+ ../../coreconn_ut.cpp
+ ../../duration_histogram_ut.cpp
+ ../../message_status_counter_ut.cpp
+ ../../misc/weak_ptr_ut.cpp
+ ../../latch_ut.cpp
+ ../../lfqueue_batch_ut.cpp
+ ../../local_flags_ut.cpp
+ ../../memory_ut.cpp
+ ../../moved_ut.cpp
+ ../../netaddr_ut.cpp
+ ../../network_ut.cpp
+ ../../nondestroying_holder_ut.cpp
+ ../../scheduler_actor_ut.cpp
+ ../../scheduler/scheduler_ut.cpp
+ ../../socket_addr_ut.cpp
+ ../../vector_swaps_ut.cpp
+)
+
+END()
diff --git a/library/cpp/messagebus/test_utils.h b/library/cpp/messagebus/test_utils.h
index 2abdf504b16..42725c0b9bd 100644
--- a/library/cpp/messagebus/test_utils.h
+++ b/library/cpp/messagebus/test_utils.h
@@ -1,6 +1,6 @@
-#pragma once
-
-// Do nothing if there is no support for IPv4
+#pragma once
+
+// Do nothing if there is no support for IPv4
#define ASSUME_IP_V4_ENABLED \
do { \
try { \
@@ -9,4 +9,4 @@
Y_UNUSED(ex); \
return; \
} \
- } while (0)
+ } while (0)
diff --git a/library/cpp/messagebus/ya.make b/library/cpp/messagebus/ya.make
index e13cf06deaf..f022234eb39 100644
--- a/library/cpp/messagebus/ya.make
+++ b/library/cpp/messagebus/ya.make
@@ -3,9 +3,9 @@ LIBRARY()
OWNER(g:messagebus)
IF (SANITIZER_TYPE == "undefined")
- NO_SANITIZE()
-ENDIF()
-
+ NO_SANITIZE()
+ENDIF()
+
SRCS(
acceptor.cpp
acceptor_status.cpp
diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp
index 3679b768ed4..614217c1a5c 100644
--- a/library/cpp/testing/unittest/registar.cpp
+++ b/library/cpp/testing/unittest/registar.cpp
@@ -50,7 +50,7 @@ void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, boo
if (::NUnitTest::ContinueOnFail || !fatalFailure) {
return;
}
- throw TAssertException();
+ throw TAssertException();
}
void ::NUnitTest::SetRaiseErrorHandler(::NUnitTest::TRaiseErrorHandler handler) {
diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h
index 44517a00924..00466a8cc7d 100644
--- a/library/cpp/testing/unittest/registar.h
+++ b/library/cpp/testing/unittest/registar.h
@@ -437,18 +437,18 @@ public: \
#define UNIT_ASSERT_STRINGS_EQUAL(A, B) UNIT_ASSERT_STRINGS_EQUAL_C(A, B, "")
-#define UNIT_ASSERT_STRING_CONTAINS_C(A, B, C) \
- do { \
+#define UNIT_ASSERT_STRING_CONTAINS_C(A, B, C) \
+ do { \
const TString _a(A); \
const TString _b(B); \
- if (!_a.Contains(_b)) { \
+ if (!_a.Contains(_b)) { \
auto&& msg = Sprintf("\"%s\" does not contain \"%s\", %s", ToString(_a).data(), ToString(_b).data(), (::TStringBuilder() << C).data()); \
- UNIT_FAIL_IMPL("strings contains assertion failed", msg); \
- } \
- } while (false)
-
-#define UNIT_ASSERT_STRING_CONTAINS(A, B) UNIT_ASSERT_STRING_CONTAINS_C(A, B, "")
-
+ UNIT_FAIL_IMPL("strings contains assertion failed", msg); \
+ } \
+ } while (false)
+
+#define UNIT_ASSERT_STRING_CONTAINS(A, B) UNIT_ASSERT_STRING_CONTAINS_C(A, B, "")
+
#define UNIT_ASSERT_NO_DIFF(A, B) \
do { \
const TString _a(A); \
diff --git a/library/cpp/threading/skip_list/perf/main.cpp b/library/cpp/threading/skip_list/perf/main.cpp
index 4ad52049e73..c3eb6a6917a 100644
--- a/library/cpp/threading/skip_list/perf/main.cpp
+++ b/library/cpp/threading/skip_list/perf/main.cpp
@@ -215,7 +215,7 @@ namespace {
for (const TTest& test : Tests) {
LogInfo() << "Starting test " << test.Name << Endl;
-
+
TInstant started = TInstant::Now();
try {
test.Func();
@@ -226,7 +226,7 @@ namespace {
}
LogInfo() << "List size = " << List.GetSize() << Endl;
-
+
TDuration duration = TInstant::Now() - started;
LogInfo() << "test " << test.Name
<< " duration: " << duration
@@ -276,8 +276,8 @@ namespace {
for (size_t i = 0; i < Iterations; ++i) {
List.Insert(TListItem(Random.GetString(KeyLen), Random.GetString(ValueLen)));
}
- }
-
+ }
+
void TEST_LookupRandom() {
for (size_t i = 0; i < Iterations; ++i) {
List.SeekTo(TListItem(Random.GetString(KeyLen), TStringBuf()));
@@ -296,7 +296,7 @@ namespace {
TGuard<TMutex> guard(Mutex);
List.Insert(TListItem(Random.GetString(KeyLen), Random.GetString(ValueLen)));
}
- }
+ }
TDuration duration = TInstant::Now() - started;
LogInfo()
<< "Average time for producer = "
diff --git a/library/python/testing/yatest_common/yatest/common/network.py b/library/python/testing/yatest_common/yatest/common/network.py
index 37bcb1b8e08..ef33444dad4 100644
--- a/library/python/testing/yatest_common/yatest/common/network.py
+++ b/library/python/testing/yatest_common/yatest/common/network.py
@@ -19,12 +19,12 @@ class PortManagerException(Exception):
class PortManager(object):
- """
- See documentation here
+ """
+ See documentation here
https://wiki.yandex-team.ru/yatool/test/#python-acquire-ports
- """
-
+ """
+
def __init__(self, sync_dir=None):
self._sync_dir = sync_dir or os.environ.get('PORT_SYNC_PATH')
if self._sync_dir:
diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py
index a8bcc21f518..d56eeb3f75f 100644
--- a/library/python/testing/yatest_common/yatest/common/process.py
+++ b/library/python/testing/yatest_common/yatest/common/process.py
@@ -356,7 +356,7 @@ class _Execution(object):
finally:
self._elapsed = time.time() - self._start
self._save_outputs()
- self.verify_no_coredumps()
+ self.verify_no_coredumps()
self._finalise(check_exit_code)
@@ -370,11 +370,11 @@ class _Execution(object):
# Don't search for sanitize errors if stderr was redirected
self.verify_sanitize_errors()
- def verify_no_coredumps(self):
- """
- Verify there is no coredump from this binary. If there is then report backtrace.
- """
- if self.exit_code < 0 and self._collect_cores:
+ def verify_no_coredumps(self):
+ """
+ Verify there is no coredump from this binary. If there is then report backtrace.
+ """
+ if self.exit_code < 0 and self._collect_cores:
if cores:
try:
self._recover_core()
@@ -382,11 +382,11 @@ class _Execution(object):
yatest_logger.exception("Exception while recovering core")
else:
yatest_logger.warning("Core dump file recovering is skipped: module cores isn't available")
-
+
def verify_sanitize_errors(self):
- """
- Verify there are no sanitizer (ASAN, MSAN, TSAN, etc) errors for this binary. If there are any report them.
- """
+ """
+ Verify there are no sanitizer (ASAN, MSAN, TSAN, etc) errors for this binary. If there are any report them.
+ """
if self._std_err and self._check_sanitizer and runtime._get_ya_config().sanitizer_extra_checks:
build_path = runtime.build_path()
if self.command[0].startswith(build_path):
diff --git a/library/python/testing/yatest_common/yatest/common/runtime.py b/library/python/testing/yatest_common/yatest/common/runtime.py
index e55e1934463..c827169f434 100644
--- a/library/python/testing/yatest_common/yatest/common/runtime.py
+++ b/library/python/testing/yatest_common/yatest/common/runtime.py
@@ -198,15 +198,15 @@ def get_param(key, default=None):
return _get_ya_plugin_instance().get_param(key, default)
-def get_param_dict_copy():
- """
- Return copy of dictionary with all parameters. Changes to this dictionary do *not* change parameters.
-
- :return: copy of dictionary with all parameters
- """
- return _get_ya_plugin_instance().get_param_dict_copy()
-
-
+def get_param_dict_copy():
+ """
+ Return copy of dictionary with all parameters. Changes to this dictionary do *not* change parameters.
+
+ :return: copy of dictionary with all parameters
+ """
+ return _get_ya_plugin_instance().get_param_dict_copy()
+
+
@not_test
def test_output_path(path=None):
"""
@@ -317,11 +317,11 @@ class Context(object):
@property
def sanitize(self):
- """
- Detect if current test run is under sanitizer
-
- :return: one of `None`, 'address', 'memory', 'thread', 'undefined'
- """
+ """
+ Detect if current test run is under sanitizer
+
+ :return: one of `None`, 'address', 'memory', 'thread', 'undefined'
+ """
return _get_ya_plugin_instance().get_context("sanitize")
@property
diff --git a/library/python/testing/yatest_lib/test_splitter.py b/library/python/testing/yatest_lib/test_splitter.py
index acbcd4300e0..ba90a47291c 100644
--- a/library/python/testing/yatest_lib/test_splitter.py
+++ b/library/python/testing/yatest_lib/test_splitter.py
@@ -1,50 +1,50 @@
# coding: utf-8
-
-import collections
-
-
+
+import collections
+
+
def flatten_tests(test_classes):
- """
- >>> test_classes = {x: [x] for x in range(5)}
+ """
+ >>> test_classes = {x: [x] for x in range(5)}
>>> flatten_tests(test_classes)
- [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
- >>> test_classes = {x: [x + 1, x + 2] for x in range(2)}
+ [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
+ >>> test_classes = {x: [x + 1, x + 2] for x in range(2)}
>>> flatten_tests(test_classes)
- [(0, 1), (0, 2), (1, 2), (1, 3)]
- """
- tests = []
- for class_name, test_names in test_classes.items():
- tests += [(class_name, test_name) for test_name in test_names]
- return tests
-
-
+ [(0, 1), (0, 2), (1, 2), (1, 3)]
+ """
+ tests = []
+ for class_name, test_names in test_classes.items():
+ tests += [(class_name, test_name) for test_name in test_names]
+ return tests
+
+
def get_sequential_chunk(tests, modulo, modulo_index, is_sorted=False):
- """
+ """
>>> get_sequential_chunk(range(10), 4, 0)
- [0, 1, 2]
+ [0, 1, 2]
>>> get_sequential_chunk(range(10), 4, 1)
- [3, 4, 5]
+ [3, 4, 5]
>>> get_sequential_chunk(range(10), 4, 2)
[6, 7]
>>> get_sequential_chunk(range(10), 4, 3)
[8, 9]
>>> get_sequential_chunk(range(10), 4, 4)
- []
+ []
>>> get_sequential_chunk(range(10), 4, 5)
- []
- """
+ []
+ """
if not is_sorted:
tests = sorted(tests)
chunk_size = len(tests) // modulo
not_used = len(tests) % modulo
shift = chunk_size + (modulo_index < not_used)
start = chunk_size * modulo_index + min(modulo_index, not_used)
- end = start + shift
+ end = start + shift
return [] if end > len(tests) else tests[start:end]
-
-
+
+
def get_shuffled_chunk(tests, modulo, modulo_index, is_sorted=False):
- """
+ """
>>> get_shuffled_chunk(range(10), 4, 0)
[0, 4, 8]
>>> get_shuffled_chunk(range(10), 4, 1)
@@ -78,25 +78,25 @@ def get_splitted_tests(test_entities, modulo, modulo_index, partition_mode, is_s
def filter_tests_by_modulo(test_classes, modulo, modulo_index, split_by_tests, partition_mode="SEQUENTIAL"):
"""
- >>> test_classes = {x: [x] for x in range(20)}
- >>> filter_tests_by_modulo(test_classes, 4, 0, False)
- {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]}
- >>> filter_tests_by_modulo(test_classes, 4, 1, False)
- {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]}
- >>> filter_tests_by_modulo(test_classes, 4, 2, False)
- {10: [10], 11: [11], 12: [12], 13: [13], 14: [14]}
-
- >>> dict(filter_tests_by_modulo(test_classes, 4, 0, True))
- {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]}
- >>> dict(filter_tests_by_modulo(test_classes, 4, 1, True))
- {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]}
- """
- if split_by_tests:
+ >>> test_classes = {x: [x] for x in range(20)}
+ >>> filter_tests_by_modulo(test_classes, 4, 0, False)
+ {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]}
+ >>> filter_tests_by_modulo(test_classes, 4, 1, False)
+ {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]}
+ >>> filter_tests_by_modulo(test_classes, 4, 2, False)
+ {10: [10], 11: [11], 12: [12], 13: [13], 14: [14]}
+
+ >>> dict(filter_tests_by_modulo(test_classes, 4, 0, True))
+ {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]}
+ >>> dict(filter_tests_by_modulo(test_classes, 4, 1, True))
+ {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]}
+ """
+ if split_by_tests:
tests = get_splitted_tests(flatten_tests(test_classes), modulo, modulo_index, partition_mode)
- test_classes = collections.defaultdict(list)
- for class_name, test_name in tests:
- test_classes[class_name].append(test_name)
- return test_classes
- else:
+ test_classes = collections.defaultdict(list)
+ for class_name, test_name in tests:
+ test_classes[class_name].append(test_name)
+ return test_classes
+ else:
target_classes = get_splitted_tests(test_classes, modulo, modulo_index, partition_mode)
- return {class_name: test_classes[class_name] for class_name in target_classes}
+ return {class_name: test_classes[class_name] for class_name in target_classes}
diff --git a/util/system/sanitizers.h b/util/system/sanitizers.h
index 965e5c751e4..1946148d2cd 100644
--- a/util/system/sanitizers.h
+++ b/util/system/sanitizers.h
@@ -1,7 +1,7 @@
#pragma once
#include "defaults.h"
-
+
extern "C" { // sanitizers API
#if defined(_asan_enabled_)
@@ -12,8 +12,8 @@ extern "C" { // sanitizers API
void __msan_unpoison(const volatile void* a, size_t size);
void __msan_poison(const volatile void* a, size_t size);
void __msan_check_mem_is_initialized(const volatile void* x, size_t size);
-#endif
-
+#endif
+
}; // sanitizers API
namespace NSan {
@@ -21,7 +21,7 @@ namespace NSan {
public:
TFiberContext() noexcept;
TFiberContext(const void* stack, size_t len, const char* contName) noexcept;
-
+
~TFiberContext() noexcept;
void BeforeFinish() noexcept;
@@ -41,19 +41,19 @@ namespace NSan {
#endif
};
- // Returns plain if no sanitizer enabled or sanitized otherwise
- // Ment to be used in test code for constants (timeouts, etc)
- template <typename T>
- inline constexpr static T PlainOrUnderSanitizer(T plain, T sanitized) noexcept {
-#if defined(_tsan_enabled_) || defined(_msan_enabled_) || defined(_asan_enabled_)
- Y_UNUSED(plain);
- return sanitized;
-#else
- Y_UNUSED(sanitized);
- return plain;
-#endif
- }
-
+ // Returns plain if no sanitizer enabled or sanitized otherwise
+ // Ment to be used in test code for constants (timeouts, etc)
+ template <typename T>
+ inline constexpr static T PlainOrUnderSanitizer(T plain, T sanitized) noexcept {
+#if defined(_tsan_enabled_) || defined(_msan_enabled_) || defined(_asan_enabled_)
+ Y_UNUSED(plain);
+ return sanitized;
+#else
+ Y_UNUSED(sanitized);
+ return plain;
+#endif
+ }
+
// Determines if asan present
inline constexpr static bool ASanIsOn() noexcept {
#if defined(_asan_enabled_)
@@ -106,10 +106,10 @@ namespace NSan {
inline static void CheckMemIsInitialized(const volatile void* a, size_t size) noexcept {
#if defined(_msan_enabled_)
__msan_check_mem_is_initialized(a, size);
-#else
+#else
Y_UNUSED(a);
Y_UNUSED(size);
-#endif
+#endif
}
inline static void MarkAsIntentionallyLeaked(const void* ptr) noexcept {
diff --git a/util/system/valgrind.h b/util/system/valgrind.h
index 2ec4ed927ca..317350d3442 100644
--- a/util/system/valgrind.h
+++ b/util/system/valgrind.h
@@ -23,26 +23,26 @@ static inline int VALGRIND_PRINTF(...) {
}
#define VALGRIND_DO_LEAK_CHECK
#endif
-
-namespace NValgrind {
- inline constexpr static bool ValgrindIsOn() noexcept {
+
+namespace NValgrind {
+ inline constexpr static bool ValgrindIsOn() noexcept {
#if defined(WITH_VALGRIND)
return true;
#else
return false;
#endif
- }
-
- // Returns valgrinded if running under Valgrind and plain otherwise
- // Ment to be used in test code for constants (timeouts, etc)
- template <typename T>
- inline constexpr static T PlainOrUnderValgrind(T plain, T valgrinded) noexcept {
-#if defined(WITH_VALGRIND)
- Y_UNUSED(plain);
- return valgrinded;
-#else
- Y_UNUSED(valgrinded);
- return plain;
-#endif
- }
-}
+ }
+
+ // Returns valgrinded if running under Valgrind and plain otherwise
+ // Ment to be used in test code for constants (timeouts, etc)
+ template <typename T>
+ inline constexpr static T PlainOrUnderValgrind(T plain, T valgrinded) noexcept {
+#if defined(WITH_VALGRIND)
+ Y_UNUSED(plain);
+ return valgrinded;
+#else
+ Y_UNUSED(valgrinded);
+ return plain;
+#endif
+ }
+}
diff --git a/ydb/core/actorlib_impl/test_interconnect_ut.cpp b/ydb/core/actorlib_impl/test_interconnect_ut.cpp
index 0d9d3535ef6..4155d92b5a4 100644
--- a/ydb/core/actorlib_impl/test_interconnect_ut.cpp
+++ b/ydb/core/actorlib_impl/test_interconnect_ut.cpp
@@ -638,13 +638,13 @@ Y_UNIT_TEST_SUITE(TInterconnectTest) {
runtime.Initialize(TAppPrepare().Unwrap());
const auto edge = runtime.AllocateEdgeActor(0);
auto event = new TEvResolveAddress;
- event->Address = "localhost";
+ event->Address = "localhost";
event->Port = 80;
runtime.Send(new IEventHandle(GetNameserviceActorId(), edge, event), 0);
TAutoPtr<IEventHandle> handle;
const auto reply = runtime.GrabEdgeEvent<TEvAddressInfo>(handle);
UNIT_ASSERT_VALUES_EQUAL(NAddr::PrintHostAndPort(*reply->Address),
- "[::1]:80");
+ "[::1]:80");
}
Y_UNIT_TEST(TestEventWithPayloadSerialization) {
diff --git a/ydb/core/actorlib_impl/ut/ya.make b/ydb/core/actorlib_impl/ut/ya.make
index f76d57807a3..3bdc54b9287 100644
--- a/ydb/core/actorlib_impl/ut/ya.make
+++ b/ydb/core/actorlib_impl/ut/ya.make
@@ -17,7 +17,7 @@ ELSE()
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
+
PEERDIR(
library/cpp/actors/core
library/cpp/actors/interconnect
diff --git a/ydb/core/base/localdb.cpp b/ydb/core/base/localdb.cpp
index d07ee26fc1f..072fb1748c3 100644
--- a/ydb/core/base/localdb.cpp
+++ b/ydb/core/base/localdb.cpp
@@ -97,7 +97,7 @@ void TCompactionPolicy::TGenerationPolicy::Serialize(NKikimrSchemeOp::TCompactio
}
TCompactionPolicy::TCompactionPolicy()
- : InMemSizeToSnapshot(4 * 1024 * 1024)
+ : InMemSizeToSnapshot(4 * 1024 * 1024)
, InMemStepsToSnapshot(300)
, InMemForceStepsToSnapshot(500)
, InMemForceSizeToSnapshot(16 * 1024 * 1024)
diff --git a/ydb/core/base/logoblob_ut.cpp b/ydb/core/base/logoblob_ut.cpp
index 75d9d2b833b..cbdfc9bcd0d 100644
--- a/ydb/core/base/logoblob_ut.cpp
+++ b/ydb/core/base/logoblob_ut.cpp
@@ -115,88 +115,88 @@ namespace NKikimr {
Y_UNIT_TEST_SUITE(TLogoBlobIdHashTest) {
Y_UNIT_TEST(SimpleTest) {
- // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 101, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 100, 16).Hash());
- }
-
+ // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 101, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 100, 16).Hash());
+ }
+
Y_UNIT_TEST(SimpleTestPartIdDoesNotMatter) {
- // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie, ui32 partId
- ui32 partId = 1;
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 101, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 100, 16, partId).Hash());
-
- partId = 2;
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 101, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 100, 16, partId).Hash());
-
- partId = 3;
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 101, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 100, 16, partId).Hash());
- }
-
+ // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie, ui32 partId
+ ui32 partId = 1;
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 101, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 100, 16, partId).Hash());
+
+ partId = 2;
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 101, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 100, 16, partId).Hash());
+
+ partId = 3;
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 101, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 100, 16, partId).Hash());
+ }
+
Y_UNIT_TEST(SimpleTestBlobSizeDoesNotMatter) {
- // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie, ui32 partId
- ui32 partId = 1;
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 32423523, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 43, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 54645, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 56650, 15, partId).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 0, 15, partId).Hash());
+ // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie, ui32 partId
+ ui32 partId = 1;
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 32423523, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 43, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x4061a4ef, TLogoBlobID(42, 1, 2, 0, 54645, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 56650, 15, partId).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 0, 15, partId).Hash());
UNIT_ASSERT_VALUES_EQUAL(0x6b67039d, TLogoBlobID(42, 1, 1, 0, 58435455, 16, partId).Hash());
- }
-
+ }
+
Y_UNIT_TEST(SimpleTestWithDifferentTabletId) {
- // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x13330eae, TLogoBlobID(43, 1, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x13510deb, TLogoBlobID(44, 1, 1, 0, 100, 15).Hash());
-
- UNIT_ASSERT_VALUES_EQUAL(0x136f0d29, TLogoBlobID(45, 1, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x138d0c66, TLogoBlobID(46, 1, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x13ab0ba4, TLogoBlobID(47, 1, 1, 0, 100, 15).Hash());
- }
-
+ // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x13330eae, TLogoBlobID(43, 1, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x13510deb, TLogoBlobID(44, 1, 1, 0, 100, 15).Hash());
+
+ UNIT_ASSERT_VALUES_EQUAL(0x136f0d29, TLogoBlobID(45, 1, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x138d0c66, TLogoBlobID(46, 1, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x13ab0ba4, TLogoBlobID(47, 1, 1, 0, 100, 15).Hash());
+ }
+
Y_UNIT_TEST(SimpleTestWithDifferentSteps) {
- // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6da02590, TLogoBlobID(42, 3, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x1ae5b09f, TLogoBlobID(42, 4, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc82b3baf, TLogoBlobID(42, 5, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x7570c6bf, TLogoBlobID(42, 6, 1, 0, 100, 15).Hash());
- }
-
+ // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc05a9a80, TLogoBlobID(42, 2, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6da02590, TLogoBlobID(42, 3, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x1ae5b09f, TLogoBlobID(42, 4, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc82b3baf, TLogoBlobID(42, 5, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x7570c6bf, TLogoBlobID(42, 6, 1, 0, 100, 15).Hash());
+ }
+
Y_UNIT_TEST(SimpleTestWithDifferentChannel) {
- // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie
- UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc867dba4, TLogoBlobID(42, 1, 1, 2, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x231141be, TLogoBlobID(42, 1, 1, 3, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x4309a659, TLogoBlobID(42, 1, 1, 9, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x1854d729, TLogoBlobID(42, 1, 1, 17, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xbd6e95ea, TLogoBlobID(42, 1, 1, 64, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x67c81c65, TLogoBlobID(42, 1, 1, 128, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0xc271827f, TLogoBlobID(42, 1, 1, 129, 100, 15).Hash());
- UNIT_ASSERT_VALUES_EQUAL(0x61d1c33f, TLogoBlobID(42, 1, 1, 255, 100, 15).Hash());
- }
-
- }
-
+ // ui64 tabletId, ui32 generation, ui32 step, ui32 channel, ui32 blobSize, ui32 cookie
+ UNIT_ASSERT_VALUES_EQUAL(0x13150f70, TLogoBlobID(42, 1, 1, 0, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x6dbe758a, TLogoBlobID(42, 1, 1, 1, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc867dba4, TLogoBlobID(42, 1, 1, 2, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x231141be, TLogoBlobID(42, 1, 1, 3, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x4309a659, TLogoBlobID(42, 1, 1, 9, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x1854d729, TLogoBlobID(42, 1, 1, 17, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xbd6e95ea, TLogoBlobID(42, 1, 1, 64, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x67c81c65, TLogoBlobID(42, 1, 1, 128, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0xc271827f, TLogoBlobID(42, 1, 1, 129, 100, 15).Hash());
+ UNIT_ASSERT_VALUES_EQUAL(0x61d1c33f, TLogoBlobID(42, 1, 1, 255, 100, 15).Hash());
+ }
+
+ }
+
} // NKikimr
diff --git a/ydb/core/blobstorage/dsproxy/ut/ya.make b/ydb/core/blobstorage/dsproxy/ut/ya.make
index 76825e572bb..f0a8048dd2f 100644
--- a/ydb/core/blobstorage/dsproxy/ut/ya.make
+++ b/ydb/core/blobstorage/dsproxy/ut/ya.make
@@ -14,11 +14,11 @@ IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
PEERDIR(
library/cpp/actors/core
library/cpp/getopt
diff --git a/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp b/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp
index 13b1bec3563..41bb6edff66 100644
--- a/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp
+++ b/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp
@@ -53,7 +53,7 @@
#include <util/system/backtrace.h>
#include <util/system/defaults.h>
#include <util/system/event.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
#define RT_EXECUTOR_POOL 0
@@ -102,7 +102,7 @@ do { \
} while(false)
-constexpr ui32 TEST_TIMEOUT = NSan::PlainOrUnderSanitizer(1800000, 2400000);
+constexpr ui32 TEST_TIMEOUT = NSan::PlainOrUnderSanitizer(1800000, 2400000);
static bool IsVerbose = false;
static bool IsProfilerEnabled = true;
@@ -3445,8 +3445,8 @@ public:
}
};
-#define PROXY_UNIT_TEST(a) UNIT_TEST(a)
-
+#define PROXY_UNIT_TEST(a) UNIT_TEST(a)
+
class TBlobStorageProxyTest: public TTestBase {
UNIT_TEST_SUITE(TBlobStorageProxyTest);
PROXY_UNIT_TEST(TestGetMultipart);
@@ -3500,12 +3500,12 @@ class TBlobStorageProxyTest: public TTestBase {
PROXY_UNIT_TEST(TestVGetNoData);
PROXY_UNIT_TEST(TestProxyLongTailDiscover);
PROXY_UNIT_TEST(TestProxyLongTailDiscoverMaxi);
- PROXY_UNIT_TEST(TestProxyLongTailDiscoverSingleFailure);
+ PROXY_UNIT_TEST(TestProxyLongTailDiscoverSingleFailure);
PROXY_UNIT_TEST(TestProxyRestoreOnDiscoverBlock);
PROXY_UNIT_TEST(TestProxyRestoreOnGetBlock);
PROXY_UNIT_TEST(TestProxyRestoreOnGetStripe);
PROXY_UNIT_TEST(TestProxyRestoreOnGetMirror);
- PROXY_UNIT_TEST(TestProxyRestoreOnGetMirror3Plus2);
+ PROXY_UNIT_TEST(TestProxyRestoreOnGetMirror3Plus2);
PROXY_UNIT_TEST(TestVBlockVPutVGet);
PROXY_UNIT_TEST(TestEmptyDiscover);
PROXY_UNIT_TEST(TestEmptyDiscoverMaxi);
@@ -3977,7 +3977,7 @@ public:
}
void TestCompactedGetMultipart() {
- return; // TODO https://st.yandex-team.ru/KIKIMR-2244
+ return; // TODO https://st.yandex-team.ru/KIKIMR-2244
TTempDir tempDir;
TestBlobStorage<TTestBlobStorageProxyPut>(0, TBlobStorageGroupType::Erasure3Plus1Block, tempDir().data());
TestBlobStorage<TTestVDiskCompacted<0>>(0, TBlobStorageGroupType::Erasure3Plus1Block, tempDir().data());
diff --git a/ydb/core/blobstorage/dsproxy/ut_fat/ya.make b/ydb/core/blobstorage/dsproxy/ut_fat/ya.make
index 6544b16ff1b..24b3d09b5bc 100644
--- a/ydb/core/blobstorage/dsproxy/ut_fat/ya.make
+++ b/ydb/core/blobstorage/dsproxy/ut_fat/ya.make
@@ -1,11 +1,11 @@
UNITTEST()
-OWNER(
- alexvru
- cthulhu
+OWNER(
+ alexvru
+ cthulhu
g:kikimr
-)
-
+)
+
FORK_SUBTESTS()
SPLIT_FACTOR(30)
diff --git a/ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp b/ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp
index 59d3cb999cf..1eeec85125b 100644
--- a/ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp
+++ b/ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp
@@ -10,8 +10,8 @@
#include <util/random/fast.h>
#include <util/folder/tempdir.h>
#include <util/folder/path.h>
-#include <util/system/sanitizers.h>
-#include <util/system/valgrind.h>
+#include <util/system/sanitizers.h>
+#include <util/system/valgrind.h>
using namespace NActors;
using namespace NKikimr;
@@ -140,11 +140,11 @@ Y_UNIT_TEST_SUITE(TIncrHugeBasicTest) {
env.Start();
TManualEvent event;
TTestActorConcurrent::TTestActorState state;
- const ui32 numActions = NSan::PlainOrUnderSanitizer(
- NValgrind::PlainOrUnderValgrind(10000, 100),
- 1000
- );
- TTestActorConcurrent *actor = new TTestActorConcurrent(env.KeeperId, &event, state, numActions, 1);
+ const ui32 numActions = NSan::PlainOrUnderSanitizer(
+ NValgrind::PlainOrUnderValgrind(10000, 100),
+ 1000
+ );
+ TTestActorConcurrent *actor = new TTestActorConcurrent(env.KeeperId, &event, state, numActions, 1);
env.ActorSystem->Register(actor);
event.WaitI();
env.Stop();
@@ -171,8 +171,8 @@ Y_UNIT_TEST_SUITE(TIncrHugeBasicTest) {
env.Setup(false);
env.Start();
- const ui32 numActions = NSan::PlainOrUnderSanitizer(100, 10);
- actor = new TTestActorConcurrent(env.KeeperId, &event, state, numActions, 2);
+ const ui32 numActions = NSan::PlainOrUnderSanitizer(100, 10);
+ actor = new TTestActorConcurrent(env.KeeperId, &event, state, numActions, 2);
env.ActorSystem->Register(actor);
event.WaitI();
env.Stop();
@@ -185,8 +185,8 @@ Y_UNIT_TEST_SUITE(TIncrHugeBasicTest) {
env.Start();
TManualEvent event;
TTestActorConcurrent::TTestActorState state;
- const ui32 initialNumActions = NSan::PlainOrUnderSanitizer(1000, 100);
- TTestActorConcurrent *actor = new TTestActorConcurrent(env.KeeperId, &event, state, initialNumActions, 1,
+ const ui32 initialNumActions = NSan::PlainOrUnderSanitizer(1000, 100);
+ TTestActorConcurrent *actor = new TTestActorConcurrent(env.KeeperId, &event, state, initialNumActions, 1,
100000 /* writeScore */, 80000 /* deleteScore */, 0 /* readScore */);
env.ActorSystem->Register(actor);
// usleep(1 * 1000 * 1000);
@@ -200,22 +200,22 @@ Y_UNIT_TEST_SUITE(TIncrHugeBasicTest) {
env.Setup(false);
env.Start();
LOG_DEBUG(*env.ActorSystem, NActorsServices::TEST, "starting recovery");
- const ui32 numActions = NSan::PlainOrUnderSanitizer(5000, 1000);
- actor = new TTestActorConcurrent(env.KeeperId, &event, state, numActions, 2);
+ const ui32 numActions = NSan::PlainOrUnderSanitizer(5000, 1000);
+ actor = new TTestActorConcurrent(env.KeeperId, &event, state, numActions, 2);
env.ActorSystem->Register(actor);
event.WaitI();
env.Stop();
}
Y_UNIT_TEST(Recovery) {
- return; // TODO https://st.yandex-team.ru/KIKIMR-3065
+ return; // TODO https://st.yandex-team.ru/KIKIMR-3065
TTestEnv env;
env.Setup(true, 0, nullptr, 2000, 128 << 20);
env.Start();
TManualEvent event;
TTestActorConcurrent::TTestActorState state;
- const ui32 numActions = NSan::PlainOrUnderSanitizer(33333, 1000);
- TTestActorConcurrent *actor = new TTestActorConcurrent(env.KeeperId, &event, state, numActions, 1,
+ const ui32 numActions = NSan::PlainOrUnderSanitizer(33333, 1000);
+ TTestActorConcurrent *actor = new TTestActorConcurrent(env.KeeperId, &event, state, numActions, 1,
100000 /* writeScore */, 1000 /* deleteScore */, 0 /* readScore */);
env.ActorSystem->Register(actor);
event.WaitI();
diff --git a/ydb/core/blobstorage/incrhuge/ut/ya.make b/ydb/core/blobstorage/incrhuge/ut/ya.make
index 971a739c01a..d366282c575 100644
--- a/ydb/core/blobstorage/incrhuge/ut/ya.make
+++ b/ydb/core/blobstorage/incrhuge/ut/ya.make
@@ -1,34 +1,34 @@
UNITTEST()
-
+
OWNER(
alexvru
g:kikimr
)
-
-FORK_SUBTESTS()
-
-IF (WITH_VALGRIND)
- TIMEOUT(3600)
+
+FORK_SUBTESTS()
+
+IF (WITH_VALGRIND)
+ TIMEOUT(3600)
SIZE(LARGE)
TAG(ya:fat)
-ELSE()
+ELSE()
TIMEOUT(600)
SIZE(MEDIUM)
-ENDIF()
-
-PEERDIR(
+ENDIF()
+
+PEERDIR(
library/cpp/actors/protos
ydb/core/blobstorage
ydb/core/blobstorage/incrhuge
ydb/core/blobstorage/pdisk
-)
-
-SRCS(
- incrhuge_basic_ut.cpp
- incrhuge_id_dict_ut.cpp
- incrhuge_log_merger_ut.cpp
-)
-
+)
+
+SRCS(
+ incrhuge_basic_ut.cpp
+ incrhuge_id_dict_ut.cpp
+ incrhuge_log_merger_ut.cpp
+)
+
REQUIREMENTS(ram:9)
END()
diff --git a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
index e3c74cce7b4..4fa738562f2 100644
--- a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
+++ b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
@@ -59,7 +59,7 @@ do { \
} while(false)
-static bool IsVerbose = true;
+static bool IsVerbose = true;
static yexception LastException;
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_async.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_async.cpp
index 34c20999b7b..b7e31080bfd 100644
--- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_async.cpp
+++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_async.cpp
@@ -26,7 +26,7 @@
#include <util/generic/bitops.h>
#include <util/system/file.h>
#include <util/system/mutex.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
#include <util/system/spinlock.h>
#include <util/system/thread.h>
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp
index 90816f5a22f..7627ad34eaa 100644
--- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp
+++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp
@@ -15,7 +15,7 @@
#include <util/system/condvar.h>
#include <util/string/printf.h>
#include <util/system/file.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
namespace NKikimr {
@@ -135,13 +135,13 @@ TString CreateFile(const char *baseDir, ui32 dataSize) {
}
constexpr TDuration TIMEOUT = NSan::PlainOrUnderSanitizer(TDuration::Seconds(120), TDuration::Seconds(360));
-
-void WaitForValue(TAtomic *counter, TDuration maxDuration, TAtomicBase expectedValue) {
- TInstant finishTime = TInstant::Now() + maxDuration;
- while (TInstant::Now() < finishTime) {
+
+void WaitForValue(TAtomic *counter, TDuration maxDuration, TAtomicBase expectedValue) {
+ TInstant finishTime = TInstant::Now() + maxDuration;
+ while (TInstant::Now() < finishTime) {
for (int i = 0; i < 100; ++i) {
Sleep(TDuration::MilliSeconds(50));
- TAtomicBase resultingCounter = AtomicGet(*counter);
+ TAtomicBase resultingCounter = AtomicGet(*counter);
if (resultingCounter >= expectedValue) {
return;
}
@@ -269,7 +269,7 @@ Y_UNIT_TEST_SUITE(TBlockDeviceTest) {
generationSize *= 3;
}
- WaitForValue(&counter, 60000, expectedCounter);
+ WaitForValue(&counter, 60000, expectedCounter);
TAtomicBase resultingCounter = AtomicGet(counter);
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp
index b49b5bd206f..69d5390f538 100644
--- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp
+++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut.cpp
@@ -20,10 +20,10 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
}
Y_UNIT_TEST(TestThatEveryValueOfEStateEnumKeepsItIntegerValue) {
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Warning!
- // Kikimr Admins use Integer values of EState in their scripts!
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Warning!
+ // Kikimr Admins use Integer values of EState in their scripts!
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
UNIT_ASSERT(NKikimrBlobStorage::TPDiskState::Initial == 0);
UNIT_ASSERT(NKikimrBlobStorage::TPDiskState::InitialFormatRead == 1);
UNIT_ASSERT(NKikimrBlobStorage::TPDiskState::InitialFormatReadError == 2);
@@ -38,7 +38,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
UNIT_ASSERT(NKikimrBlobStorage::TPDiskState::OpenFileError == 11);
UNIT_ASSERT(NKikimrBlobStorage::TPDiskState::ChunkQuotaError == 12);
UNIT_ASSERT(NKikimrBlobStorage::TPDiskState::DeviceIoError == 13);
- }
+ }
struct TActorTestContext {
private:
@@ -337,7 +337,7 @@ void RecreateOwner(TActorTestContext& testCtx, TVDiskIDOwnerRound& vdisk) {
NKikimrProto::OK);
vdisk.OwnerRound = evInitRes->PDiskParams->OwnerRound;
-}
+}
Y_UNIT_TEST(TestPDiskManyOwnersInitiation) {
TActorTestContext testCtx(false);
diff --git a/ydb/core/blobstorage/ut_pdiskfit/ut/main.cpp b/ydb/core/blobstorage/ut_pdiskfit/ut/main.cpp
index 011d7cf8398..c8dd38c3b0f 100644
--- a/ydb/core/blobstorage/ut_pdiskfit/ut/main.cpp
+++ b/ydb/core/blobstorage/ut_pdiskfit/ut/main.cpp
@@ -2,8 +2,8 @@
#include <ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.h>
#include <library/cpp/testing/unittest/registar.h>
-#include <util/system/sanitizers.h>
-
+#include <util/system/sanitizers.h>
+
class TWatchdogThread : public ISimpleThread {
TMutex Mutex;
TCondVar Stop;
diff --git a/ydb/core/blobstorage/ut_vdisk/lib/prepare.h b/ydb/core/blobstorage/ut_vdisk/lib/prepare.h
index fc5da8d3421..55f2c3c686f 100644
--- a/ydb/core/blobstorage/ut_vdisk/lib/prepare.h
+++ b/ydb/core/blobstorage/ut_vdisk/lib/prepare.h
@@ -3,7 +3,7 @@
#include "defs.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
#include <util/system/event.h>
#include <util/system/condvar.h>
#include <util/folder/tempdir.h>
@@ -220,9 +220,9 @@ struct TConfiguration {
TimeoutCallbacksCV.WaitI(TimeoutCallbacksLock);
}
- UNIT_ASSERT_VALUES_EQUAL(doneCount, instances);
- UNIT_ASSERT_VALUES_EQUAL(SuccessCount, instances);
-
+ UNIT_ASSERT_VALUES_EQUAL(doneCount, instances);
+ UNIT_ASSERT_VALUES_EQUAL(SuccessCount, instances);
+
return doneCount == instances && SuccessCount == instances;
}
diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp
index 43c0a68e4b9..5dd608dbbe6 100644
--- a/ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp
+++ b/ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp
@@ -2,7 +2,7 @@
#include "helpers.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
using namespace NKikimr;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -26,8 +26,8 @@ protected:
TSyncRunner::TReturnValue ret;
TPDiskPutStatusHandler hndl = PDiskPutStatusHandlerErrorAware;
ret = SyncRunner->Run(ctx, ManyPutsToCorrespondingVDisks(SyncRunner->NotifyID(), Conf, &dataSet, hndl));
- UNIT_ASSERT_VALUES_EQUAL(ret.Id, 0);
- UNIT_ASSERT_EQUAL(ret.Status, NKikimrProto::OUT_OF_SPACE);
+ UNIT_ASSERT_VALUES_EQUAL(ret.Id, 0);
+ UNIT_ASSERT_EQUAL(ret.Status, NKikimrProto::OUT_OF_SPACE);
LOG_NOTICE(ctx, NActorsServices::TEST, " Data is loaded until ORANGE ZONE");
}
@@ -63,8 +63,8 @@ protected:
TSyncRunner::TReturnValue ret;
TPDiskPutStatusHandler hndl = PDiskPutStatusHandlerYellowMoveZone;
ret = SyncRunner->Run(ctx, ManyPutsToCorrespondingVDisks(SyncRunner->NotifyID(), Conf, &dataSet, hndl));
- UNIT_ASSERT_VALUES_EQUAL(ret.Id, 0);
- UNIT_ASSERT_VALUES_EQUAL(ret.Status, 0x28733642);
+ UNIT_ASSERT_VALUES_EQUAL(ret.Id, 0);
+ UNIT_ASSERT_VALUES_EQUAL(ret.Status, 0x28733642);
LOG_NOTICE(ctx, NActorsServices::TEST, " Data is loaded until YELLOW ZONE");
}
diff --git a/ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp b/ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp
index 694828c9f8c..05074b82e47 100644
--- a/ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp
+++ b/ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp
@@ -38,7 +38,7 @@ void TestRun(TTest *test,
erasure);
TVDiskSetup vdiskSetup;
Conf.Prepare(&vdiskSetup);
- bool success = Conf.Run<TTest>(test, timeout);
+ bool success = Conf.Run<TTest>(test, timeout);
Conf.Shutdown();
UNIT_ASSERT(success);
@@ -76,7 +76,7 @@ IDataSetPtr DataSetSelector(EDataSet t, ui32 minHugeBlobSize) {
Y_UNIT_TEST(TestName) { \
IDataSetPtr ds = DataSetSelector(g, 64u << 10u); \
ClassName test(ds, CompParam, VDiskNumParam); \
- TestRun<ClassName, Setup>(&test, TIMEOUT); \
+ TestRun<ClassName, Setup>(&test, TIMEOUT); \
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -86,7 +86,7 @@ Y_UNIT_TEST_SUITE(TBsVDiskExtreme) {
Y_UNIT_TEST(SimpleGetFromEmptyDB) {
TSimpleGetFromEmptyDB test;
- TestRun<TSimpleGetFromEmptyDB, TFastVDiskSetup>(&test, TIMEOUT);
+ TestRun<TSimpleGetFromEmptyDB, TFastVDiskSetup>(&test, TIMEOUT);
}
Y_UNIT_TEST_COMP_DISK(Simple3Put3GetFresh, TSimple3Put3Get, TFastVDiskSetup, false, 0, DG_3PUT)
@@ -166,7 +166,7 @@ Y_UNIT_TEST_SUITE(TBsVDiskRange) {
Y_UNIT_TEST(RangeGetFromEmptyDB) {
TRangeGetFromEmptyDB test;
- TestRun<TRangeGetFromEmptyDB, TFastVDiskSetup>(&test, TIMEOUT);
+ TestRun<TRangeGetFromEmptyDB, TFastVDiskSetup>(&test, TIMEOUT);
}
Y_UNIT_TEST_COMP_DISK(Simple3PutRangeGetAllForwardFresh, TSimple3PutRangeGetAllForward,
@@ -326,32 +326,32 @@ Y_UNIT_TEST_SUITE(TBsVDiskManyPutGet) {
Y_UNIT_TEST_SUITE(TBsVDiskGC) {
Y_UNIT_TEST(GCPutKeepIntoEmptyDB) {
TGCPutKeepIntoEmptyDB test;
- TestRun<TGCPutKeepIntoEmptyDB, TFastVDiskSetupCompacted>(&test, TIMEOUT);
+ TestRun<TGCPutKeepIntoEmptyDB, TFastVDiskSetupCompacted>(&test, TIMEOUT);
} // FIXME: Fresh???
Y_UNIT_TEST(GCPutBarrierVDisk0NoSync) {
TGCPutBarrierVDisk0 test;
- TestRun<TGCPutBarrierVDisk0, TFastCompactionGCNoSyncVDiskSetup>(&test, TIMEOUT);
+ TestRun<TGCPutBarrierVDisk0, TFastCompactionGCNoSyncVDiskSetup>(&test, TIMEOUT);
}
Y_UNIT_TEST(GCPutBarrierSync) {
TGCPutBarrier test;
- TestRun<TGCPutBarrier, TFastVDiskSetupCompacted>(&test, TIMEOUT);
+ TestRun<TGCPutBarrier, TFastVDiskSetupCompacted>(&test, TIMEOUT);
}
Y_UNIT_TEST(GCPutKeepBarrierSync) {
TGCPutKeepBarrier test;
- TestRun<TGCPutKeepBarrier, TFastVDiskSetupCompacted>(&test, TIMEOUT);
+ TestRun<TGCPutKeepBarrier, TFastVDiskSetupCompacted>(&test, TIMEOUT);
}
Y_UNIT_TEST(GCPutManyBarriersNoSync) {
TGCPutManyBarriers test;
- TestRun<TGCPutManyBarriers, TFastCompactionGCNoSyncVDiskSetup>(&test, TIMEOUT);
+ TestRun<TGCPutManyBarriers, TFastCompactionGCNoSyncVDiskSetup>(&test, TIMEOUT);
}
Y_UNIT_TEST(TGCManyVPutsCompactGCAllTest) {
TGCManyVPutsCompactGCAll test;
- TestRun<TGCManyVPutsCompactGCAll, TFastVDiskSetupCompacted>(&test, TIMEOUT);
+ TestRun<TGCManyVPutsCompactGCAll, TFastVDiskSetupCompacted>(&test, TIMEOUT);
}
Y_UNIT_TEST(TGCManyVPutsDelTabletTest) {
@@ -373,14 +373,14 @@ Y_UNIT_TEST_SUITE(TBsVDiskOutOfSpace) {
TWriteUntilOrangeZone test;
const ui32 chunkSize = 512u << 10u;
const ui64 diskSize = 500ull << 20ull;
- TestRun<TWriteUntilOrangeZone, TFastVDiskSetupCompacted>(&test, TIMEOUT, chunkSize, diskSize);
+ TestRun<TWriteUntilOrangeZone, TFastVDiskSetupCompacted>(&test, TIMEOUT, chunkSize, diskSize);
}
Y_UNIT_TEST(WriteUntilYellowZone) {
TWriteUntilYellowZone test;
const ui32 chunkSize = 512u << 10u;
const ui64 diskSize = 700ull << 20ull;
- TestRun<TWriteUntilYellowZone, TFastVDiskSetupCompacted>(&test, TIMEOUT, chunkSize, diskSize);
+ TestRun<TWriteUntilYellowZone, TFastVDiskSetupCompacted>(&test, TIMEOUT, chunkSize, diskSize);
}
}
@@ -417,7 +417,7 @@ Y_UNIT_TEST_SUITE(TBsVDiskBrokenPDisk) {
Y_UNIT_TEST_SUITE(TBsVDiskHandoffMoveDel) {
Y_UNIT_TEST(HandoffMoveDel) {
TTestHandoffMoveDel test;
- TestRun<TTestHandoffMoveDel, TFastVDiskSetupCompacted>(&test, TIMEOUT);
+ TestRun<TTestHandoffMoveDel, TFastVDiskSetupCompacted>(&test, TIMEOUT);
}
}
@@ -427,7 +427,7 @@ Y_UNIT_TEST_SUITE(TBsVDiskHandoffMoveDel) {
Y_UNIT_TEST_SUITE(TBsHuge) {
Y_UNIT_TEST(Simple) {
THugeModuleTest test;
- TestRun<THugeModuleTest, TFastVDiskSetupCompacted>(&test, TIMEOUT);
+ TestRun<THugeModuleTest, TFastVDiskSetupCompacted>(&test, TIMEOUT);
}
Y_UNIT_TEST(SimpleErasureNone) {
@@ -447,22 +447,22 @@ Y_UNIT_TEST_SUITE(TBsHuge) {
///////////////////////////////////////////////////////////////////////////////////////////////////////
Y_UNIT_TEST_SUITE(TBsLocalRecovery) {
Y_UNIT_TEST(StartStopNotEmptyDB) {
- const ui32 numIterations = NValgrind::PlainOrUnderValgrind(10, 2);
+ const ui32 numIterations = NValgrind::PlainOrUnderValgrind(10, 2);
TConfiguration Conf;
TFastVDiskSetup vdiskSetup;
Conf.Prepare(&vdiskSetup);
LOG_NOTICE(*Conf.ActorSystem1, NActorsServices::TEST, "====================== Initial step");
TCheckDbIsEmptyManyPutGet test(true, false, MIDDLE_MSG_NUM, 100, UNK); // DB must be empty
- bool success1 = Conf.Run<TCheckDbIsEmptyManyPutGet>(&test, TIMEOUT);
+ bool success1 = Conf.Run<TCheckDbIsEmptyManyPutGet>(&test, TIMEOUT);
UNIT_ASSERT(success1);
Conf.Shutdown();
- for (unsigned i = 0; i < numIterations; i++) {
+ for (unsigned i = 0; i < numIterations; i++) {
Conf.Prepare(&vdiskSetup, false);
LOG_NOTICE(*Conf.ActorSystem1, NActorsServices::TEST, "====================== Iteration %u", i);
TCheckDbIsEmptyManyPutGet test(false, false, 1000, 100, UNK); // DB must no be empty
- bool success2 = Conf.Run<TCheckDbIsEmptyManyPutGet>(&test, TIMEOUT);
+ bool success2 = Conf.Run<TCheckDbIsEmptyManyPutGet>(&test, TIMEOUT);
UNIT_ASSERT(success2);
Conf.Shutdown();
}
@@ -654,12 +654,12 @@ Y_UNIT_TEST_SUITE(TBsDbStat) {
Y_UNIT_TEST_SUITE(TBsVDiskRepl1) {
Y_UNIT_TEST(ReplProxyData) {
TTestReplProxyData test;
- TestRun<TTestReplProxyData, TFastVDiskSetupCompacted>(&test, TIMEOUT);
+ TestRun<TTestReplProxyData, TFastVDiskSetupCompacted>(&test, TIMEOUT);
}
Y_UNIT_TEST(ReplProxyKeepBits) {
TTestReplProxyKeepBits test;
- TestRun<TTestReplProxyKeepBits, TFastVDiskSetupCompacted>(&test, TIMEOUT);
+ TestRun<TTestReplProxyKeepBits, TFastVDiskSetupCompacted>(&test, TIMEOUT);
}
@@ -673,13 +673,13 @@ Y_UNIT_TEST_SUITE(TBsVDiskRepl1) {
TFastVDiskSetup vdiskSetup;
Conf.Prepare(&vdiskSetup);
TTestReplDataWriteAndSync testLoad(&dataSet);
- bool success1 = Conf.Run<TTestReplDataWriteAndSync>(&testLoad, TIMEOUT);
+ bool success1 = Conf.Run<TTestReplDataWriteAndSync>(&testLoad, TIMEOUT);
UNIT_ASSERT(success1);
Conf.Shutdown();
Conf.PDisks->EraseDisk(3, 678);
Conf.Prepare(&vdiskSetup, false);
- TReadUntilSuccess testRead(&dataSet, 3, SMALL_TIMEOUT);
- bool success2 = Conf.Run<TReadUntilSuccess>(&testRead, TIMEOUT);
+ TReadUntilSuccess testRead(&dataSet, 3, SMALL_TIMEOUT);
+ bool success2 = Conf.Run<TReadUntilSuccess>(&testRead, TIMEOUT);
Conf.Shutdown();
UNIT_ASSERT(success2);
}
@@ -696,14 +696,14 @@ Y_UNIT_TEST_SUITE(TBsVDiskRepl2) {
TFastVDiskSetup vdiskSetup;
Conf.Prepare(&vdiskSetup);
TTestReplDataWriteAndSync testLoad(&dataSet);
- bool success1 = Conf.Run<TTestReplDataWriteAndSync>(&testLoad, TIMEOUT);
+ bool success1 = Conf.Run<TTestReplDataWriteAndSync>(&testLoad, TIMEOUT);
UNIT_ASSERT(success1);
Conf.Shutdown();
Conf.PDisks->EraseDisk(3, 678);
TFastVDiskSetupWODisk2 vdiskSetupWODisk2;
Conf.Prepare(&vdiskSetupWODisk2, false);
- TReadUntilSuccess testRead(&dataSet, 3, SMALL_TIMEOUT);
- bool success2 = Conf.Run<TReadUntilSuccess>(&testRead, TIMEOUT);
+ TReadUntilSuccess testRead(&dataSet, 3, SMALL_TIMEOUT);
+ bool success2 = Conf.Run<TReadUntilSuccess>(&testRead, TIMEOUT);
Conf.Shutdown();
UNIT_ASSERT(success2);
}
@@ -807,7 +807,7 @@ Y_UNIT_TEST_SUITE(TBsVDiskRepl3) {
Conf.GroupInfo, vdisks));
dataSetPtr.Reset(new TGeneratedDataSet(generator));
TTestReplDataWriteAndSync testLoad(dataSetPtr.Get());
- bool success1 = Conf.Run<TTestReplDataWriteAndSync>(&testLoad, TIMEOUT);
+ bool success1 = Conf.Run<TTestReplDataWriteAndSync>(&testLoad, TIMEOUT);
UNIT_ASSERT(success1);
LOG_NOTICE(*Conf.ActorSystem1, NActorsServices::TEST, "stopped writer");
Conf.Shutdown();
@@ -820,9 +820,9 @@ Y_UNIT_TEST_SUITE(TBsVDiskRepl3) {
Conf.GroupInfo, vdisks));
dataSetPtr.Reset(new TGeneratedDataSet(generator));
LOG_NOTICE(*Conf.ActorSystem1, NActorsServices::TEST, "starting first read pass");
- TReadUntilSuccess testRead(dataSetPtr.Get(), 3, SMALL_TIMEOUT);
+ TReadUntilSuccess testRead(dataSetPtr.Get(), 3, SMALL_TIMEOUT);
TInstant begin = Now();
- bool success2 = Conf.Run<TReadUntilSuccess>(&testRead, TIMEOUT);
+ bool success2 = Conf.Run<TReadUntilSuccess>(&testRead, TIMEOUT);
TInstant end = Now();
TDuration timedelta = end - begin;
Conf.Shutdown();
@@ -836,9 +836,9 @@ Y_UNIT_TEST_SUITE(TBsVDiskRepl3) {
LOG_NOTICE_S(*Conf.ActorSystem1, NActorsServices::TEST, "first read pass w/repl took " << timedelta.ToString().data());
LOG_NOTICE(*Conf.ActorSystem1, NActorsServices::TEST, "starting second read pass");
- TReadUntilSuccess verifyRead(dataSetPtr.Get(), 3, SMALL_TIMEOUT);
+ TReadUntilSuccess verifyRead(dataSetPtr.Get(), 3, SMALL_TIMEOUT);
begin = Now();
- bool success3 = Conf.Run<TReadUntilSuccess>(&verifyRead, TIMEOUT);
+ bool success3 = Conf.Run<TReadUntilSuccess>(&verifyRead, TIMEOUT);
end = Now();
timedelta = end - begin;
Conf.Shutdown();
@@ -850,7 +850,7 @@ Y_UNIT_TEST_SUITE(TBsVDiskRepl3) {
TNoVDiskSetup vdiskSetup;
Conf.Prepare(&vdiskSetup);
TSyncLogTestWrite test;
- bool success1 = Conf.Run<TSyncLogTestWrite>(&test, TIMEOUT, 1, false);
+ bool success1 = Conf.Run<TSyncLogTestWrite>(&test, TIMEOUT, 1, false);
Conf.Shutdown();
UNIT_ASSERT(success1);
}
diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h
index 56fcf7a9e8c..9561b7bf526 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h
+++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h
@@ -303,7 +303,7 @@ namespace NKikimr {
}
void Add(const TDiskBlob &addBlob) {
- Y_VERIFY(!addBlob.GetParts().Empty());
+ Y_VERIFY(!addBlob.GetParts().Empty());
AddImpl(addBlob, addBlob.GetParts());
}
diff --git a/ydb/core/client/flat_ut.cpp b/ydb/core/client/flat_ut.cpp
index 362c052aa11..97ed9487629 100644
--- a/ydb/core/client/flat_ut.cpp
+++ b/ydb/core/client/flat_ut.cpp
@@ -1433,7 +1433,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
}
Y_UNIT_TEST(OutOfDiskSpace) {
- return; // TODO https://st.yandex-team.ru/KIKIMR-2279
+ return; // TODO https://st.yandex-team.ru/KIKIMR-2279
TPortManager pm;
ui16 port = pm.GetPort(2134);
diff --git a/ydb/core/client/minikql_result_lib/ut/ya.make b/ydb/core/client/minikql_result_lib/ut/ya.make
index 977bac4c9a0..c68d408f2dc 100644
--- a/ydb/core/client/minikql_result_lib/ut/ya.make
+++ b/ydb/core/client/minikql_result_lib/ut/ya.make
@@ -2,12 +2,12 @@ UNITTEST_FOR(ydb/core/client/minikql_result_lib)
OWNER(g:kikimr)
-FORK_SUBTESTS()
+FORK_SUBTESTS()
TIMEOUT(300)
SIZE(MEDIUM)
-
+
SRCS(
converter_ut.cpp
objects_ut.cpp
diff --git a/ydb/core/client/server/msgbus_server_keyvalue.cpp b/ydb/core/client/server/msgbus_server_keyvalue.cpp
index ad644f4c269..0badbc5db8a 100644
--- a/ydb/core/client/server/msgbus_server_keyvalue.cpp
+++ b/ydb/core/client/server/msgbus_server_keyvalue.cpp
@@ -15,12 +15,12 @@ class TMessageBusKeyValue
using TBase = TMessageBusSimpleTabletRequest<TMessageBusKeyValue<ResponseType>, TEvKeyValue::TEvResponse, NKikimrServices::TActivity::FRONT_KV_REQUEST>;
public:
NKikimrClient::TKeyValueRequest RequestProto;
- ui64 TabletId;
+ ui64 TabletId;
TMessageBusKeyValue(TBusMessageContext &msg, ui64 tabletId, bool withRetry, TDuration timeout)
: TBase(msg, tabletId, withRetry, timeout, false)
, RequestProto(static_cast<TBusKeyValue *>(msg.GetMessage())->Record)
- , TabletId(tabletId)
+ , TabletId(tabletId)
{}
void Handle(TEvKeyValue::TEvResponse::TPtr &ev, const TActorContext &ctx) {
@@ -36,25 +36,25 @@ public:
request->Record = RequestProto;
return request.Release();
}
-
- NBus::TBusMessage* CreateErrorReply(EResponseStatus status, const TActorContext &ctx,
+
+ NBus::TBusMessage* CreateErrorReply(EResponseStatus status, const TActorContext &ctx,
const TString& text = TString()) override {
- LOG_WARN_S(ctx, NKikimrServices::MSGBUS_REQUEST, "TMessageBusKeyValue TabletId# " << TabletId
- << " status# " << status << " text# \"" << text << "\" Marker# MBKV2" << Endl);
-
+ LOG_WARN_S(ctx, NKikimrServices::MSGBUS_REQUEST, "TMessageBusKeyValue TabletId# " << TabletId
+ << " status# " << status << " text# \"" << text << "\" Marker# MBKV2" << Endl);
+
TAutoPtr<ResponseType> response(new ResponseType());
- response->Record.SetStatus(status);
- if (text) {
+ response->Record.SetStatus(status);
+ if (text) {
response->Record.SetErrorReason(text);
- } else {
- TStringStream str;
- str << "TMessageBusKeyValue unknown error, TabletId# " << TabletId;
- str << " status# " << status;
- str << " Marker# MBKV1" << Endl;
+ } else {
+ TStringStream str;
+ str << "TMessageBusKeyValue unknown error, TabletId# " << TabletId;
+ str << " status# " << status;
+ str << " Marker# MBKV1" << Endl;
response->Record.SetErrorReason(str.Str());
- }
- return response.Release();
- }
+ }
+ return response.Release();
+ }
};
IActor* CreateMessageBusKeyValue(NKikimr::NMsgBusProxy::TBusMessageContext &msg) {
diff --git a/ydb/core/client/ut/ya.make b/ydb/core/client/ut/ya.make
index 5d839f47c85..3df5febf811 100644
--- a/ydb/core/client/ut/ya.make
+++ b/ydb/core/client/ut/ya.make
@@ -17,15 +17,15 @@ IF (SANITIZER_TYPE == "thread" OR WITH_VALGRIND)
ram:32
)
TAG(ya:fat)
-ELSE()
+ELSE()
REQUIREMENTS(
cpu:4
ram:16
)
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp
index a9be370d37f..5d4bf1b643d 100644
--- a/ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp
+++ b/ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp
@@ -13,14 +13,14 @@ public:
{}
bool IsVerbose;
- bool LockDevice;
+ bool LockDevice;
ui64 MainKey;
TString Path;
virtual void Config(TConfig& config) override {
TClientCommand::Config(config);
IsVerbose = false;
- LockDevice = false;
+ LockDevice = false;
MainKey = 0;
config.SetFreeArgsNum(1);
SetFreeArgTitle(0, "<PATH>", "Disk path");
@@ -30,8 +30,8 @@ public:
.Optional().StoreResult(&MainKey); // TODO: remove after migration
config.Opts->AddLongOption('v', "verbose", "output detailed information for debugging").Optional().NoArgument()
.SetFlag(&IsVerbose);
- config.Opts->AddLongOption('l', "lock", "lock device before reading disk info").Optional().NoArgument()
- .SetFlag(&LockDevice);
+ config.Opts->AddLongOption('l', "lock", "lock device before reading disk info").Optional().NoArgument()
+ .SetFlag(&LockDevice);
}
virtual void Parse(TConfig& config) override {
@@ -88,10 +88,10 @@ public:
}
return 0;
} else {
- Cerr << "Could not read disk format info"
- << " Path = " << Path
- << " ErrorReason = " << info.ErrorReason
- << Endl;
+ Cerr << "Could not read disk format info"
+ << " Path = " << Path
+ << " ErrorReason = " << info.ErrorReason
+ << Endl;
return 1;
}
}
diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp
index af2801de362..26e3e814c9c 100644
--- a/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp
+++ b/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp
@@ -244,13 +244,13 @@ public:
TVector<TVector<TVector<const TCandidate*>>> bestGroup;
if (!CreateGroupWithRings(candidates, NumRings, FailDomains, VDisksPerFailDomain, RingBeginLevel, RingEndLevel,
bestGroup)) {
- Cerr << "Can't create group with given parameters"
- << " NumRings = " << NumRings
- << ", FailDomains = " << FailDomains
- << ", VDisksPerFailDomain = " << VDisksPerFailDomain
- << ", RingBeginLevel = " << RingBeginLevel
- << ", RingEndLevel = " << RingEndLevel
- << Endl;
+ Cerr << "Can't create group with given parameters"
+ << " NumRings = " << NumRings
+ << ", FailDomains = " << FailDomains
+ << ", VDisksPerFailDomain = " << VDisksPerFailDomain
+ << ", RingBeginLevel = " << RingBeginLevel
+ << ", RingEndLevel = " << RingEndLevel
+ << Endl;
return EXIT_FAILURE;
}
diff --git a/ydb/core/engine/ut/ya.make b/ydb/core/engine/ut/ya.make
index 02810813ab4..405c73b383f 100644
--- a/ydb/core/engine/ut/ya.make
+++ b/ydb/core/engine/ut/ya.make
@@ -7,12 +7,12 @@ OWNER(
ALLOCATOR(J)
-FORK_SUBTESTS()
+FORK_SUBTESTS()
-TIMEOUT(150)
-
-SIZE(MEDIUM)
+TIMEOUT(150)
+SIZE(MEDIUM)
+
SRCS(
mkql_engine_flat_host_ut.cpp
mkql_engine_flat_ut.cpp
diff --git a/ydb/core/erasure/ut/ya.make b/ydb/core/erasure/ut/ya.make
index 549ac7f8969..47bb0c66373 100644
--- a/ydb/core/erasure/ut/ya.make
+++ b/ydb/core/erasure/ut/ya.make
@@ -4,14 +4,14 @@ FORK_SUBTESTS()
SPLIT_FACTOR(30)
IF (WITH_VALGRIND)
- TIMEOUT(1800)
+ TIMEOUT(1800)
SIZE(LARGE)
TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
OWNER(ddoarn cthulhu fomichev g:kikimr)
PEERDIR(
diff --git a/ydb/core/keyvalue/keyvalue_state.cpp b/ydb/core/keyvalue/keyvalue_state.cpp
index 6b31c463f83..87de1c257dc 100644
--- a/ydb/core/keyvalue/keyvalue_state.cpp
+++ b/ydb/core/keyvalue/keyvalue_state.cpp
@@ -796,7 +796,7 @@ void TKeyValueState::RequestExecute(THolder<TIntermediate> &intermediate, ISimpl
str << " Generation mismatch! Requested# " << intermediate->Generation;
str << " Actual# " << StoredState.GetUserGeneration();
str << " Marker# KV17";
- LOG_INFO_S(ctx, NKikimrServices::KEYVALUE, str.Str());
+ LOG_INFO_S(ctx, NKikimrServices::KEYVALUE, str.Str());
// All reads done
intermediate->Response.SetStatus(NMsgBusProxy::MSTATUS_REJECTED);
intermediate->Response.SetErrorReason(str.Str());
@@ -827,7 +827,7 @@ void TKeyValueState::RequestExecute(THolder<TIntermediate> &intermediate, ISimpl
str << " Writes# " << intermediate->Writes.size();
str << " GetStatuses# " << intermediate->GetStatuses.size();
str << " CopyRanges# " << intermediate->CopyRanges.size();
- LOG_INFO_S(ctx, NKikimrServices::KEYVALUE, str.Str());
+ LOG_INFO_S(ctx, NKikimrServices::KEYVALUE, str.Str());
// All reads done
intermediate->Response.SetStatus(NMsgBusProxy::MSTATUS_INTERNALERROR);
intermediate->Response.SetErrorReason(str.Str());
@@ -2536,7 +2536,7 @@ TPrepareResult TKeyValueState::PrepareCommands(NKikimrKeyValue::ExecuteTransacti
void TKeyValueState::ReplyError(const TActorContext &ctx, TString errorDescription,
NMsgBusProxy::EResponseStatus status, THolder<TIntermediate> &intermediate,
const TTabletStorageInfo *info) {
- LOG_INFO_S(ctx, NKikimrServices::KEYVALUE, errorDescription);
+ LOG_INFO_S(ctx, NKikimrServices::KEYVALUE, errorDescription);
Y_VERIFY(!intermediate->IsReplied);
THolder<TEvKeyValue::TEvResponse> response(new TEvKeyValue::TEvResponse);
if (intermediate->HasCookie) {
diff --git a/ydb/core/keyvalue/ut/ya.make b/ydb/core/keyvalue/ut/ya.make
index 7124f2ccf87..d3dbb708c06 100644
--- a/ydb/core/keyvalue/ut/ya.make
+++ b/ydb/core/keyvalue/ut/ya.make
@@ -8,16 +8,16 @@ OWNER(
FORK_SUBTESTS()
IF (WITH_VALGRIND OR SANITIZER_TYPE)
- TIMEOUT(1800)
+ TIMEOUT(1800)
SIZE(LARGE)
SPLIT_FACTOR(20)
TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
SPLIT_FACTOR(10)
-ENDIF()
-
+ENDIF()
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/mind/hive/hive.h b/ydb/core/mind/hive/hive.h
index cce565aecd6..25c6e837d4e 100644
--- a/ydb/core/mind/hive/hive.h
+++ b/ydb/core/mind/hive/hive.h
@@ -101,7 +101,7 @@ inline std::tuple<ResourceTypes...> GetStDev(const TVector<std::tuple<ResourceTy
}
class THive;
-
+
struct THiveSharedSettings {
NKikimrConfig::THiveConfig CurrentConfig;
diff --git a/ydb/core/mind/hive/hive_ut.cpp b/ydb/core/mind/hive/hive_ut.cpp
index 0383d49a123..fbbee83da5c 100644
--- a/ydb/core/mind/hive/hive_ut.cpp
+++ b/ydb/core/mind/hive/hive_ut.cpp
@@ -27,7 +27,7 @@
#include <util/stream/null.h>
#include <util/string/printf.h>
#include <util/string/subst.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
#include <google/protobuf/text_format.h>
#include <library/cpp/testing/unittest/registar.h>
@@ -408,17 +408,17 @@ namespace {
void FormatPDiskForTest(TString path, ui64 diskSize, ui32 chunkSize, ui64 guid,
TIntrusivePtr<NPDisk::TSectorMap> sectorMap) {
- NPDisk::TKey chunkKey;
- NPDisk::TKey logKey;
- NPDisk::TKey sysLogKey;
- EntropyPool().Read(&chunkKey, sizeof(NKikimr::NPDisk::TKey));
- EntropyPool().Read(&logKey, sizeof(NKikimr::NPDisk::TKey));
- EntropyPool().Read(&sysLogKey, sizeof(NKikimr::NPDisk::TKey));
-
- NKikimr::FormatPDisk(path, diskSize, 4 << 10, chunkSize, guid,
+ NPDisk::TKey chunkKey;
+ NPDisk::TKey logKey;
+ NPDisk::TKey sysLogKey;
+ EntropyPool().Read(&chunkKey, sizeof(NKikimr::NPDisk::TKey));
+ EntropyPool().Read(&logKey, sizeof(NKikimr::NPDisk::TKey));
+ EntropyPool().Read(&sysLogKey, sizeof(NKikimr::NPDisk::TKey));
+
+ NKikimr::FormatPDisk(path, diskSize, 4 << 10, chunkSize, guid,
chunkKey, logKey, sysLogKey, NPDisk::YdbDefaultPDiskSequence, "", false, false, sectorMap);
-}
-
+}
+
void InitSchemeRoot(TTestBasicRuntime& runtime, const TActorId& sender) {
auto evTx = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>(1, TTestTxConfig::SchemeShard);
auto transaction = evTx->Record.AddTransaction();
@@ -473,22 +473,22 @@ Y_UNIT_TEST_SUITE(THiveTest) {
return st_dev;
}
- template <typename KeyType, typename ValueType>
+ template <typename KeyType, typename ValueType>
static ValueType GetMinMaxDiff(const THashMap<KeyType, ValueType>& values) {
- ValueType minVal = std::numeric_limits<ValueType>::max();
- ValueType maxVal = std::numeric_limits<ValueType>::min();
-
- if (values.empty()) {
- return std::numeric_limits<ValueType>::max();
- }
-
- for (const auto& v : values) {
- minVal = std::min(minVal, v.second);
- maxVal = std::max(maxVal, v.second);
- }
- return maxVal - minVal;
- }
-
+ ValueType minVal = std::numeric_limits<ValueType>::max();
+ ValueType maxVal = std::numeric_limits<ValueType>::min();
+
+ if (values.empty()) {
+ return std::numeric_limits<ValueType>::max();
+ }
+
+ for (const auto& v : values) {
+ minVal = std::min(minVal, v.second);
+ maxVal = std::max(maxVal, v.second);
+ }
+ return maxVal - minVal;
+ }
+
void SendToLocal(TTestActorRuntime &runtime, ui32 nodeIndex, IEventBase* event) {
TActorId local = MakeLocalID(runtime.GetNodeId(nodeIndex));
runtime.Send(new IEventHandle(local, TActorId(), event), nodeIndex);
@@ -2878,7 +2878,7 @@ Y_UNIT_TEST_SUITE(THiveTest) {
static const int NUM_TABLETS = NUM_NODES * 3;
TTestBasicRuntime runtime(NUM_NODES, false);
Setup(runtime, true);
- const int nodeBase = runtime.GetNodeId(0);
+ const int nodeBase = runtime.GetNodeId(0);
TActorId senderA = runtime.AllocateEdgeActor();
const ui64 hiveTablet = MakeDefaultHiveID(0);
const ui64 testerTablet = MakeDefaultHiveID(1);
@@ -2924,8 +2924,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
}
}
auto mmElements = std::minmax_element(nodeTablets.begin(), nodeTablets.end());
- UNIT_ASSERT_VALUES_EQUAL(mmElements.first, nodeTablets.begin());
- UNIT_ASSERT_VALUES_EQUAL(mmElements.second, nodeTablets.end() - 1);
+ UNIT_ASSERT_VALUES_EQUAL(mmElements.first, nodeTablets.begin());
+ UNIT_ASSERT_VALUES_EQUAL(mmElements.second, nodeTablets.end() - 1);
}
THashMap<ui64, ui64> tabletMetrics;
@@ -2971,8 +2971,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
}
}
auto mmElements = std::minmax_element(nodeTablets.begin(), nodeTablets.end());
- UNIT_ASSERT_VALUES_EQUAL(1, *mmElements.first);
- UNIT_ASSERT_VALUES_EQUAL(7, *mmElements.second);
+ UNIT_ASSERT_VALUES_EQUAL(1, *mmElements.first);
+ UNIT_ASSERT_VALUES_EQUAL(7, *mmElements.second);
}
// creating NUM_TABLETS more tablets (with empty metrics)
diff --git a/ydb/core/mind/hive/ut/ya.make b/ydb/core/mind/hive/ut/ya.make
index e5f2423eafa..0d714efb924 100644
--- a/ydb/core/mind/hive/ut/ya.make
+++ b/ydb/core/mind/hive/ut/ya.make
@@ -11,7 +11,7 @@ FORK_SUBTESTS()
TIMEOUT(600)
SIZE(MEDIUM)
-
+
PEERDIR(
library/cpp/getopt
library/cpp/svnversion
diff --git a/ydb/core/mind/ut/ya.make b/ydb/core/mind/ut/ya.make
index 26e6412fc74..979a1cdcf31 100644
--- a/ydb/core/mind/ut/ya.make
+++ b/ydb/core/mind/ut/ya.make
@@ -17,16 +17,16 @@ IF (SANITIZER_TYPE OR WITH_VALGRIND)
cpu:4
ram:32
)
-ELSE()
+ELSE()
SPLIT_FACTOR(80)
- TIMEOUT(600)
- SIZE(MEDIUM)
+ TIMEOUT(600)
+ SIZE(MEDIUM)
REQUIREMENTS(
cpu:4
ram:16
)
-ENDIF()
-
+ENDIF()
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp b/ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp
index 011f03d93cd..283361db2f0 100644
--- a/ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp
+++ b/ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp
@@ -57,7 +57,7 @@ do { \
} while(false)
-static bool IsVerbose = true;
+static bool IsVerbose = true;
static yexception LastException;
diff --git a/ydb/core/mind/ut_fat/ya.make b/ydb/core/mind/ut_fat/ya.make
index 77d6d68dd0c..56a945f8e9a 100644
--- a/ydb/core/mind/ut_fat/ya.make
+++ b/ydb/core/mind/ut_fat/ya.make
@@ -1,18 +1,18 @@
UNITTEST_FOR(ydb/core/mind)
-
+
OWNER(
ddoarn
fomichev
g:kikimr
)
-
-FORK_SUBTESTS()
+
+FORK_SUBTESTS()
SIZE(MEDIUM)
TIMEOUT(600)
-
-PEERDIR(
+
+PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
library/cpp/svnversion
@@ -23,12 +23,12 @@ PEERDIR(
ydb/core/blobstorage/pdisk
ydb/core/blobstorage/vdisk/common
ydb/core/testlib
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- blobstorage_node_warden_ut_fat.cpp
-)
-
-END()
+SRCS(
+ blobstorage_node_warden_ut_fat.cpp
+)
+
+END()
diff --git a/ydb/core/persqueue/partition.cpp b/ydb/core/persqueue/partition.cpp
index cc8e2419cf2..6196696f8ce 100644
--- a/ydb/core/persqueue/partition.cpp
+++ b/ydb/core/persqueue/partition.cpp
@@ -536,11 +536,11 @@ void TPartition::HandleMonitoring(TEvPQ::TEvMonRequest::TPtr& ev, const TActorCo
}
TStringStream out;
out << "Partition " << i32(Partition) << ": " << str; res.push_back(out.Str()); out.Clear();
- if (DiskIsFull) {
- out << "DISK IS FULL";
- res.push_back(out.Str());
- out.Clear();
- }
+ if (DiskIsFull) {
+ out << "DISK IS FULL";
+ res.push_back(out.Str());
+ out.Clear();
+ }
out << "StartOffset: " << StartOffset; res.push_back(out.Str()); out.Clear();
out << "EndOffset: " << EndOffset; res.push_back(out.Str()); out.Clear();
out << "CreationTime: " << CreationTime.ToStringLocalUpToSeconds(); res.push_back(out.Str()); out.Clear();
diff --git a/ydb/core/persqueue/pq_ut.cpp b/ydb/core/persqueue/pq_ut.cpp
index 13a61229105..dc4bea2b09c 100644
--- a/ydb/core/persqueue/pq_ut.cpp
+++ b/ydb/core/persqueue/pq_ut.cpp
@@ -10,15 +10,15 @@
#include <ydb/core/persqueue/partition.h>
#include <ydb/core/engine/minikql/flat_local_tx_factory.h>
#include <ydb/core/security/ticket_parser.h>
-
+
#include <ydb/core/testlib/fake_scheme_shard.h>
#include <ydb/core/testlib/tablet_helpers.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
-#include <util/system/sanitizers.h>
-#include <util/system/valgrind.h>
-
+#include <util/system/sanitizers.h>
+#include <util/system/valgrind.h>
+
namespace NKikimr {
Y_UNIT_TEST_SUITE(TPQTest) {
@@ -1126,7 +1126,7 @@ Y_UNIT_TEST(TestWritePQ) {
PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user", true}}, tc); //important client, lifetimeseconds=0 - never delete
TVector<std::pair<ui64, TString>> data, data1, data2;
- activeZone = PlainOrSoSlow(true, false);
+ activeZone = PlainOrSoSlow(true, false);
TString ss{1024*1024, '_'};
TString s1{131072, 'a'};
@@ -1190,7 +1190,7 @@ Y_UNIT_TEST(TestWritePQ) {
data1.clear();
data1.push_back({1, TString{200, 'a'}});
- for (ui32 i = 1; i <= NUM_WRITES; ++i) {
+ for (ui32 i = 1; i <= NUM_WRITES; ++i) {
data1.front().first = i;
CmdWrite(1, "sourceidx", data1, tc, false, {}, false, "", -1);
}
@@ -1334,8 +1334,8 @@ Y_UNIT_TEST(TestWriteSplit) {
const ui32 size = PlainOrSoSlow(2*1024*1024, 1*1024*1024);
TVector<std::pair<ui64, TString>> data;
- data.push_back({1, TString{size, 'b'}});
- data.push_back({2, TString{size, 'a'}});
+ data.push_back({1, TString{size, 'b'}});
+ data.push_back({2, TString{size, 'a'}});
activeZone = PlainOrSoSlow(true, false);
CmdWrite(0, "sourceIdx", data, tc, false, {}, false, "", -1, 40000);
RestartTablet(tc);
@@ -1395,7 +1395,7 @@ Y_UNIT_TEST(TestWriteToFullPartition) {
PQTabletPrepare(11, 100 * 1024 * 1024, 0, {}, tc);
TVector<std::pair<ui64, TString>> data;
- activeZone = PlainOrSoSlow(true, false);
+ activeZone = PlainOrSoSlow(true, false);
TString s{32, 'c'};
ui32 pp = 8 + 4 + 2 + 9;
@@ -1628,7 +1628,7 @@ Y_UNIT_TEST(TestSetClientOffset) {
CmdSetOffset(0, "user1", 100, false, tc); //must be true , error
CmdGetOffset(0, "user1", 0, tc); // must be -1
- activeZone = PlainOrSoSlow(true, false);
+ activeZone = PlainOrSoSlow(true, false);
CmdSetOffset(0, "user1", 0, false, tc);
CmdGetOffset(0, "user1", 0, tc);
@@ -1658,7 +1658,7 @@ Y_UNIT_TEST(TestReadSessions) {
CmdSetOffset(0, "user1", 0, false, tc, "session1"); //all ok - session is set
CmdSetOffset(0, "user1", 0, true, tc, "other_session"); //fails - session1 is active
- activeZone = PlainOrSoSlow(true, false);
+ activeZone = PlainOrSoSlow(true, false);
CmdSetOffset(0, "user1", 0, false, tc, "session1");
diff --git a/ydb/core/persqueue/ut/ya.make b/ydb/core/persqueue/ut/ya.make
index 7cbb0b94960..90d39c77047 100644
--- a/ydb/core/persqueue/ut/ya.make
+++ b/ydb/core/persqueue/ut/ya.make
@@ -18,7 +18,7 @@ ELSE()
SIZE(MEDIUM)
TIMEOUT(600)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/protos/blobstorage_vdisk_config.proto b/ydb/core/protos/blobstorage_vdisk_config.proto
index 5b800c1cf65..2445e6c44ae 100644
--- a/ydb/core/protos/blobstorage_vdisk_config.proto
+++ b/ydb/core/protos/blobstorage_vdisk_config.proto
@@ -38,8 +38,8 @@ message TVDiskKind {
LocalMode = 11;
Extra2 = 22;
Extra3 = 23;
- Extra4 = 24;
- Extra5 = 25;
+ Extra4 = 24;
+ Extra5 = 25;
};
optional EVDiskKind Kind = 1;
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index d64169d4fc0..7b559896437 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -314,7 +314,7 @@ message TBootstrap {
SCHEMESHARD = 30;
DATASHARD = 31;
FLAT_SCHEMESHARD = 32;
- KEYVALUEFLAT = 33;
+ KEYVALUEFLAT = 33;
JOBRUNNER_POOL_MANAGER = 40;
FLAT_JOBRUNNER_POOL_MANAGER = 41;
@@ -536,7 +536,7 @@ message TMessageBusConfig {
message TTabletsConfig {
message TTablet {
- optional string Type = 1;
+ optional string Type = 1;
repeated uint32 Node = 2;
optional NKikimrTabletBase.TTabletStorageInfo Info = 3;
optional bool StandBy = 4;
@@ -547,7 +547,7 @@ message TTabletsConfig {
}
message TKQPConfig {
- optional bool Enable = 1 [default = true];
+ optional bool Enable = 1 [default = true];
repeated NKikimrKqp.TKqpSetting Settings = 10;
}
diff --git a/ydb/core/protos/counters.proto b/ydb/core/protos/counters.proto
index 05a8c93d905..74b1ad5b362 100644
--- a/ydb/core/protos/counters.proto
+++ b/ydb/core/protos/counters.proto
@@ -87,24 +87,24 @@ enum ETxTypeCumulativeCounters {
enum ETxTypePercentileCounters {
option (GlobalCounterOpts) = {
- Ranges { Value: 0 Name: "(1) < 500 us" }
- Ranges { Value: 500 Name: "(2) 0.5-1 ms" }
- Ranges { Value: 1000 Name: "(3) 1-2 ms" }
- Ranges { Value: 2000 Name: "(4) 2-4 ms" }
- Ranges { Value: 4000 Name: "(5) 4-8 ms" }
- Ranges { Value: 8000 Name: "(6) 8-16 ms" }
- Ranges { Value: 16000 Name: "(7) 16-32 ms" }
- Ranges { Value: 32000 Name: "(8) 32-64 ms" }
- Ranges { Value: 64000 Name: "(9) 64-128 ms" }
- Ranges { Value: 128000 Name: "(10) 128-256 ms" }
- Ranges { Value: 256000 Name: "(11) 256-512 ms" }
- Ranges { Value: 512000 Name: "(12) 512-1024 ms" }
- Ranges { Value: 1024000 Name: "(13) 1024-2000 ms" }
- Ranges { Value: 2000000 Name: "(14) 2-4 s" }
- Ranges { Value: 4000000 Name: "(15) 4-8 s" }
- Ranges { Value: 8000000 Name: "(16) 8-16 s" }
- Ranges { Value: 16000000 Name: "(17) 16-32 s" }
- Ranges { Value: 32000000 Name: "(18) 32 < s" }
+ Ranges { Value: 0 Name: "(1) < 500 us" }
+ Ranges { Value: 500 Name: "(2) 0.5-1 ms" }
+ Ranges { Value: 1000 Name: "(3) 1-2 ms" }
+ Ranges { Value: 2000 Name: "(4) 2-4 ms" }
+ Ranges { Value: 4000 Name: "(5) 4-8 ms" }
+ Ranges { Value: 8000 Name: "(6) 8-16 ms" }
+ Ranges { Value: 16000 Name: "(7) 16-32 ms" }
+ Ranges { Value: 32000 Name: "(8) 32-64 ms" }
+ Ranges { Value: 64000 Name: "(9) 64-128 ms" }
+ Ranges { Value: 128000 Name: "(10) 128-256 ms" }
+ Ranges { Value: 256000 Name: "(11) 256-512 ms" }
+ Ranges { Value: 512000 Name: "(12) 512-1024 ms" }
+ Ranges { Value: 1024000 Name: "(13) 1024-2000 ms" }
+ Ranges { Value: 2000000 Name: "(14) 2-4 s" }
+ Ranges { Value: 4000000 Name: "(15) 4-8 s" }
+ Ranges { Value: 8000000 Name: "(16) 8-16 s" }
+ Ranges { Value: 16000000 Name: "(17) 16-32 s" }
+ Ranges { Value: 32000000 Name: "(18) 32 < s" }
};
COUNTER_TT_PERCENTILE_IGNORE = 0;
diff --git a/ydb/core/protos/flat_scheme_op.proto b/ydb/core/protos/flat_scheme_op.proto
index 33e598c1c25..83815a72ada 100644
--- a/ydb/core/protos/flat_scheme_op.proto
+++ b/ydb/core/protos/flat_scheme_op.proto
@@ -894,7 +894,7 @@ message TPersQueueGroupDescription {
optional NKikimrPQ.TPartitionKeyRange KeyRange = 3;
}
- optional string Name = 1; // mandatory
+ optional string Name = 1; // mandatory
optional uint64 PathId = 2;
optional uint32 TotalGroupCount = 3; // mandatory
message TPartitionToAdd {
@@ -904,9 +904,9 @@ message TPersQueueGroupDescription {
repeated TPartitionToAdd PartitionsToAdd = 9;
repeated uint32 PartitionsToDelete = 10;
optional uint32 NextPartitionId = 11;
- optional uint32 PartitionPerTablet = 4; // default = 10
- optional NKikimrPQ.TPQTabletConfig PQTabletConfig = 5; // mandatory
- repeated TPartition Partitions = 6; // do not set
+ optional uint32 PartitionPerTablet = 4; // default = 10
+ optional NKikimrPQ.TPQTabletConfig PQTabletConfig = 5; // mandatory
+ repeated TPartition Partitions = 6; // do not set
optional uint64 AlterVersion = 7;
optional uint64 BalancerTabletID = 8;
diff --git a/ydb/core/protos/msgbus.proto b/ydb/core/protos/msgbus.proto
index df7cda59800..54118d78032 100644
--- a/ydb/core/protos/msgbus.proto
+++ b/ydb/core/protos/msgbus.proto
@@ -28,25 +28,25 @@ import "ydb/public/api/protos/ydb_issue_message.proto";
import "ydb/library/mkql_proto/protos/minikql.proto";
import "google/protobuf/descriptor.proto";
-
+
package NKikimrClient;
option java_package = "ru.yandex.kikimr.proto";
-message TEnumValueHint {
- message TEntry {
- optional uint64 Value = 1;
- optional string Name = 2;
- optional string Man = 3;
- }
-
- repeated TEntry Hints = 1;
-}
-
-extend google.protobuf.FieldOptions {
- optional TEnumValueHint EnumValueHint = 70001;
- optional string CommonDescription = 70002;
-}
-
+message TEnumValueHint {
+ message TEntry {
+ optional uint64 Value = 1;
+ optional string Name = 2;
+ optional string Man = 3;
+ }
+
+ repeated TEntry Hints = 1;
+}
+
+extend google.protobuf.FieldOptions {
+ optional TEnumValueHint EnumValueHint = 70001;
+ optional string CommonDescription = 70002;
+}
+
message TMsgBusRequestBase {
optional uint32 ServerTimeoutMs = 1;
}
@@ -63,7 +63,7 @@ message TFlatTxId {
optional fixed64 SchemeShardTabletId = 2;
optional uint64 PathId = 3;
};
-
+
message TResolveNodeResponse {
optional string Host = 1;
optional uint32 NodeId = 2;
@@ -71,92 +71,92 @@ message TResolveNodeResponse {
// must start from TResponseBase
message TResponse {
- optional uint32 Status = 1 [
- (CommonDescription) = "Generic msgbus status",
- (EnumValueHint) = { Hints : [
- {Value: 0 Name: "MSTATUS_UNKNOWN" Man: "Status unknown, must not be seen" },
- {Value: 1 Name: "MSTATUS_OK" Man: "Request complete with full success" },
- {Value: 128 Name: "MSTATUS_ERROR" Man: "Request failed because of client-side error" },
- {Value: 129 Name: "MSTATUS_INPROGRESS" Man: "Request accepted and in progress" },
- {Value: 130 Name: "MSTATUS_TIMEOUT" Man: "Request failed due to timeout, exact status unknown" },
- {Value: 131 Name: "MSTATUS_NOTREADY" Man: "Not yet ready to process requests, try later" },
- {Value: 132 Name: "MSTATUS_ABORTED" Man: "Request aborted, particular meaning depends on context" },
- {Value: 133 Name: "MSTATUS_INTERNALERROR" Man: "Something unexpected happend on server-side" },
- {Value: 134 Name: "MSTATUS_REJECTED" Man: "Request rejected for now, try later" }
- ]}
+ optional uint32 Status = 1 [
+ (CommonDescription) = "Generic msgbus status",
+ (EnumValueHint) = { Hints : [
+ {Value: 0 Name: "MSTATUS_UNKNOWN" Man: "Status unknown, must not be seen" },
+ {Value: 1 Name: "MSTATUS_OK" Man: "Request complete with full success" },
+ {Value: 128 Name: "MSTATUS_ERROR" Man: "Request failed because of client-side error" },
+ {Value: 129 Name: "MSTATUS_INPROGRESS" Man: "Request accepted and in progress" },
+ {Value: 130 Name: "MSTATUS_TIMEOUT" Man: "Request failed due to timeout, exact status unknown" },
+ {Value: 131 Name: "MSTATUS_NOTREADY" Man: "Not yet ready to process requests, try later" },
+ {Value: 132 Name: "MSTATUS_ABORTED" Man: "Request aborted, particular meaning depends on context" },
+ {Value: 133 Name: "MSTATUS_INTERNALERROR" Man: "Something unexpected happend on server-side" },
+ {Value: 134 Name: "MSTATUS_REJECTED" Man: "Request rejected for now, try later" }
+ ]}
]; // EResponseStatus from ydb/core/client/base/msgbus.h
-
+
optional string ErrorReason = 400; // When present contains human-readable error description (aka ProtobufError)
optional fixed64 TxId = 2;
optional fixed64 Step = 3;
optional fixed64 TabletId = 4;
-
- optional uint32 ProxyErrorCode = 5 [
- (CommonDescription) = "Transaction proxy processing status",
- (EnumValueHint) = { Hints : [
- {Value: 0 Name: "Unknown" Man: "Status unknown, must not be seen" },
+
+ optional uint32 ProxyErrorCode = 5 [
+ (CommonDescription) = "Transaction proxy processing status",
+ (EnumValueHint) = { Hints : [
+ {Value: 0 Name: "Unknown" Man: "Status unknown, must not be seen" },
{Value: 1 Name: "WrongRequest" Man: "Not recognized or erroneous request, see error description fields for possible details" },
- {Value: 2 Name: "EmptyAffectedSet" Man: "Program must touch at least one shard but touches none" },
- {Value: 3 Name: "NotImplemented" Man: "Not yet implemented feature requested" },
- {Value: 4 Name: "ResolveError" Man: "Some keys not resolved, see UnresolvedKeys for details" },
+ {Value: 2 Name: "EmptyAffectedSet" Man: "Program must touch at least one shard but touches none" },
+ {Value: 3 Name: "NotImplemented" Man: "Not yet implemented feature requested" },
+ {Value: 4 Name: "ResolveError" Man: "Some keys not resolved, see UnresolvedKeys for details" },
{Value: 5 Name: "AccessDenied" Man: "Access denied for request" },
{Value: 6 Name: "DomainLocalityError" Man: "Cross database transactions not allowed"},
{Value: 16 Name: "ProxyNotReady" Man: "Transaction proxy not ready for handling requests, try later. Most known case is temporary lack of txid-s" },
- {Value: 17 Name: "ProxyAccepted" Man: "Request accepted by proxy. Transitional status" },
- {Value: 18 Name: "ProxyResolved" Man: "Request keys resolved to datashards. Transitional status" },
- {Value: 19 Name: "ProxyPrepared" Man: "Request fragmets prepared on datashards. Transitional status" },
- {Value: 20 Name: "ProxyShardNotAvailable" Man: "One or more of affected datashards not available, request execution cancelled" },
- {Value: 21 Name: "ProxyShardTryLater" Man: "One or more of affected datashards are starting, try again" },
- {Value: 22 Name: "ProxyShardOverloaded" Man: "One or more of affected datashards are overloaded, try again" },
+ {Value: 17 Name: "ProxyAccepted" Man: "Request accepted by proxy. Transitional status" },
+ {Value: 18 Name: "ProxyResolved" Man: "Request keys resolved to datashards. Transitional status" },
+ {Value: 19 Name: "ProxyPrepared" Man: "Request fragmets prepared on datashards. Transitional status" },
+ {Value: 20 Name: "ProxyShardNotAvailable" Man: "One or more of affected datashards not available, request execution cancelled" },
+ {Value: 21 Name: "ProxyShardTryLater" Man: "One or more of affected datashards are starting, try again" },
+ {Value: 22 Name: "ProxyShardOverloaded" Man: "One or more of affected datashards are overloaded, try again" },
{Value: 23 Name: "ProxyShardUnknown" Man: "State of transaction on one or more datashards is unknown" },
- {Value: 32 Name: "CoordinatorDeclined" Man: "Coordinator declines to plan transaction, try again" },
- {Value: 33 Name: "CoordinatorOutdated" Man: "Coordinator was not able to plan transaction due to timing restrictions, try again" },
- {Value: 34 Name: "CoordinatorAborted" Man: "Transaction aborted by coordinator" },
- {Value: 35 Name: "CoordinatorPlanned" Man: "Transaction planned for execution by coordinator. Transitional status" },
- {Value: 36 Name: "CoordinatorUnknown" Man: "Could not reach coordinator or coordinator pipe dropped before confirmation. Transaction status unknown" },
- {Value: 48 Name: "ExecComplete" Man: "Success" },
- {Value: 49 Name: "ExecAlready" Man: "Requested operation already applied" },
- {Value: 50 Name: "ExecAborted" Man: "Request aborted, particular meaning depends on context" },
- {Value: 51 Name: "ExecTimeout" Man: "Proxy got no execution reply in timeout period" },
- {Value: 52 Name: "ExecError" Man: "Execution failed" },
+ {Value: 32 Name: "CoordinatorDeclined" Man: "Coordinator declines to plan transaction, try again" },
+ {Value: 33 Name: "CoordinatorOutdated" Man: "Coordinator was not able to plan transaction due to timing restrictions, try again" },
+ {Value: 34 Name: "CoordinatorAborted" Man: "Transaction aborted by coordinator" },
+ {Value: 35 Name: "CoordinatorPlanned" Man: "Transaction planned for execution by coordinator. Transitional status" },
+ {Value: 36 Name: "CoordinatorUnknown" Man: "Could not reach coordinator or coordinator pipe dropped before confirmation. Transaction status unknown" },
+ {Value: 48 Name: "ExecComplete" Man: "Success" },
+ {Value: 49 Name: "ExecAlready" Man: "Requested operation already applied" },
+ {Value: 50 Name: "ExecAborted" Man: "Request aborted, particular meaning depends on context" },
+ {Value: 51 Name: "ExecTimeout" Man: "Proxy got no execution reply in timeout period" },
+ {Value: 52 Name: "ExecError" Man: "Execution failed" },
{Value: 53 Name: "ExecInProgress" Man: "Request accepted and now runs" },
{Value: 55 Name: "ExecResultUnavailable" Man: "Execution results unavailable" },
{Value: 56 Name: "ExecCancelled" Man: "Execution was cancelled" }
- ]}
- ]; // see tx_proxy.h - TResultStatus::EStatus
-
+ ]}
+ ]; // see tx_proxy.h - TResultStatus::EStatus
+
optional bytes ProxyErrors = 6;
optional NKikimrIssues.TStatusIds.EStatusCode StatusCode = 7;
repeated Ydb.Issue.IssueMessage Issues = 8;
- optional uint32 ExecutionEngineStatus = 100 [
- (CommonDescription) = "MiniKQL engine processing status, if OK - see ExecutionEngineResponseStatus",
- (EnumValueHint) = { Hints : [
- {Value: 0 Name: "Unknown" Man: "Status unknown, not filled probably" },
- {Value: 1 Name: "Ok" Man: "Success" },
- {Value: 2 Name: "SchemeChanged" Man: "Scheme or partitioning was changed b/w compilation and preparation" },
- {Value: 3 Name: "IsReadonly" Man: "Update requested in read-only operation" },
- {Value: 4 Name: "KeyError" Man: "Something wrong in data keys" },
- {Value: 5 Name: "ProgramError" Man: "Malformed program" },
- {Value: 6 Name: "TooManyShards" Man: "Too much datashards affected program" },
- {Value: 7 Name: "TooManyData" Man: "Too much data affected by program" },
- {Value: 8 Name: "SnapshotNotExist" Man: "Requested snapshot not exist" },
- {Value: 9 Name: "SnapshotNotReady" Man: "Snapshot not online" }
- ]}
- ]; // Last operation status: see NMiniKql::IEngine::EResult.
-
- optional uint32 ExecutionEngineResponseStatus = 101 [
- (CommonDescription) = "MiniKQL engine execution status",
- (EnumValueHint) = { Hints : [
- {Value: 0 Name: "Unknown" Man: "Status unknown, not filled probably" },
- {Value: 1 Name: "Error" Man: "Error" },
- {Value: 2 Name: "Complete" Man: "Complete with success" },
- {Value: 3 Name: "Abort" Man: "Complete with abort" }
- ]}
- ]; // Program "exit code": see NMiniKQL::IEngine::EStatus.
-
+ optional uint32 ExecutionEngineStatus = 100 [
+ (CommonDescription) = "MiniKQL engine processing status, if OK - see ExecutionEngineResponseStatus",
+ (EnumValueHint) = { Hints : [
+ {Value: 0 Name: "Unknown" Man: "Status unknown, not filled probably" },
+ {Value: 1 Name: "Ok" Man: "Success" },
+ {Value: 2 Name: "SchemeChanged" Man: "Scheme or partitioning was changed b/w compilation and preparation" },
+ {Value: 3 Name: "IsReadonly" Man: "Update requested in read-only operation" },
+ {Value: 4 Name: "KeyError" Man: "Something wrong in data keys" },
+ {Value: 5 Name: "ProgramError" Man: "Malformed program" },
+ {Value: 6 Name: "TooManyShards" Man: "Too much datashards affected program" },
+ {Value: 7 Name: "TooManyData" Man: "Too much data affected by program" },
+ {Value: 8 Name: "SnapshotNotExist" Man: "Requested snapshot not exist" },
+ {Value: 9 Name: "SnapshotNotReady" Man: "Snapshot not online" }
+ ]}
+ ]; // Last operation status: see NMiniKql::IEngine::EResult.
+
+ optional uint32 ExecutionEngineResponseStatus = 101 [
+ (CommonDescription) = "MiniKQL engine execution status",
+ (EnumValueHint) = { Hints : [
+ {Value: 0 Name: "Unknown" Man: "Status unknown, not filled probably" },
+ {Value: 1 Name: "Error" Man: "Error" },
+ {Value: 2 Name: "Complete" Man: "Complete with success" },
+ {Value: 3 Name: "Abort" Man: "Complete with abort" }
+ ]}
+ ]; // Program "exit code": see NMiniKQL::IEngine::EStatus.
+
optional NKikimrMiniKQL.TResult ExecutionEngineEvaluatedResponse = 103;
optional bytes MiniKQLErrors = 104;
diff --git a/ydb/core/protos/tx_proxy.proto b/ydb/core/protos/tx_proxy.proto
index dedd2f9cbb5..601915eaccd 100644
--- a/ydb/core/protos/tx_proxy.proto
+++ b/ydb/core/protos/tx_proxy.proto
@@ -151,7 +151,7 @@ message TMiniKQLTransaction {
optional bool EvaluateResultType = 50 [default = true];
optional bool EvaluateResultValue = 51 [default = true];
- optional bool FlatMKQL = 52 [default = true];
+ optional bool FlatMKQL = 52 [default = true];
optional bool LlvmRuntime = 53;
optional uint64 PerShardKeysSizeLimitBytes = 54;
optional bool CollectStats = 55;
diff --git a/ydb/core/tablet/tablet_pipe_ut.cpp b/ydb/core/tablet/tablet_pipe_ut.cpp
index 2a528070fb6..2c6305f23d3 100644
--- a/ydb/core/tablet/tablet_pipe_ut.cpp
+++ b/ydb/core/tablet/tablet_pipe_ut.cpp
@@ -265,8 +265,8 @@ namespace NKikimr {
void Handle(TEvents::TEvPing::TPtr &ev, const TActorContext &ctx) {
Cout << "Got ping\n";
- UNIT_ASSERT_VALUES_EQUAL(ev->GetRecipientRewrite(), ctx.SelfID);
- UNIT_ASSERT_VALUES_EQUAL(ev->Recipient, LastServerId);
+ UNIT_ASSERT_VALUES_EQUAL(ev->GetRecipientRewrite(), ctx.SelfID);
+ UNIT_ASSERT_VALUES_EQUAL(ev->Recipient, LastServerId);
ctx.Send(ev->Sender, new TEvents::TEvPong());
}
@@ -366,7 +366,7 @@ namespace NKikimr {
void Handle(TEvents::TEvPing::TPtr &ev, const TActorContext &ctx) {
Cout << "Got ping\n";
- UNIT_ASSERT_VALUES_EQUAL(ev->GetRecipientRewrite(), ctx.SelfID);
+ UNIT_ASSERT_VALUES_EQUAL(ev->GetRecipientRewrite(), ctx.SelfID);
ctx.Send(ev->Sender, new TEvents::TEvPong());
}
diff --git a/ydb/core/tablet/tablet_req_rebuildhistory.cpp b/ydb/core/tablet/tablet_req_rebuildhistory.cpp
index c0b4c0c2bc1..e3fa4f2e13d 100644
--- a/ydb/core/tablet/tablet_req_rebuildhistory.cpp
+++ b/ydb/core/tablet/tablet_req_rebuildhistory.cpp
@@ -585,7 +585,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
break; // must left as unchecked
default:
BLOG_ERROR("TTabletReqRebuildHistoryGraph::CheckReferences - blob " << response.Id
- << " Status# " << NKikimrProto::EReplyStatus_Name(response.Status));
+ << " Status# " << NKikimrProto::EReplyStatus_Name(response.Status));
if (IntrospectionTrace) {
IntrospectionTrace->Attach(MakeHolder<NTracing::TErrorUnknownStatus>(response.Status, msg->ErrorReason));
}
@@ -792,7 +792,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
case NKikimrProto::OK:
if (FollowerCookie == 0 && msg->Latest.Generation() > BlockedGen) {
BLOG_ERROR("TTabletReqRebuildHistoryGraph - Found entry beyond blocked generation"
- << " LastBlobID: " << msg->Latest.ToString() << ". Blocked: " << BlockedGen);
+ << " LastBlobID: " << msg->Latest.ToString() << ". Blocked: " << BlockedGen);
if (IntrospectionTrace) {
IntrospectionTrace->Attach(MakeHolder<NTracing::TErrorEntryBeyondBlocked>(msg->Latest, BlockedGen));
}
@@ -809,7 +809,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
return ReplyAndDie(msg->Status, msg->ErrorReason); // valid condition, nothing known in blob-storage
default:
BLOG_ERROR("TTabletReqRebuildHistoryGraph::Handle TEvFindLatestLogEntryResult"
- << " Status# " << NKikimrProto::EReplyStatus_Name(msg->Status));
+ << " Status# " << NKikimrProto::EReplyStatus_Name(msg->Status));
if (IntrospectionTrace) {
IntrospectionTrace->Attach(MakeHolder<NTracing::TErrorUnknownStatus>(msg->Status, msg->ErrorReason));
}
@@ -828,7 +828,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
return ReplyAndDie(NKikimrProto::RACE, msg->ErrorReason);
default:
BLOG_ERROR("TTabletReqRebuildHistoryGraph::HandleDiscover TEvRangeResult"
- << " Status# " << NKikimrProto::EReplyStatus_Name(msg->Status)
+ << " Status# " << NKikimrProto::EReplyStatus_Name(msg->Status)
<< " Result# " << msg->Print(false));
if (IntrospectionTrace) {
IntrospectionTrace->Attach(MakeHolder<NTracing::TErrorUnknownStatus>(msg->Status, msg->ErrorReason));
@@ -852,7 +852,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
return ReplyAndDie(NKikimrProto::RACE, msg->ErrorReason);
default:
BLOG_ERROR("TTabletReqRebuildHistoryGraph::Handle TEvGetResult"
- << " Status# " << NKikimrProto::EReplyStatus_Name(msg->Status)
+ << " Status# " << NKikimrProto::EReplyStatus_Name(msg->Status)
<< " Result# " << msg->Print(false));
if (IntrospectionTrace) {
IntrospectionTrace->Attach(MakeHolder<NTracing::TErrorUnknownStatus>(msg->Status, msg->ErrorReason));
diff --git a/ydb/core/tablet/ut/ya.make b/ydb/core/tablet/ut/ya.make
index 52440600e13..5f52b2ede80 100644
--- a/ydb/core/tablet/ut/ya.make
+++ b/ydb/core/tablet/ut/ya.make
@@ -1,18 +1,18 @@
UNITTEST_FOR(ydb/core/tablet)
-OWNER(
- vvvv
+OWNER(
+ vvvv
g:kikimr
-)
-
-FORK_SUBTESTS()
+)
+
+FORK_SUBTESTS()
-SIZE(MEDIUM)
+SIZE(MEDIUM)
TIMEOUT(600)
SPLIT_FACTOR(50)
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tablet_flat/flat_executor_database_ut.cpp b/ydb/core/tablet_flat/flat_executor_database_ut.cpp
index 0168615c55b..502f1ffa969 100644
--- a/ydb/core/tablet_flat/flat_executor_database_ut.cpp
+++ b/ydb/core/tablet_flat/flat_executor_database_ut.cpp
@@ -6,9 +6,9 @@
#include <library/cpp/testing/unittest/registar.h>
#include "flat_database.h"
-#include <util/system/sanitizers.h>
-#include <util/system/valgrind.h>
-
+#include <util/system/sanitizers.h>
+#include <util/system/valgrind.h>
+
namespace NKikimr {
namespace NTabletFlatExecutor {
@@ -17,8 +17,8 @@ using TDbWrapper = NTable::TDbWrapper;
using ITestDb = NTable::ITestDb;
const ui64 MaxActionCount = 12000;
-const ui64 MultiPageMaxActionCount = 10000;
-
+const ui64 MultiPageMaxActionCount = 10000;
+
class TFuzzyActor : public NFake::TNanny {
public:
explicit TFuzzyActor(ui32 lives, ui64 limit)
diff --git a/ydb/core/tablet_flat/flat_executor_txloglogic.cpp b/ydb/core/tablet_flat/flat_executor_txloglogic.cpp
index df59ddc2455..1920cd813cc 100644
--- a/ydb/core/tablet_flat/flat_executor_txloglogic.cpp
+++ b/ydb/core/tablet_flat/flat_executor_txloglogic.cpp
@@ -8,8 +8,8 @@
#include "logic_redo_queue.h"
#include "probes.h"
#include <ydb/core/tablet_flat/flat_executor.pb.h>
-#include <util/system/sanitizers.h>
-
+#include <util/system/sanitizers.h>
+
namespace NKikimr {
namespace NTabletFlatExecutor {
diff --git a/ydb/core/tablet_flat/tablet_flat_executed.cpp b/ydb/core/tablet_flat/tablet_flat_executed.cpp
index 4b3c15490c5..742f309ebf7 100644
--- a/ydb/core/tablet_flat/tablet_flat_executed.cpp
+++ b/ydb/core/tablet_flat/tablet_flat_executed.cpp
@@ -264,8 +264,8 @@ bool TTabletExecutedFlat::HandleDefaultEvents(STFUNC_SIG) {
return true;
}
-void TTabletExecutedFlat::StateInitImpl(STFUNC_SIG) {
- switch (ev->GetTypeRewrite()) {
+void TTabletExecutedFlat::StateInitImpl(STFUNC_SIG) {
+ switch (ev->GetTypeRewrite()) {
HFunc(TEvTablet::TEvBoot, Handle);
HFunc(TEvTablet::TEvFBoot, Handle);
hFunc(TEvTablet::TEvFUpdate, Handle);
@@ -277,9 +277,9 @@ void TTabletExecutedFlat::StateInitImpl(STFUNC_SIG) {
hFunc(TEvTablet::TEvFollowerSyncComplete, Handle);
hFunc(TEvTablet::TEvUpdateConfig, Handle);
HFunc(NMon::TEvRemoteHttpInfo, RenderHtmlPage);
- default:
- return Enqueue(ev, ctx);
- }
-}
+ default:
+ return Enqueue(ev, ctx);
+ }
+}
}}
diff --git a/ydb/core/tablet_flat/ut/ya.make b/ydb/core/tablet_flat/ut/ya.make
index fd66d042026..c3a08ad9de6 100644
--- a/ydb/core/tablet_flat/ut/ya.make
+++ b/ydb/core/tablet_flat/ut/ya.make
@@ -1,7 +1,7 @@
UNITTEST_FOR(ydb/core/tablet_flat)
FORK_SUBTESTS()
-
+
IF (WITH_VALGRIND)
TIMEOUT(2400)
TAG(ya:fat)
@@ -10,7 +10,7 @@ ELSE()
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
+
OWNER(g:kikimr)
SRCS(
diff --git a/ydb/core/testlib/actors/ut/ya.make b/ydb/core/testlib/actors/ut/ya.make
index 85a31fe740f..a498687655d 100644
--- a/ydb/core/testlib/actors/ut/ya.make
+++ b/ydb/core/testlib/actors/ut/ya.make
@@ -7,8 +7,8 @@ OWNER(
FORK_SUBTESTS()
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(300)
- SIZE(MEDIUM)
-ENDIF()
+ SIZE(MEDIUM)
+ENDIF()
PEERDIR(
library/cpp/getopt
diff --git a/ydb/core/testlib/tablet_helpers.cpp b/ydb/core/testlib/tablet_helpers.cpp
index a853040b932..c38a7cde388 100644
--- a/ydb/core/testlib/tablet_helpers.cpp
+++ b/ydb/core/testlib/tablet_helpers.cpp
@@ -35,7 +35,7 @@
#include <util/string/printf.h>
#include <util/string/subst.h>
#include <util/system/env.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
#include <library/cpp/actors/interconnect/interconnect.h>
#include <library/cpp/testing/unittest/registar.h>
@@ -54,7 +54,7 @@ const bool SUPPRESS_DELAYS = false;
const bool VARIATE_RANDOM_SEED = false;
const ui64 PQ_CACHE_MAX_SIZE_MB = 32;
const TDuration PQ_CACHE_KEEP_TIMEOUT = TDuration::Seconds(10);
-
+
static NActors::TTestActorRuntime& AsKikimrRuntime(NActors::TTestActorRuntimeBase& r) {
try {
return dynamic_cast<NActors::TTestBasicRuntime&>(r);
@@ -1044,7 +1044,7 @@ namespace NKikimr {
ui64 GetFreePDiskSize(TTestActorRuntime& runtime, const TActorId& sender) {
TActorId pdiskServiceId = MakeBlobStoragePDiskID(runtime.GetNodeId(0), 0);
- runtime.Send(new IEventHandle(pdiskServiceId, sender, nullptr));
+ runtime.Send(new IEventHandle(pdiskServiceId, sender, nullptr));
TAutoPtr<IEventHandle> handle;
auto event = runtime.GrabEdgeEvent<NMon::TEvHttpInfoRes>(handle);
UNIT_ASSERT(event);
diff --git a/ydb/core/testlib/test_client.cpp b/ydb/core/testlib/test_client.cpp
index d4907c26f1e..e91e47319f9 100644
--- a/ydb/core/testlib/test_client.cpp
+++ b/ydb/core/testlib/test_client.cpp
@@ -93,10 +93,10 @@
#include <library/cpp/grpc/server/actors/logger.h>
-#include <util/system/sanitizers.h>
-#include <util/system/valgrind.h>
+#include <util/system/sanitizers.h>
+#include <util/system/valgrind.h>
#include <util/system/env.h>
-
+
namespace NKikimr {
namespace Tests {
@@ -112,14 +112,14 @@ namespace Tests {
const char* ServerRedirectEnvVar = "KIKIMR_SERVER";
const char* DomainRedirectEnvVar = "KIKIMR_TEST_DOMAIN";
- const TDuration TIMEOUT = NSan::PlainOrUnderSanitizer(
- NValgrind::PlainOrUnderValgrind(TDuration::Seconds(3), TDuration::Seconds(60)),
- TDuration::Seconds(15)
- );
- const ui64 ConnectTimeoutMilliSeconds = NSan::PlainOrUnderSanitizer(
- NValgrind::PlainOrUnderValgrind(TDuration::Seconds(60), TDuration::Seconds(120)),
- TDuration::Seconds(120)
- ).MilliSeconds();
+ const TDuration TIMEOUT = NSan::PlainOrUnderSanitizer(
+ NValgrind::PlainOrUnderValgrind(TDuration::Seconds(3), TDuration::Seconds(60)),
+ TDuration::Seconds(15)
+ );
+ const ui64 ConnectTimeoutMilliSeconds = NSan::PlainOrUnderSanitizer(
+ NValgrind::PlainOrUnderValgrind(TDuration::Seconds(60), TDuration::Seconds(120)),
+ TDuration::Seconds(120)
+ ).MilliSeconds();
NMiniKQL::IFunctionRegistry* DefaultFrFactory(const NScheme::TTypeRegistry& typeRegistry) {
Y_UNUSED(typeRegistry);
@@ -912,7 +912,7 @@ namespace Tests {
ClientConfig.Ip = serverSetup.IpAddress;
ClientConfig.Port = serverSetup.Port;
ClientConfig.BusSessionConfig.TotalTimeout = Max<int>() / 2;
- ClientConfig.BusSessionConfig.ConnectTimeout = ConnectTimeoutMilliSeconds;
+ ClientConfig.BusSessionConfig.ConnectTimeout = ConnectTimeoutMilliSeconds;
ClientConfig.BusSessionConfig.NumRetries = 10;
Client.reset(new NMsgBusProxy::TMsgBusClient(ClientConfig));
Client->Init();
@@ -1918,7 +1918,7 @@ namespace Tests {
response.Swap(&static_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record);
break;
- }
+ }
UNIT_ASSERT(retryCnt > 0);
return response.GetStatus();
@@ -2021,7 +2021,7 @@ namespace Tests {
TString TClient::MarkNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx, bool up) {
ui32 nodeId = runtime->GetNodeId(nodeIdx);
ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
- TInstant deadline = TInstant::Now() + TIMEOUT;
+ TInstant deadline = TInstant::Now() + TIMEOUT;
while (TInstant::Now() <= deadline) {
TString res = SendTabletMonQuery(runtime, hive, TString("/app?page=SetDown&node=") + ToString(nodeId) + "&down=" + (up ? "0" : "1"));
if (!res.empty() && !res.Contains("Error"))
diff --git a/ydb/core/testlib/test_client.h b/ydb/core/testlib/test_client.h
index 2064752ab45..bbc4e6d56e4 100644
--- a/ydb/core/testlib/test_client.h
+++ b/ydb/core/testlib/test_client.h
@@ -33,17 +33,17 @@
namespace NKikimr {
namespace Tests {
-#ifdef WITH_VALGRIND
- const ui64 TIME_LIMIT_MS = TDuration::Seconds(600).MilliSeconds();
-#else
- #ifdef NDEBUG
- const ui64 TIME_LIMIT_MS = TDuration::Seconds(60).MilliSeconds();
- #else
- const ui64 TIME_LIMIT_MS = TDuration::Seconds(180).MilliSeconds();
- #endif
-#endif
- const TDuration ITERATION_DURATION = TDuration::MilliSeconds(50);
-
+#ifdef WITH_VALGRIND
+ const ui64 TIME_LIMIT_MS = TDuration::Seconds(600).MilliSeconds();
+#else
+ #ifdef NDEBUG
+ const ui64 TIME_LIMIT_MS = TDuration::Seconds(60).MilliSeconds();
+ #else
+ const ui64 TIME_LIMIT_MS = TDuration::Seconds(180).MilliSeconds();
+ #endif
+#endif
+ const TDuration ITERATION_DURATION = TDuration::MilliSeconds(50);
+
constexpr const char* TestDomainName = "dc-1";
const ui32 TestDomain = 1;
const ui64 DummyTablet1 = 0x840100;
@@ -316,14 +316,14 @@ namespace Tests {
template <typename T>
NBus::EMessageStatus SyncCall(TAutoPtr<T> msgHolder, TAutoPtr<NBus::TBusMessage> &reply) {
NBus::EMessageStatus msgbusStatus = NBus::EMessageStatus::MESSAGE_TIMEOUT;
- const ui64 finishTimeMs = TInstant::Now().MilliSeconds() + TIME_LIMIT_MS;
+ const ui64 finishTimeMs = TInstant::Now().MilliSeconds() + TIME_LIMIT_MS;
PrepareRequest(msgHolder);
- while (TInstant::Now().MilliSeconds() < finishTimeMs) {
+ while (TInstant::Now().MilliSeconds() < finishTimeMs) {
T* msgCopy(new T());
msgCopy->Record = msgHolder->Record;
msgbusStatus = Client->SyncCall(msgCopy, reply);
if (msgbusStatus == NBus::MESSAGE_CONNECT_FAILED) {
- Sleep(ITERATION_DURATION);
+ Sleep(ITERATION_DURATION);
continue;
} else {
break;
diff --git a/ydb/core/testlib/ya.make b/ydb/core/testlib/ya.make
index 137fa829f3a..4a4c1e72b67 100644
--- a/ydb/core/testlib/ya.make
+++ b/ydb/core/testlib/ya.make
@@ -106,12 +106,12 @@ PEERDIR(
YQL_LAST_ABI_VERSION()
-IF (GCC)
+IF (GCC)
CFLAGS(
-fno-devirtualize-speculatively
)
-ENDIF()
-
+ENDIF()
+
END()
RECURSE(
diff --git a/ydb/core/tx/balance_coverage/ut/ya.make b/ydb/core/tx/balance_coverage/ut/ya.make
index 55dee93c047..de9d711b23e 100644
--- a/ydb/core/tx/balance_coverage/ut/ya.make
+++ b/ydb/core/tx/balance_coverage/ut/ya.make
@@ -8,8 +8,8 @@ OWNER(
FORK_SUBTESTS()
IF (SANITIZER_TYPE)
- TIMEOUT(600)
- SIZE(MEDIUM)
+ TIMEOUT(600)
+ SIZE(MEDIUM)
ELSE()
TIMEOUT(60)
SIZE(SMALL)
diff --git a/ydb/core/tx/coordinator/coordinator_impl.cpp b/ydb/core/tx/coordinator/coordinator_impl.cpp
index b4eeb184e29..5a1f7475528 100644
--- a/ydb/core/tx/coordinator/coordinator_impl.cpp
+++ b/ydb/core/tx/coordinator/coordinator_impl.cpp
@@ -63,7 +63,7 @@ TTxCoordinator::TTxCoordinator(TTabletStorageInfo *info, const TActorId &tablet)
Config.PlanAhead = 50;
Config.Resolution = 1250;
- Config.RapidSlotFlushSize = 1000; // todo: something meaningful
+ Config.RapidSlotFlushSize = 1000; // todo: something meaningful
MonCounters.CurrentTxInFly = 0;
TabletCountersPtr.Reset(new TProtobufTabletCounters<
diff --git a/ydb/core/tx/datashard/datashard_ut_common.cpp b/ydb/core/tx/datashard/datashard_ut_common.cpp
index d754f7ad0e2..564e8f1754d 100644
--- a/ydb/core/tx/datashard/datashard_ut_common.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_common.cpp
@@ -738,7 +738,7 @@ ui64 TFakeMiniKQLProxy::Plan(ui64 stepId, const TMap<ui64, TFakeProxyTx::TPtr>&
TDeque<std::pair<ui64, THolder<TEvDataShard::TEvProposeTransaction>>> immEvents;
for (ui64 txId : immediateTxs) {
TFakeProxyTx::TPtr tx = txs.find(txId)->second;
- UNIT_ASSERT_VALUES_EQUAL(tx->ShardsCount(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(tx->ShardsCount(), 1);
TString txBody;
ui32 shard = tx->GetShardProgram(0, txBody);
THolder<TEvDataShard::TEvProposeTransaction> event = MakeHolder<TEvDataShard::TEvProposeTransaction>(
@@ -860,7 +860,7 @@ ui64 TFakeMiniKQLProxy::Plan(ui64 stepId, const TMap<ui64, TFakeProxyTx::TPtr>&
UNIT_ASSERT_EQUAL(event->GetTxKind(), tx->TxKind());
if (tx->Immediate()) {
- UNIT_ASSERT_VALUES_EQUAL(event->GetStepOrderId().first, 0);
+ UNIT_ASSERT_VALUES_EQUAL(event->GetStepOrderId().first, 0);
tx->AddProposeShardResult(shard, event);
results.erase(std::make_pair(shard, txId));
break;
diff --git a/ydb/core/tx/mediator/tablet_queue.cpp b/ydb/core/tx/mediator/tablet_queue.cpp
index b28179517ca..82409aa987b 100644
--- a/ydb/core/tx/mediator/tablet_queue.cpp
+++ b/ydb/core/tx/mediator/tablet_queue.cpp
@@ -388,12 +388,12 @@ void TTxMediatorTabletQueue::TTabletEntry::MergeOutOfOrder(TStep *sx) {
const auto ox = OutOfOrder.find(step);
if (ox != OutOfOrder.end()) {
const TVector<TTx> &o = ox->second;
- Y_VERIFY_DEBUG(
- IsSorted(sx->Transactions.begin(), sx->Transactions.end(), TTx::TCmpOrderId()),
- "%s",
- yvector2str(sx->Transactions).c_str()
- );
- Y_VERIFY_DEBUG(IsSorted(o.begin(), o.end(), TTx::TCmpOrderId()), "%s", yvector2str(o).c_str());
+ Y_VERIFY_DEBUG(
+ IsSorted(sx->Transactions.begin(), sx->Transactions.end(), TTx::TCmpOrderId()),
+ "%s",
+ yvector2str(sx->Transactions).c_str()
+ );
+ Y_VERIFY_DEBUG(IsSorted(o.begin(), o.end(), TTx::TCmpOrderId()), "%s", yvector2str(o).c_str());
//
// ok, now merge sorted arrays replacing ack-to
TVector<TTx>::iterator planIt = sx->Transactions.begin();
@@ -422,8 +422,8 @@ void TTxMediatorTabletQueue::TTabletEntry::MergeToOutOfOrder(TStepId step, TVect
} else {
TVector<TTx> old;
old.swap(current);
- Y_VERIFY_DEBUG(IsSorted(old.begin(), old.end(), TTx::TCmpOrderId()), "%s", yvector2str(old).c_str());
- Y_VERIFY_DEBUG(IsSorted(update.begin(), update.end(), TTx::TCmpOrderId()), "%s", yvector2str(update).c_str());
+ Y_VERIFY_DEBUG(IsSorted(old.begin(), old.end(), TTx::TCmpOrderId()), "%s", yvector2str(old).c_str());
+ Y_VERIFY_DEBUG(IsSorted(update.begin(), update.end(), TTx::TCmpOrderId()), "%s", yvector2str(update).c_str());
//
// now merge old with update
TVector<TTx>::const_iterator oldIt = old.begin();
@@ -448,7 +448,7 @@ void TTxMediatorTabletQueue::TTabletEntry::MergeToOutOfOrder(TStepId step, TVect
// append tail
current.insert(current.end(), oldIt, oldEnd);
current.insert(current.end(), updIt, updEnd);
- Y_VERIFY_DEBUG(IsSorted(current.begin(), current.end(), TTx::TCmpOrderId()), "%s", yvector2str(current).c_str());
+ Y_VERIFY_DEBUG(IsSorted(current.begin(), current.end(), TTx::TCmpOrderId()), "%s", yvector2str(current).c_str());
//
}
}
diff --git a/ydb/core/util/serializable_access_check.h b/ydb/core/util/serializable_access_check.h
index 9e79301443f..5c60b1e49ef 100644
--- a/ydb/core/util/serializable_access_check.h
+++ b/ydb/core/util/serializable_access_check.h
@@ -18,18 +18,18 @@
/////////////////////////////////////////////////////////////
struct TSerializableAccessChecker {
TSerializableAccessChecker()
- : Locked(0)
+ : Locked(0)
{}
void Acquire() {
- Y_VERIFY(AtomicGet(Locked) == 0);
- AtomicSet(Locked, 1);
+ Y_VERIFY(AtomicGet(Locked) == 0);
+ AtomicSet(Locked, 1);
}
void Release() {
- Y_VERIFY(AtomicGet(Locked) == 1);
- AtomicSet(Locked, 0);
+ Y_VERIFY(AtomicGet(Locked) == 1);
+ AtomicSet(Locked, 0);
}
private:
- TAtomic Locked;
+ TAtomic Locked;
};
diff --git a/ydb/core/viewer/content/index.html b/ydb/core/viewer/content/index.html
index 7fb13b7acd4..0582fb9cf07 100644
--- a/ydb/core/viewer/content/index.html
+++ b/ydb/core/viewer/content/index.html
@@ -564,7 +564,7 @@ table.sqlresult th {
<th>Type</th>
<th>Erasure</th>
<th>Latency</th>
- <th>VDisks</th>
+ <th>VDisks</th>
<th>Usage</th>
<th style='width:70px'>Delta</th>
<th style='width:60px'>Used</th>
diff --git a/ydb/core/ymq/ya.make b/ydb/core/ymq/ya.make
index 341606be22b..cb711fc0e2f 100644
--- a/ydb/core/ymq/ya.make
+++ b/ydb/core/ymq/ya.make
@@ -13,5 +13,5 @@ RECURSE(
)
RECURSE_FOR_TESTS(
- ut
+ ut
)
diff --git a/ydb/library/aclib/protos/ya.make b/ydb/library/aclib/protos/ya.make
index 59135589cc5..c925e25b05b 100644
--- a/ydb/library/aclib/protos/ya.make
+++ b/ydb/library/aclib/protos/ya.make
@@ -1,12 +1,12 @@
PROTO_LIBRARY()
-
+
OWNER(
xenoxeno
g:kikimr
)
INCLUDE_TAGS(GO_PROTO)
-
+
SRCS(
aclib.proto
)
diff --git a/ydb/library/aclib/ya.make b/ydb/library/aclib/ya.make
index a0c1da4c76c..b94844b7924 100644
--- a/ydb/library/aclib/ya.make
+++ b/ydb/library/aclib/ya.make
@@ -5,12 +5,12 @@ PEERDIR(
library/cpp/protobuf/util
ydb/library/aclib/protos
)
-
+
OWNER(
xenoxeno
g:kikimr
)
-
+
SRCS(
aclib.cpp
aclib.h
diff --git a/ydb/library/pdisk_io/buffers.cpp b/ydb/library/pdisk_io/buffers.cpp
index dfc4c0f323a..31eeaaf8da0 100644
--- a/ydb/library/pdisk_io/buffers.cpp
+++ b/ydb/library/pdisk_io/buffers.cpp
@@ -115,7 +115,7 @@ TBuffer *TBufferPool::Pop() {
}
void TBufferPool::Push(TBuffer *buffer) {
- NSan::Poison(buffer->Data(), buffer->Size());
+ NSan::Poison(buffer->Data(), buffer->Size());
REQUEST_VALGRIND_MAKE_MEM_UNDEFINED(buffer->Data(), buffer->Size());
Y_VERIFY_S(buffer->PopCount == 1, "BufferPopCount# " << buffer->PopCount);
buffer->PopCount--;
diff --git a/ydb/library/schlab/ya.make b/ydb/library/schlab/ya.make
index 2a3a11b5f87..09b5fe541c7 100644
--- a/ydb/library/schlab/ya.make
+++ b/ydb/library/schlab/ya.make
@@ -27,5 +27,5 @@ RECURSE(
)
RECURSE_FOR_TESTS(
- ut
+ ut
)
diff --git a/ydb/library/yql/ast/ut/ya.make b/ydb/library/yql/ast/ut/ya.make
index 0a9b5944f21..08edfc0ba8e 100644
--- a/ydb/library/yql/ast/ut/ya.make
+++ b/ydb/library/yql/ast/ut/ya.make
@@ -2,8 +2,8 @@ UNITTEST_FOR(ydb/library/yql/ast)
OWNER(vvvv g:kikimr)
-FORK_SUBTESTS()
-
+FORK_SUBTESTS()
+
SRCS(
yql_ast_ut.cpp
yql_expr_check_args_ut.cpp
diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp
index 625a269eaf6..b1a5b4d963a 100644
--- a/ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp
+++ b/ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp
@@ -20,7 +20,7 @@
#endif
#include <util/system/yassert.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
namespace NKikimr {
namespace NMiniKQL {
@@ -639,7 +639,7 @@ TStringBuf TValuePacker::Pack(const NUdf::TUnboxedValuePod& value) const {
Buffer.Proceed(delta);
Buffer.Append((const char*)&length, sizeof(length));
}
- NSan::Unpoison(Buffer.Data() + delta, len - delta);
+ NSan::Unpoison(Buffer.Data() + delta, len - delta);
return TStringBuf(Buffer.Data() + delta, len - delta);
}
diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp
index 6a47b518294..45956cae170 100644
--- a/ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp
+++ b/ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp
@@ -18,7 +18,7 @@
#include <util/string/cast.h>
#include <util/string/builder.h>
#include <util/system/hp_timer.h>
-#include <util/system/sanitizers.h>
+#include <util/system/sanitizers.h>
namespace NKikimr {
namespace NMiniKQL {
@@ -26,9 +26,9 @@ namespace NMiniKQL {
#ifdef WITH_VALGRIND
constexpr static size_t PERFORMANCE_COUNT = 0x1000;
#else
-constexpr static size_t PERFORMANCE_COUNT = NSan::PlainOrUnderSanitizer(0x4000000, 0x1000);
+constexpr static size_t PERFORMANCE_COUNT = NSan::PlainOrUnderSanitizer(0x4000000, 0x1000);
#endif
-
+
template<bool UseCodegen>
class TMiniKQLComputationNodePackTest: public TTestBase {
protected:
@@ -302,7 +302,7 @@ protected:
{
TValuePacker packer(false, type, UseCodegen);
const THPTimer timer;
- for (size_t i = 0U; i < PERFORMANCE_COUNT; ++i)
+ for (size_t i = 0U; i < PERFORMANCE_COUNT; ++i)
packer.Pack(uValue);
Cout << timer.Passed() << Endl;
}
diff --git a/ydb/library/yql/minikql/computation/ut/ya.make b/ydb/library/yql/minikql/computation/ut/ya.make
index ab27689c7b0..e3aaed4688a 100644
--- a/ydb/library/yql/minikql/computation/ut/ya.make
+++ b/ydb/library/yql/minikql/computation/ut/ya.make
@@ -10,12 +10,12 @@ ELSE()
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
-OWNER(
- vvvv
+
+OWNER(
+ vvvv
g:kikimr
-)
-
+)
+
SRCS(
mkql_computation_node_pack_ut.cpp
mkql_computation_node_list_ut.cpp
diff --git a/ydb/library/yql/minikql/computation/ya.make b/ydb/library/yql/minikql/computation/ya.make
index ae419b3b232..415b7034765 100644
--- a/ydb/library/yql/minikql/computation/ya.make
+++ b/ydb/library/yql/minikql/computation/ya.make
@@ -9,7 +9,7 @@ OWNER(
SRCS(
mkql_computation_node.cpp
- mkql_computation_node.h
+ mkql_computation_node.h
mkql_computation_node_codegen.h
mkql_computation_node_codegen.cpp
mkql_computation_node_graph.cpp
@@ -20,7 +20,7 @@ SRCS(
mkql_computation_node_impl.cpp
mkql_computation_node_list.h
mkql_computation_node_pack.cpp
- mkql_computation_node_pack.h
+ mkql_computation_node_pack.h
mkql_custom_list.cpp
mkql_custom_list.h
mkql_validate.cpp
diff --git a/ydb/library/yql/minikql/ut/ya.make b/ydb/library/yql/minikql/ut/ya.make
index 098a77d0c60..b94952b5ceb 100644
--- a/ydb/library/yql/minikql/ut/ya.make
+++ b/ydb/library/yql/minikql/ut/ya.make
@@ -10,12 +10,12 @@ ELSE()
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
-OWNER(
- vvvv
+
+OWNER(
+ vvvv
g:kikimr
-)
-
+)
+
SRCS(
compact_hash_ut.cpp
mkql_alloc_ut.cpp
diff --git a/ydb/library/yql/utils/fp_bits_ut.cpp b/ydb/library/yql/utils/fp_bits_ut.cpp
index c93e848a66b..94396226202 100644
--- a/ydb/library/yql/utils/fp_bits_ut.cpp
+++ b/ydb/library/yql/utils/fp_bits_ut.cpp
@@ -1,8 +1,8 @@
#include "fp_bits.h"
#include <library/cpp/testing/unittest/registar.h>
-#include <util/system/valgrind.h>
-
+#include <util/system/valgrind.h>
+
namespace NYql {
namespace {
@@ -60,7 +60,7 @@ void CanonizeFpBitsTest() {
}
for (int v = Zero; v < Max; ++v) {
- UNIT_ASSERT_VALUES_EQUAL(std::fpclassify(values[v]), valuesClass[v]);
+ UNIT_ASSERT_VALUES_EQUAL(std::fpclassify(values[v]), valuesClass[v]);
}
for (int v = Zero; v < Max; ++v) {
@@ -69,7 +69,7 @@ void CanonizeFpBitsTest() {
}
for (int v = Zero; v < Max; ++v) {
- UNIT_ASSERT_VALUES_EQUAL(std::fpclassify(newValues[v]), valuesClass[v]);
+ UNIT_ASSERT_VALUES_EQUAL(std::fpclassify(newValues[v]), valuesClass[v]);
}
for (int v = Zero; v < Max; ++v) {
@@ -95,9 +95,9 @@ Y_UNIT_TEST_SUITE(TFpBits) {
}
Y_UNIT_TEST(CanonizeLongDouble) {
- if (NValgrind::ValgrindIsOn()) {
- return; // TODO https://st.yandex-team.ru/KIKIMR-3431
- }
+ if (NValgrind::ValgrindIsOn()) {
+ return; // TODO https://st.yandex-team.ru/KIKIMR-3431
+ }
CanonizeFpBitsTest<long double>();
}
}
diff --git a/ydb/public/lib/deprecated/kicli/cpp_ut.cpp b/ydb/public/lib/deprecated/kicli/cpp_ut.cpp
index cb7dc3ed6d9..e3cf2d8f1f4 100644
--- a/ydb/public/lib/deprecated/kicli/cpp_ut.cpp
+++ b/ydb/public/lib/deprecated/kicli/cpp_ut.cpp
@@ -1,12 +1,12 @@
#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/testing/unittest/tests_data.h>
-
+
#include <ydb/core/testlib/test_client.h>
#include <ydb/core/tx/datashard/datashard_failpoints.h>
#include <ydb/library/aclib/aclib.h>
-
+
#include <util/string/subst.h>
-#include <util/system/valgrind.h>
+#include <util/system/valgrind.h>
#include "kicli.h"
@@ -641,15 +641,15 @@ Y_UNIT_TEST_SUITE(ClientLib) {
);
auto value = result.GetValue();
- UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2);
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat");
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby");
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Description"], "A test for \"double quotes\"");
- UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350);
+ UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350);
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat");
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik");
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Description"], "A test for 'single quotes'");
- UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500);
+ UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500);
}
Y_UNIT_TEST(Test11) {
@@ -732,7 +732,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
UNIT_ASSERT(status == NMsgBusProxy::MSTATUS_ERROR);
auto error = result.GetError();
UNIT_ASSERT(error.Permanent());
- UNIT_ASSERT_VALUES_EQUAL(error.GetCode(), "MP-0128");
+ UNIT_ASSERT_VALUES_EQUAL(error.GetCode(), "MP-0128");
UNIT_ASSERT_STRING_CONTAINS(error.GetMessage(), "<main>:1:34: Error: expected either let, return or import");
}
@@ -757,7 +757,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
UNIT_ASSERT(status == NMsgBusProxy::MSTATUS_ERROR);
auto error = result.GetError();
UNIT_ASSERT(error.Permanent());
- UNIT_ASSERT_VALUES_EQUAL(error.GetCode(), "MP-0128");
+ UNIT_ASSERT_VALUES_EQUAL(error.GetCode(), "MP-0128");
UNIT_ASSERT_STRING_CONTAINS(error.GetMessage(), "Mismatch of column type expectedType = 3 actual type = 4608");
}
@@ -782,7 +782,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
UNIT_ASSERT(status == NMsgBusProxy::MSTATUS_ERROR);
auto error = result.GetError();
UNIT_ASSERT(error.Permanent());
- UNIT_ASSERT_VALUES_EQUAL(error.GetCode(), "MP-0128");
+ UNIT_ASSERT_VALUES_EQUAL(error.GetCode(), "MP-0128");
UNIT_ASSERT_VALUES_EQUAL(error.GetMessage(), "<main>:1:142: Error: At function: AsList\n"
" <main>:1:77: Error: At function: UpdateRow\n"
" <main>:1:84: Error: At function: Int64\n"
@@ -845,13 +845,13 @@ Y_UNIT_TEST_SUITE(ClientLib) {
auto value = result.GetValue();
- UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2);
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat");
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby");
- UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350);
+ UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350);
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat");
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik");
- UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500);
+ UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500);
}
Y_UNIT_TEST(Test16) {
@@ -927,13 +927,13 @@ Y_UNIT_TEST_SUITE(ClientLib) {
auto value = result.GetValue();
- UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2);
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat");
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby");
- UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350);
+ UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350);
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat");
UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik");
- UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500);
+ UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500);
}
struct TGenericParameterType {
@@ -1066,7 +1066,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
auto result = selectQuery.SyncExecute();
auto value = result.GetValue();
- UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
+ UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
"{\"myRes\": [{\"Name\": \"Dobby\", \"Species\": \"Rat\", \"Weight\": 350}, {\"Name\": \"Korzhik\", \"Species\": \"Rat\", \"Weight\": 500}]}");
}
@@ -1123,7 +1123,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
auto result = selectQuery.SyncExecute();
auto value = result.GetValue();
- UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
+ UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
"{\"myRes\": [{\"Name\": \"Dobby\", \"Species\": \"Rat\", \"Weight\": 350}, {\"Name\": \"Korzhik\", \"Species\": \"Rat\", \"Weight\": 500}]}");
}
@@ -1207,7 +1207,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
auto result = selectQuery.SyncExecute();
auto value = result.GetValue();
- UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
+ UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
"{\"myRes\": [{\"Name\": \"Dobby\", \"Species\": \"Rat\", \"Weight\": 350}, {\"Name\": \"Korzhik\", \"Species\": \"Rat\", \"Weight\": 500}]}");
}
@@ -1277,7 +1277,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
auto result = selectQuery.SyncExecute();
auto value = result.GetValue();
- UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
+ UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
"{\"myRes\": [{\"Name\": \"Dobby\", \"Species\": \"Rat\", \"Weight\": 350}, {\"Name\": \"Korzhik\", \"Species\": \"Rat\", \"Weight\": 500}]}");
}
@@ -1349,7 +1349,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
auto result = selectQuery.SyncExecute();
auto value = result.GetValue();
- UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
+ UNIT_ASSERT_VALUES_EQUAL(value.GetValueText<TFormatJSON>(),
"{\"myRes\": [{\"Name\": \"Dobby\", \"Species\": \"Rat\", \"Weight\": 350}, {\"Name\": \"Korzhik\", \"Species\": \"Rat\", \"Weight\": 500}]}");
}
@@ -1682,7 +1682,7 @@ Y_UNIT_TEST_SUITE(ClientLib) {
auto valueResult = result.GetValue();
bool gotResult = valueResult["anyExists"];
- UNIT_ASSERT_VALUES_EQUAL(gotResult, expectedResult);
+ UNIT_ASSERT_VALUES_EQUAL(gotResult, expectedResult);
if (!gotResult) {
values_h1.insert(H1);
diff --git a/ydb/public/lib/deprecated/kicli/error.cpp b/ydb/public/lib/deprecated/kicli/error.cpp
index 473a981f607..796fc38939a 100644
--- a/ydb/public/lib/deprecated/kicli/error.cpp
+++ b/ydb/public/lib/deprecated/kicli/error.cpp
@@ -93,7 +93,7 @@ bool TError::Permanent() const {
};
break;
};
- return Error();
+ return Error();
}
bool TError::Timeout() const {
diff --git a/ydb/public/lib/deprecated/kicli/kicli.h b/ydb/public/lib/deprecated/kicli/kicli.h
index 9dc472d2314..a5fe6a457ab 100644
--- a/ydb/public/lib/deprecated/kicli/kicli.h
+++ b/ydb/public/lib/deprecated/kicli/kicli.h
@@ -273,11 +273,11 @@ public:
FacilityMsgBusProxy,
};
- TError() = default;
+ TError() = default;
TError(TError&&) = default;
- TError(const TError&) = default;
+ TError(const TError&) = default;
TError& operator = (TError&&) = default;
- TError& operator = (const TError&) = default;
+ TError& operator = (const TError&) = default;
bool Success() const;
bool Error() const { return !Success(); }
diff --git a/ydb/public/lib/deprecated/kicli/ut/ya.make b/ydb/public/lib/deprecated/kicli/ut/ya.make
index ce45125f076..5176fa57557 100644
--- a/ydb/public/lib/deprecated/kicli/ut/ya.make
+++ b/ydb/public/lib/deprecated/kicli/ut/ya.make
@@ -8,9 +8,9 @@ OWNER(
TIMEOUT(600)
SIZE(MEDIUM)
-
-FORK_SUBTESTS()
-
+
+FORK_SUBTESTS()
+
PEERDIR(
ydb/core/client
ydb/core/testlib
diff --git a/ydb/public/lib/deprecated/kicli/ya.make b/ydb/public/lib/deprecated/kicli/ya.make
index d9aa54bc4cd..3eab60c4f5d 100644
--- a/ydb/public/lib/deprecated/kicli/ya.make
+++ b/ydb/public/lib/deprecated/kicli/ya.make
@@ -1,8 +1,8 @@
LIBRARY()
-# See documentation
-# https://wiki.yandex-team.ru/kikimr/techdoc/db/cxxapi/
-
+# See documentation
+# https://wiki.yandex-team.ru/kikimr/techdoc/db/cxxapi/
+
OWNER(
xenoxeno
g:kikimr
diff --git a/ydb/tests/functional/blobstorage/pdisk_format_info.py b/ydb/tests/functional/blobstorage/pdisk_format_info.py
index cc22e52eec0..ce00c50268e 100755
--- a/ydb/tests/functional/blobstorage/pdisk_format_info.py
+++ b/ydb/tests/functional/blobstorage/pdisk_format_info.py
@@ -1,11 +1,11 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
from hamcrest import assert_that, equal_to
-
+
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.common import msgbus_types
-
-
+
+
class TestPDiskInfo(object):
"""
See ticket https://st.yandex-team.ru/KIKIMR-1831
@@ -14,11 +14,11 @@ class TestPDiskInfo(object):
def setup_class(cls):
cls.cluster = kikimr_cluster_factory()
cls.cluster.start()
-
+
@classmethod
def teardown_class(cls):
cls.cluster.stop()
-
+
def test_read_disk_state(self):
pdisk_infos = self.cluster.config.pdisks_info
pdisk_paths = []
diff --git a/ydb/tests/functional/blobstorage/tablet_channel_migration.py b/ydb/tests/functional/blobstorage/tablet_channel_migration.py
index 2223404de2f..09d88aa4f86 100644
--- a/ydb/tests/functional/blobstorage/tablet_channel_migration.py
+++ b/ydb/tests/functional/blobstorage/tablet_channel_migration.py
@@ -1,20 +1,20 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import logging
-
-from hamcrest import assert_that
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import logging
+
+from hamcrest import assert_that
+
from ydb.tests.library.common.protobuf import KVRequest
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.harness.kikimr_http_client import HiveClient
from ydb.tests.library.kv.helpers import create_tablets_and_wait_for_start
from ydb.tests.library.matchers.response import is_valid_keyvalue_protobuf_response
-
-
-TIMEOUT_SECONDS = 480
-logger = logging.getLogger()
-
-
+
+
+TIMEOUT_SECONDS = 480
+logger = logging.getLogger()
+
+
class TestChannelsOps(object):
@classmethod
def setup_class(cls):
@@ -24,100 +24,100 @@ class TestChannelsOps(object):
host = cls.kikimr_cluster.nodes[1].host
mon_port = cls.kikimr_cluster.nodes[1].mon_port
cls.hive_client = HiveClient(host, mon_port)
-
+
@classmethod
def teardown_class(cls):
cls.kikimr_cluster.stop()
-
- def test_when_write_and_change_tablet_channel_then_can_read_from_tablet(self):
- # Arrange
- number_of_tablets = 10
-
- tablet_ids = create_tablets_and_wait_for_start(
+
+ def test_when_write_and_change_tablet_channel_then_can_read_from_tablet(self):
+ # Arrange
+ number_of_tablets = 10
+
+ tablet_ids = create_tablets_and_wait_for_start(
self.client, number_of_tablets,
batch_size=number_of_tablets,
timeout_seconds=TIMEOUT_SECONDS
- )
-
- key = 'key'
- # Act
- for tablet_id in tablet_ids:
- self.client.kv_request(
+ )
+
+ key = 'key'
+ # Act
+ for tablet_id in tablet_ids:
+ self.client.kv_request(
tablet_id, KVRequest().write(bytes(key, 'utf-8'), bytes(value_for(key, tablet_id), 'utf-8'))
- )
- self.hive_client.change_tablet_group(tablet_id)
-
- create_tablets_and_wait_for_start(
+ )
+ self.hive_client.change_tablet_group(tablet_id)
+
+ create_tablets_and_wait_for_start(
self.client, number_of_tablets,
batch_size=number_of_tablets,
timeout_seconds=TIMEOUT_SECONDS
- )
-
- # Assert
- for tablet_id in tablet_ids:
+ )
+
+ # Assert
+ for tablet_id in tablet_ids:
self.client.kv_request(tablet_id, KVRequest().read(bytes(key, 'utf-8')))
-
- for tablet_id in tablet_ids:
+
+ for tablet_id in tablet_ids:
response = self.client.kv_request(
tablet_id, KVRequest().read(bytes(key, 'utf-8')))
- assert_that(
- response,
+ assert_that(
+ response,
is_valid_keyvalue_protobuf_response().read_key(
bytes(value_for(key, tablet_id), 'utf-8'))
- )
-
- def test_when_write_in_new_channel_then_can_read_from_tablet(self):
- # Arrange
- number_of_tablets = 10
-
- tablet_ids = create_tablets_and_wait_for_start(
+ )
+
+ def test_when_write_in_new_channel_then_can_read_from_tablet(self):
+ # Arrange
+ number_of_tablets = 10
+
+ tablet_ids = create_tablets_and_wait_for_start(
self.client, number_of_tablets,
batch_size=number_of_tablets,
timeout_seconds=TIMEOUT_SECONDS
- )
-
+ )
+
# Gather current generations for created tablets
tablet_generations = {
state.TabletId: state.Generation
for state in self.client.tablet_state(tablet_ids=tablet_ids).TabletStateInfo
}
- key = 'key'
- key2 = 'key2'
- # Act
- for tablet_id in tablet_ids:
- self.client.kv_request(
+ key = 'key'
+ key2 = 'key2'
+ # Act
+ for tablet_id in tablet_ids:
+ self.client.kv_request(
tablet_id, KVRequest().write(bytes(key, 'utf-8'), bytes(value_for(key, tablet_id), 'utf-8'))
- )
- self.hive_client.change_tablet_group(tablet_id)
-
- create_tablets_and_wait_for_start(
+ )
+ self.hive_client.change_tablet_group(tablet_id)
+
+ create_tablets_and_wait_for_start(
self.client, number_of_tablets,
batch_size=number_of_tablets,
timeout_seconds=TIMEOUT_SECONDS,
skip_generations=tablet_generations,
- )
-
- for tablet_id in tablet_ids:
+ )
+
+ for tablet_id in tablet_ids:
self.client.kv_request(
tablet_id, KVRequest().write(
bytes(key2, 'utf-8'), bytes(value_for(key2, tablet_id), 'utf-8')
)
)
-
- # Assert
- for tablet_id in tablet_ids:
- response = self.client.kv_request(
+
+ # Assert
+ for tablet_id in tablet_ids:
+ response = self.client.kv_request(
tablet_id, KVRequest().read(bytes(key, 'utf-8')).read(bytes(key2, 'utf-8'))
- )
- assert_that(
- response,
+ )
+ assert_that(
+ response,
is_valid_keyvalue_protobuf_response().read_key(
bytes(value_for(key, tablet_id), 'utf-8')).read_key(
bytes(value_for(key2, tablet_id), 'utf-8'))
- )
-
-
-def value_for(key, tablet_id):
+ )
+
+
+def value_for(key, tablet_id):
return "Value: <key = {key}, tablet_id = {tablet_id}>".format(
key=key, tablet_id=tablet_id)
diff --git a/ydb/tests/functional/blobstorage/ya.make b/ydb/tests/functional/blobstorage/ya.make
index 3248849d57c..e6b4066c8c7 100644
--- a/ydb/tests/functional/blobstorage/ya.make
+++ b/ydb/tests/functional/blobstorage/ya.make
@@ -3,14 +3,14 @@ OWNER(g:kikimr)
PY3TEST()
ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd")
-TEST_SRCS(
+TEST_SRCS(
pdisk_format_info.py
- replication.py
+ replication.py
self_heal.py
tablet_channel_migration.py
-)
+)
-IF (SANITIZER_TYPE)
+IF (SANITIZER_TYPE)
REQUIREMENTS(
cpu:4
ram:16
@@ -18,27 +18,27 @@ IF (SANITIZER_TYPE)
TIMEOUT(1800)
SIZE(LARGE)
TAG(ya:fat)
-ELSE()
+ELSE()
REQUIREMENTS(
cpu:4
ram:16
)
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
SPLIT_FACTOR(20)
-DEPENDS(
+DEPENDS(
ydb/apps/ydbd
-)
+)
-PEERDIR(
+PEERDIR(
ydb/tests/library
contrib/python/PyHamcrest
-)
+)
-FORK_SUBTESTS()
-FORK_TEST_FILES()
+FORK_SUBTESTS()
+FORK_TEST_FILES()
-END()
+END()
diff --git a/ydb/tests/functional/hive/create_tablets.py b/ydb/tests/functional/hive/create_tablets.py
index 57db28ffa0c..62fe7e26ef2 100644
--- a/ydb/tests/functional/hive/create_tablets.py
+++ b/ydb/tests/functional/hive/create_tablets.py
@@ -1,6 +1,6 @@
-# -*- coding: utf-8 -*-
-from hamcrest import assert_that, has_properties
-
+# -*- coding: utf-8 -*-
+from hamcrest import assert_that, has_properties
+
from ydb.tests.library.common.delayed import wait_tablets_are_active
from ydb.tests.library.common.msgbus_types import EReplyStatus
from ydb.tests.library.common.protobuf import TCmdCreateTablet, THiveCreateTablet
@@ -9,105 +9,105 @@ from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
from ydb.tests.library.matchers.collection import contains
from ydb.tests.library.matchers.response_matchers import DynamicFieldsProtobufMatcher
-
-from hive_matchers import CreateTabletsResponseMatcher, TLocalEnumerateTabletsResultMatcher
+
+from hive_matchers import CreateTabletsResponseMatcher, TLocalEnumerateTabletsResultMatcher
from ydb.tests.library.kv.helpers import create_tablets_and_wait_for_start
-
-TIMEOUT_SECONDS = 240
-
-
-class TestHive(object):
+
+TIMEOUT_SECONDS = 240
+
+
+class TestHive(object):
@classmethod
- def setup_class(cls):
- configurator = KikimrConfigGenerator(Erasure.BLOCK_4_2, nodes=8)
+ def setup_class(cls):
+ configurator = KikimrConfigGenerator(Erasure.BLOCK_4_2, nodes=8)
cls.cluster = kikimr_cluster_factory(configurator=configurator)
cls.cluster.start()
cls.client = cls.cluster.client
-
+
@classmethod
- def teardown_class(cls):
+ def teardown_class(cls):
if hasattr(cls, 'cluster'):
cls.cluster.stop()
-
- def test_when_kill_node_with_tablets_when_all_tablets_start_only_on_allowed_nodes(self):
- # Arrange
+
+ def test_when_kill_node_with_tablets_when_all_tablets_start_only_on_allowed_nodes(self):
+ # Arrange
tablet_ids_first = create_tablets_and_wait_for_start(
self.client, owner_id=2474, number_of_tablets=10, allowed_node_ids=[2, 3])
tablet_ids_second = create_tablets_and_wait_for_start(
self.client, owner_id=4645, number_of_tablets=10, allowed_node_ids=[2, 4])
-
- # Act
+
+ # Act
self.cluster.nodes[2].stop()
wait_tablets_are_active(self.client, tablet_ids_first + tablet_ids_second)
-
- # Assert
+
+ # Assert
response_first = self.client.local_enumerate_tablets(node_id=3, tablet_type=TabletTypes.KEYVALUEFLAT)
- assert_that(
- response_first,
- TLocalEnumerateTabletsResultMatcher().tablet_info(
- [
+ assert_that(
+ response_first,
+ TLocalEnumerateTabletsResultMatcher().tablet_info(
+ [
has_properties(TabletId=tablet_id)
- for tablet_id in tablet_ids_first
+ for tablet_id in tablet_ids_first
]
- )
- )
-
+ )
+ )
+
response_second = self.client.local_enumerate_tablets(node_id=4, tablet_type=TabletTypes.KEYVALUEFLAT)
- assert_that(
- response_second,
- TLocalEnumerateTabletsResultMatcher().tablet_info(
- [
+ assert_that(
+ response_second,
+ TLocalEnumerateTabletsResultMatcher().tablet_info(
+ [
has_properties(TabletId=tablet_id)
- for tablet_id in tablet_ids_second
+ for tablet_id in tablet_ids_second
]
- )
- )
-
- def test_when_create_tablets_after_bs_groups_and_kill_hive_then_tablets_start(self):
- owner_id = 453
- num_of_tablets_in_batch = 5
-
- # Arrange
+ )
+ )
+
+ def test_when_create_tablets_after_bs_groups_and_kill_hive_then_tablets_start(self):
+ owner_id = 453
+ num_of_tablets_in_batch = 5
+
+ # Arrange
response = self.client.hive_create_tablets(
- [
- TCmdCreateTablet(owner_id=owner_id, owner_idx=index, type=TabletTypes.KEYVALUEFLAT,
- channels_profile=1)
- for index in range(num_of_tablets_in_batch)
- ]
- )
- assert_that(
- response,
- CreateTabletsResponseMatcher().create_tablet_result(num_of_tablets_in_batch)
- )
- tablet_ids = [tablet.TabletId for tablet in response.CreateTabletResult]
+ [
+ TCmdCreateTablet(owner_id=owner_id, owner_idx=index, type=TabletTypes.KEYVALUEFLAT,
+ channels_profile=1)
+ for index in range(num_of_tablets_in_batch)
+ ]
+ )
+ assert_that(
+ response,
+ CreateTabletsResponseMatcher().create_tablet_result(num_of_tablets_in_batch)
+ )
+ tablet_ids = [tablet.TabletId for tablet in response.CreateTabletResult]
self.cluster.add_storage_pool(erasure=Erasure.MIRROR_3)
self.client.tablet_kill(TabletTypes.FLAT_HIVE.tablet_id_for(0))
-
+
wait_tablets_are_active(self.client, tablet_ids)
-
- def test_when_create_tablets_then_can_lookup_them(self):
- num_of_tablets_to_create = 2
- owner_id = 1
+
+ def test_when_create_tablets_then_can_lookup_them(self):
+ num_of_tablets_to_create = 2
+ owner_id = 1
tablet_ids = create_tablets_and_wait_for_start(
self.client,
owner_id=owner_id, number_of_tablets=num_of_tablets_to_create)
-
- lookup_request = THiveCreateTablet()
- for index in range(num_of_tablets_to_create + 1):
- lookup_request.lookup_tablet(owner_id=owner_id, owner_idx=index)
-
+
+ lookup_request = THiveCreateTablet()
+ for index in range(num_of_tablets_to_create + 1):
+ lookup_request.lookup_tablet(owner_id=owner_id, owner_idx=index)
+
response = self.client.send_request(lookup_request.protobuf, method='HiveCreateTablet')
-
- # Assert
- expected_list = [
- has_properties(Status=EReplyStatus.OK, TabletId=tablet_id)
- for tablet_id in tablet_ids
- ] + [has_properties(Status=EReplyStatus.NODATA)]
-
- assert_that(
- response,
- DynamicFieldsProtobufMatcher().LookupTabletResult(
- contains(*expected_list)
- )
- )
+
+ # Assert
+ expected_list = [
+ has_properties(Status=EReplyStatus.OK, TabletId=tablet_id)
+ for tablet_id in tablet_ids
+ ] + [has_properties(Status=EReplyStatus.NODATA)]
+
+ assert_that(
+ response,
+ DynamicFieldsProtobufMatcher().LookupTabletResult(
+ contains(*expected_list)
+ )
+ )
diff --git a/ydb/tests/functional/hive/hive_matchers.py b/ydb/tests/functional/hive/hive_matchers.py
index 4d41df82865..f3a1739ef5c 100644
--- a/ydb/tests/functional/hive/hive_matchers.py
+++ b/ydb/tests/functional/hive/hive_matchers.py
@@ -1,41 +1,41 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-from hamcrest import anything, contains_inanyorder
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from hamcrest import anything, contains_inanyorder
+
from ydb.tests.library.common.msgbus_types import EReplyStatus
from ydb.tests.library.common.msgbus_types import MessageBusStatus
from ydb.tests.library.matchers.response_matchers import AbstractProtobufMatcher, FakeProtobuf
-
-
-class CreateTabletsResponseMatcher(AbstractProtobufMatcher):
-
- def __init__(self):
- super(CreateTabletsResponseMatcher, self).__init__()
- self.expected_protobuf.Status = MessageBusStatus.MSTATUS_OK
- self.expected_protobuf.CreateTabletResult = []
-
- def create_tablet_result(self, number_of_tablets_created):
- self.expected_protobuf.CreateTabletResult.extend(
- [FakeProtobuf(Status=EReplyStatus.OK, TabletId=anything()) for _ in range(number_of_tablets_created)]
- )
- return self
-
-
-class TEvTabletStateResponseMatcher(AbstractProtobufMatcher):
- def __init__(self):
- super(TEvTabletStateResponseMatcher, self).__init__()
- self.expected_protobuf.Status = MessageBusStatus.MSTATUS_OK
-
- def tablet_state_info(self, set_of_tablet_states):
- self.expected_protobuf.TabletStateInfo = contains_inanyorder(*set_of_tablet_states)
- return self
-
-
-class TLocalEnumerateTabletsResultMatcher(AbstractProtobufMatcher):
- def __init__(self):
- super(TLocalEnumerateTabletsResultMatcher, self).__init__()
- self.expected_protobuf.Status = MessageBusStatus.MSTATUS_OK
-
- def tablet_info(self, set_of_tablet_info):
- self.expected_protobuf.TabletInfo = contains_inanyorder(*set_of_tablet_info)
- return self
+
+
+class CreateTabletsResponseMatcher(AbstractProtobufMatcher):
+
+ def __init__(self):
+ super(CreateTabletsResponseMatcher, self).__init__()
+ self.expected_protobuf.Status = MessageBusStatus.MSTATUS_OK
+ self.expected_protobuf.CreateTabletResult = []
+
+ def create_tablet_result(self, number_of_tablets_created):
+ self.expected_protobuf.CreateTabletResult.extend(
+ [FakeProtobuf(Status=EReplyStatus.OK, TabletId=anything()) for _ in range(number_of_tablets_created)]
+ )
+ return self
+
+
+class TEvTabletStateResponseMatcher(AbstractProtobufMatcher):
+ def __init__(self):
+ super(TEvTabletStateResponseMatcher, self).__init__()
+ self.expected_protobuf.Status = MessageBusStatus.MSTATUS_OK
+
+ def tablet_state_info(self, set_of_tablet_states):
+ self.expected_protobuf.TabletStateInfo = contains_inanyorder(*set_of_tablet_states)
+ return self
+
+
+class TLocalEnumerateTabletsResultMatcher(AbstractProtobufMatcher):
+ def __init__(self):
+ super(TLocalEnumerateTabletsResultMatcher, self).__init__()
+ self.expected_protobuf.Status = MessageBusStatus.MSTATUS_OK
+
+ def tablet_info(self, set_of_tablet_info):
+ self.expected_protobuf.TabletInfo = contains_inanyorder(*set_of_tablet_info)
+ return self
diff --git a/ydb/tests/functional/hive/test_kill_tablets.py b/ydb/tests/functional/hive/test_kill_tablets.py
index 08dbd5c0b1a..0cc961eb4c6 100644
--- a/ydb/tests/functional/hive/test_kill_tablets.py
+++ b/ydb/tests/functional/hive/test_kill_tablets.py
@@ -1,6 +1,6 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
from hamcrest import assert_that, greater_than, has_length
-
+
from ydb.tests.library.common.delayed import wait_tablets_state_by_id
from ydb.tests.library.common.types import TabletTypes, TabletStates
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
@@ -8,9 +8,9 @@ from ydb.tests.library.matchers.response import is_ok_response, is_valid_respons
from ydb.tests.library.kv.helpers import create_tablets_and_wait_for_start
TIMEOUT_SECONDS = 180
-NUMBER_OF_TABLETS = 4
-
+NUMBER_OF_TABLETS = 4
+
class TestKillTablets(object):
@classmethod
def setup_class(cls):
@@ -23,60 +23,60 @@ class TestKillTablets(object):
cls.cluster.stop()
def test_when_kill_keyvalue_tablet_it_will_be_restarted(self):
- # Arrange
+ # Arrange
all_created_tablet_ids = create_tablets_and_wait_for_start(self.cluster.client, NUMBER_OF_TABLETS)
actual_tablet_info = self.cluster.client.tablet_state(tablet_ids=all_created_tablet_ids).TabletStateInfo
- # Act
+ # Act
for tablet_id in all_created_tablet_ids:
self.cluster.client.tablet_kill(tablet_id)
generations = {info.TabletId: info.Generation for info in actual_tablet_info}
wait_tablets_state_by_id(
self.cluster.client,
- TabletStates.Active,
+ TabletStates.Active,
tablet_ids=all_created_tablet_ids,
skip_generations=generations,
generation_matcher=greater_than,
timeout_seconds=TIMEOUT_SECONDS,
- )
+ )
def test_when_kill_hive_it_will_be_restarted_and_can_create_tablets(self):
- # Arrange
+ # Arrange
hive_state_response = self.cluster.client.tablet_state(tablet_type=TabletTypes.FLAT_HIVE)
- assert_that(
- hive_state_response,
- is_valid_response_with_field('TabletStateInfo', has_length(1))
- )
- hive_id = hive_state_response.TabletStateInfo[0].TabletId
+ assert_that(
+ hive_state_response,
+ is_valid_response_with_field('TabletStateInfo', has_length(1))
+ )
+ hive_id = hive_state_response.TabletStateInfo[0].TabletId
- # Act
+ # Act
response = self.cluster.client.tablet_kill(hive_id)
- assert_that(
- response,
- is_ok_response()
- )
-
+ assert_that(
+ response,
+ is_ok_response()
+ )
+
wait_tablets_state_by_id(
self.cluster.client,
- TabletStates.Active,
- tablet_ids=[hive_id],
- message='Hive is Active'
- )
+ TabletStates.Active,
+ tablet_ids=[hive_id],
+ message='Hive is Active'
+ )
all_tablet_ids = create_tablets_and_wait_for_start(self.cluster.client, NUMBER_OF_TABLETS)
- # Assert
+ # Assert
wait_tablets_state_by_id(
self.cluster.client,
- TabletStates.Active,
+ TabletStates.Active,
tablet_ids=all_tablet_ids,
message='New tablets are created',
timeout_seconds=TIMEOUT_SECONDS,
- )
-
+ )
+
def test_then_kill_system_tablets_and_it_increases_generation(self):
- # Arrange
+ # Arrange
tablet_types = [
TabletTypes.FLAT_TX_COORDINATOR, TabletTypes.TX_MEDIATOR, TabletTypes.FLAT_HIVE,
TabletTypes.FLAT_BS_CONTROLLER, TabletTypes.FLAT_SCHEMESHARD, TabletTypes.TX_ALLOCATOR
@@ -84,13 +84,13 @@ class TestKillTablets(object):
for tablet_type in tablet_types:
response = self.cluster.client.tablet_state(tablet_type)
tablets_info = response.TabletStateInfo
-
+
assert_that(
tablets_info,
has_length(greater_than(0)),
"There are no tablets with given tablet_type"
)
-
+
# Act
tablet_id = tablets_info[0].TabletId
prev_generation = tablets_info[0].Generation
diff --git a/ydb/tests/functional/hive/ya.make b/ydb/tests/functional/hive/ya.make
index 60c5fdbf137..27b08ad0840 100644
--- a/ydb/tests/functional/hive/ya.make
+++ b/ydb/tests/functional/hive/ya.make
@@ -2,12 +2,12 @@ OWNER(g:kikimr)
PY3TEST()
ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd")
-TEST_SRCS(
- create_tablets.py
+TEST_SRCS(
+ create_tablets.py
hive_matchers.py
- test_kill_tablets.py
+ test_kill_tablets.py
test_drain.py
-)
+)
REQUIREMENTS(
@@ -30,15 +30,15 @@ ELSE()
SPLIT_FACTOR(20)
ENDIF()
-DEPENDS(
+DEPENDS(
ydb/apps/ydbd
-)
+)
-PEERDIR(
+PEERDIR(
ydb/tests/library
-)
+)
-FORK_SUBTESTS()
-FORK_TEST_FILES()
+FORK_SUBTESTS()
+FORK_TEST_FILES()
-END()
+END()
diff --git a/ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py b/ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py
index 7c92c832549..255376dda30 100644
--- a/ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py
+++ b/ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py
@@ -1,28 +1,28 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import os
-
+
from hamcrest import assert_that, raises
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
import ydb
+
-
-class TestSchemeShardSimpleOps(object):
+class TestSchemeShardSimpleOps(object):
@classmethod
- def setup_class(cls):
+ def setup_class(cls):
cls.cluster = kikimr_cluster_factory()
cls.cluster.start()
-
+
host = cls.cluster.nodes[1].host
port = cls.cluster.nodes[1].grpc_port
cls.root_dir = 'Root'
cls.ydb_client = ydb.Driver(ydb.DriverConfig("%s:%s" % (host, port)))
cls.ydb_client.wait(timeout=5)
-
+
@classmethod
- def teardown_class(cls):
+ def teardown_class(cls):
if hasattr(cls, 'cluster'):
cls.cluster.stop()
-
+
def test_delete_table_that_doesnt_exist_failure(self):
session = self.ydb_client.table_client.session().create()
@@ -152,7 +152,7 @@ class TestSchemeShardSimpleOps(object):
)
)
- def test_when_create_path_second_time_then_it_is_ok(self):
+ def test_when_create_path_second_time_then_it_is_ok(self):
for _ in range(3):
self.ydb_client.scheme_client.make_directory(
os.path.join(
@@ -160,15 +160,15 @@ class TestSchemeShardSimpleOps(object):
'test_when_create_path_second_time_then_it_is_ok'
)
)
-
- def test_when_delete_path_with_folder_then_get_error_response(self):
- # Arrange
+
+ def test_when_delete_path_with_folder_then_get_error_response(self):
+ # Arrange
self.ydb_client.scheme_client.make_directory(
os.path.join(
self.root_dir,
'test_when_delete_path_with_folder_then_get_error_response'
)
- )
+ )
self.ydb_client.scheme_client.make_directory(
os.path.join(
@@ -176,9 +176,9 @@ class TestSchemeShardSimpleOps(object):
'test_when_delete_path_with_folder_then_get_error_response',
'sub_path_1'
)
- )
-
- # Act
+ )
+
+ # Act
def callee():
self.ydb_client.scheme_client.remove_directory(
os.path.join(
@@ -186,20 +186,20 @@ class TestSchemeShardSimpleOps(object):
'test_when_delete_path_with_folder_then_get_error_response',
)
)
-
- # Assert
- assert_that(
+
+ # Assert
+ assert_that(
callee,
raises(
ydb.SchemeError,
'path has children'
- )
- )
-
- def test_given_table_when_drop_table_and_create_with_same_scheme_then_ok(self):
+ )
+ )
+
+ def test_given_table_when_drop_table_and_create_with_same_scheme_then_ok(self):
table_name = 'test_given_table_when_drop_table_and_create_with_same_scheme_then_ok'
-
- # Act + Assert
+
+ # Act + Assert
session = self.ydb_client.table_client.session().create()
for _ in range(3):
session.create_table(
@@ -217,18 +217,18 @@ class TestSchemeShardSimpleOps(object):
)
)
)
-
+
session.drop_table(
os.path.join(
self.root_dir,
table_name
)
)
-
- def test_given_table_when_drop_table_and_create_with_other_keys_then_ok(self):
- table_name = 'test_create_table_with_other_scheme'
-
- # Arrange
+
+ def test_given_table_when_drop_table_and_create_with_other_keys_then_ok(self):
+ table_name = 'test_create_table_with_other_scheme'
+
+ # Arrange
session = self.ydb_client.table_client.session().create()
session.create_table(
os.path.join(self.root_dir, table_name),
@@ -237,11 +237,11 @@ class TestSchemeShardSimpleOps(object):
.with_columns(
ydb.Column('key', ydb.OptionalType(ydb.PrimitiveType.Utf8)),
)
- )
-
- # Act + Assert
+ )
+
+ # Act + Assert
session.drop_table(os.path.join(self.root_dir, table_name))
-
+
session.create_table(
os.path.join(self.root_dir, table_name),
ydb.TableDescription()
@@ -250,14 +250,14 @@ class TestSchemeShardSimpleOps(object):
ydb.Column('key1', ydb.OptionalType(ydb.PrimitiveType.Utf8)),
ydb.Column('key2', ydb.OptionalType(ydb.PrimitiveType.Utf8)),
)
- )
-
+ )
+
session.drop_table(os.path.join(self.root_dir, table_name))
- def test_given_table_when_drop_table_and_create_with_same_primary_key_and_other_scheme_then_ok(self):
+ def test_given_table_when_drop_table_and_create_with_same_primary_key_and_other_scheme_then_ok(self):
table_name = 'test_given_table_when_drop_table_and_create_with_same_primary_key_and_other_scheme_then_ok'
-
- # Arrange
+
+ # Arrange
session = self.ydb_client.table_client.session().create()
session.create_table(
os.path.join(self.root_dir, table_name),
@@ -271,12 +271,12 @@ class TestSchemeShardSimpleOps(object):
)
)
)
- )
-
+ )
+
session.drop_table(
os.path.join(self.root_dir, table_name),
- )
-
+ )
+
session.create_table(
os.path.join(self.root_dir, table_name),
ydb.TableDescription()
@@ -292,11 +292,11 @@ class TestSchemeShardSimpleOps(object):
)
)
)
- )
+ )
session.drop_table(
os.path.join(self.root_dir, table_name),
- )
+ )
def test_ydb_create_and_remove_directory_success(self):
self.ydb_client.scheme_client.make_directory('/Root/test_ydb_create_and_remove_directory_success')
diff --git a/ydb/tests/functional/scheme_shard/ya.make b/ydb/tests/functional/scheme_shard/ya.make
index dd26c284e19..469fc142a7d 100644
--- a/ydb/tests/functional/scheme_shard/ya.make
+++ b/ydb/tests/functional/scheme_shard/ya.make
@@ -1,26 +1,26 @@
OWNER(g:kikimr)
PY3TEST()
ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd")
-
-TEST_SRCS(
+
+TEST_SRCS(
test_copy_ops.py
test_alter_ops.py
- test_scheme_shard_operations.py
-)
-
+ test_scheme_shard_operations.py
+)
+
TIMEOUT(600)
SIZE(MEDIUM)
-
-DEPENDS(
+
+DEPENDS(
ydb/apps/ydbd
-)
-
-PEERDIR(
+)
+
+PEERDIR(
ydb/tests/library
-)
-
-FORK_SUBTESTS()
-FORK_TEST_FILES()
-
-END()
-
+)
+
+FORK_SUBTESTS()
+FORK_TEST_FILES()
+
+END()
+
diff --git a/ydb/tests/functional/scheme_tests/tablet_scheme_tests.py b/ydb/tests/functional/scheme_tests/tablet_scheme_tests.py
index a057a6c5d83..49e6b73d654 100644
--- a/ydb/tests/functional/scheme_tests/tablet_scheme_tests.py
+++ b/ydb/tests/functional/scheme_tests/tablet_scheme_tests.py
@@ -48,10 +48,10 @@ class TestTabletSchemes(object):
cls.cluster.stop()
@classmethod
- def setup_class(cls):
+ def setup_class(cls):
cls.cluster = kikimr_cluster_factory()
- cls.cluster.start()
- cls.client = cls.cluster.client
+ cls.cluster.start()
+ cls.client = cls.cluster.client
cls.shard_index = itertools.count(start=1)
cls.to_prepare = (
TabletTypes.PERSQUEUE, TabletTypes.KEYVALUEFLAT, TabletTypes.FLAT_DATASHARD, TabletTypes.KESUS)
diff --git a/ydb/tests/library/common/composite_assert.py b/ydb/tests/library/common/composite_assert.py
index 38087494cba..82dc522d40f 100644
--- a/ydb/tests/library/common/composite_assert.py
+++ b/ydb/tests/library/common/composite_assert.py
@@ -1,49 +1,49 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
from hamcrest import assert_that
-
-
-def exception_to_string(e):
- return "=" * 80 + str(e) + "=" * 80
-
-
-class CompositeAssertionError(AssertionError):
- def __init__(self, list_of_exceptions):
- super(CompositeAssertionError, self).__init__()
- self.__list_of_exceptions = list_of_exceptions
-
- def __repr__(self):
- return self.__str__()
-
- def __str__(self):
- return "with assertions =\n{}".format("\n".join(map(exception_to_string, self.__list_of_exceptions)))
-
-
-class CompositeAssert(object):
- def __init__(self):
- super(CompositeAssert, self).__init__()
- self.__list_of_assertion_errors = []
-
- def __enter__(self):
- return self
-
- def assert_that(self, arg1, arg2=None, arg3=''):
- try:
- if arg3:
- arg3 = '\n' + arg3
- assert_that(arg1, arg2, arg3)
- except AssertionError as e:
- self.__list_of_assertion_errors.append(e)
-
- def finish(self):
- return self.__exit__(None, None, None)
-
- def __exit__(self, type_, value, traceback):
- if self.__list_of_assertion_errors:
- raise CompositeAssertionError(self.__list_of_assertion_errors)
- return False
-
-
+
+
+def exception_to_string(e):
+ return "=" * 80 + str(e) + "=" * 80
+
+
+class CompositeAssertionError(AssertionError):
+ def __init__(self, list_of_exceptions):
+ super(CompositeAssertionError, self).__init__()
+ self.__list_of_exceptions = list_of_exceptions
+
+ def __repr__(self):
+ return self.__str__()
+
+ def __str__(self):
+ return "with assertions =\n{}".format("\n".join(map(exception_to_string, self.__list_of_exceptions)))
+
+
+class CompositeAssert(object):
+ def __init__(self):
+ super(CompositeAssert, self).__init__()
+ self.__list_of_assertion_errors = []
+
+ def __enter__(self):
+ return self
+
+ def assert_that(self, arg1, arg2=None, arg3=''):
+ try:
+ if arg3:
+ arg3 = '\n' + arg3
+ assert_that(arg1, arg2, arg3)
+ except AssertionError as e:
+ self.__list_of_assertion_errors.append(e)
+
+ def finish(self):
+ return self.__exit__(None, None, None)
+
+ def __exit__(self, type_, value, traceback):
+ if self.__list_of_assertion_errors:
+ raise CompositeAssertionError(self.__list_of_assertion_errors)
+ return False
+
+
# ToDo: Refactor to use CompositeAssert instead of this.
class CompositeCheckResult(object):
def __init__(self):
diff --git a/ydb/tests/library/common/delayed.py b/ydb/tests/library/common/delayed.py
index 98aca17df0f..7cb8630cd60 100644
--- a/ydb/tests/library/common/delayed.py
+++ b/ydb/tests/library/common/delayed.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
from hamcrest import has_properties, contains_inanyorder, is_not
import logging
import time
@@ -9,7 +9,7 @@ from ydb.tests.library.common.types import TabletStates
from ydb.tests.library.wardens import hive
logger = logging.getLogger(__name__)
-
+
def wait_tablets_state_by_id(
client, state, tablet_ids=(), message='', timeout_seconds=120, skip_generations=None, generation_matcher=None):
@@ -18,11 +18,11 @@ def wait_tablets_state_by_id(
skip_generations = {}
if generation_matcher is None:
generation_matcher = is_not
-
+
def query_tablet_state():
- return client.tablet_state(tablet_ids=tablet_ids)
+ return client.tablet_state(tablet_ids=tablet_ids)
- wait_for_and_assert(
+ wait_for_and_assert(
query_tablet_state,
DynamicFieldsProtobufMatcher().TabletStateInfo(
contains_inanyorder(*(
@@ -34,11 +34,11 @@ def wait_tablets_state_by_id(
for tablet_id in tablet_ids
))
),
- message=message,
- timeout_seconds=timeout_seconds,
- log_progress=True
- )
- return None
+ message=message,
+ timeout_seconds=timeout_seconds,
+ log_progress=True
+ )
+ return None
def collect_tablets_state(client, tablet_ids=()):
diff --git a/ydb/tests/library/common/helpers.py b/ydb/tests/library/common/helpers.py
index 24ac41f4083..12afc5e6579 100644
--- a/ydb/tests/library/common/helpers.py
+++ b/ydb/tests/library/common/helpers.py
@@ -1,62 +1,62 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-
-def unpack_list(list_of_tuples_of_tuples_and_values):
- """
- >>> unpack_list([((1, 2), 3), ((5, 6), 7)])
- [(1, 2, 3), (5, 6, 7)]
- >>> unpack_list([((1, 2, 3), 4), ((5, 6), (7, 8))])
- [(1, 2, 3, 4), (5, 6, 7, 8)]
- >>> unpack_list(unpack_list([((1, 2, 3), 4), ((5, 6), (7, 8))]))
- [(1, 2, 3, 4), (5, 6, 7, 8)]
-
- Only one level of nesting gets unpacked
- >>> unpack_list([(1, ), (2, 3), (4, 5, (6, (7, (8, ), 9), 10))])
- [(1,), (2, 3), (4, 5, 6, (7, (8,), 9), 10)]
-
- More unpacking, means more levels will be unpacked
- >>> unpack_list(unpack_list([(1, ), (2, 3), (4, 5, (6, (7, (8, ), 9), 10))]))
- [(1,), (2, 3), (4, 5, 6, 7, (8,), 9, 10)]
-
- More unpacking, means more levels will be unpacked
- >>> unpack_list(unpack_list(unpack_list([(1, ), (2, 3), (4, 5, (6, (7, (8, ), 9), 10))])))
- [(1,), (2, 3), (4, 5, 6, 7, 8, 9, 10)]
- >>> unpack_list(unpack_list(unpack_list(unpack_list([(1, ), (2, 3), (4, 5, (6, (7, (8, ), 9), 10))]))))
- [(1,), (2, 3), (4, 5, 6, 7, 8, 9, 10)]
- """
- res = []
- for tuple_of_tuples_and_values in list_of_tuples_of_tuples_and_values:
- unpacked_tuple = []
- for x in tuple_of_tuples_and_values:
- if isinstance(x, tuple):
- unpacked_tuple += list(x)
- else:
- unpacked_tuple += [x]
- res.append(tuple(unpacked_tuple))
- return res
-
-
-def wrap_in_list(item):
- """
- >>> wrap_in_list(1)
- [1]
- >>> wrap_in_list([1])
- [1]
- >>> wrap_in_list([1, 2])
- [1, 2]
-
- Beware the None case and other alike
- >>> wrap_in_list(None)
- [None]
- >>> wrap_in_list('')
- ['']
- >>> wrap_in_list(())
- [()]
-
- :return: list of items
- """
- if isinstance(item, list):
- return item
- else:
- return [item]
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+def unpack_list(list_of_tuples_of_tuples_and_values):
+ """
+ >>> unpack_list([((1, 2), 3), ((5, 6), 7)])
+ [(1, 2, 3), (5, 6, 7)]
+ >>> unpack_list([((1, 2, 3), 4), ((5, 6), (7, 8))])
+ [(1, 2, 3, 4), (5, 6, 7, 8)]
+ >>> unpack_list(unpack_list([((1, 2, 3), 4), ((5, 6), (7, 8))]))
+ [(1, 2, 3, 4), (5, 6, 7, 8)]
+
+ Only one level of nesting gets unpacked
+ >>> unpack_list([(1, ), (2, 3), (4, 5, (6, (7, (8, ), 9), 10))])
+ [(1,), (2, 3), (4, 5, 6, (7, (8,), 9), 10)]
+
+ More unpacking, means more levels will be unpacked
+ >>> unpack_list(unpack_list([(1, ), (2, 3), (4, 5, (6, (7, (8, ), 9), 10))]))
+ [(1,), (2, 3), (4, 5, 6, 7, (8,), 9, 10)]
+
+ More unpacking, means more levels will be unpacked
+ >>> unpack_list(unpack_list(unpack_list([(1, ), (2, 3), (4, 5, (6, (7, (8, ), 9), 10))])))
+ [(1,), (2, 3), (4, 5, 6, 7, 8, 9, 10)]
+ >>> unpack_list(unpack_list(unpack_list(unpack_list([(1, ), (2, 3), (4, 5, (6, (7, (8, ), 9), 10))]))))
+ [(1,), (2, 3), (4, 5, 6, 7, 8, 9, 10)]
+ """
+ res = []
+ for tuple_of_tuples_and_values in list_of_tuples_of_tuples_and_values:
+ unpacked_tuple = []
+ for x in tuple_of_tuples_and_values:
+ if isinstance(x, tuple):
+ unpacked_tuple += list(x)
+ else:
+ unpacked_tuple += [x]
+ res.append(tuple(unpacked_tuple))
+ return res
+
+
+def wrap_in_list(item):
+ """
+ >>> wrap_in_list(1)
+ [1]
+ >>> wrap_in_list([1])
+ [1]
+ >>> wrap_in_list([1, 2])
+ [1, 2]
+
+ Beware the None case and other alike
+ >>> wrap_in_list(None)
+ [None]
+ >>> wrap_in_list('')
+ ['']
+ >>> wrap_in_list(())
+ [()]
+
+ :return: list of items
+ """
+ if isinstance(item, list):
+ return item
+ else:
+ return [item]
diff --git a/ydb/tests/library/common/msgbus_types.py b/ydb/tests/library/common/msgbus_types.py
index 475837f0cde..295c512782a 100644
--- a/ydb/tests/library/common/msgbus_types.py
+++ b/ydb/tests/library/common/msgbus_types.py
@@ -24,14 +24,14 @@ class MessageBusStatus(enum.IntEnum):
MSTATUS_INTERNALERROR = 133
MSTATUS_REJECTED = 134
- @staticmethod
- def is_ok_status(status):
+ @staticmethod
+ def is_ok_status(status):
return status in (
MessageBusStatus.MSTATUS_OK,
MessageBusStatus.MSTATUS_INPROGRESS
)
-
+
@enum.unique
class EMessageStatus(enum.IntEnum):
"""
@@ -53,57 +53,57 @@ class EMessageStatus(enum.IntEnum):
MESSAGE_SERVICE_TOOMANY = 13
MESSAGE_SHUTDOWN = 14
MESSAGE_DONT_ASK = 15
-
-
+
+
@enum.unique
class EReplyStatus(enum.IntEnum):
- """
+ """
See /arcadia/ydb/core/protos/base.proto
- """
- OK = 0
- ERROR = 1
- ALREADY = 2
- TIMEOUT = 3
- RACE = 4
- NODATA = 5
- BLOCKED = 6
- NOTREADY = 7
- OVERRUN = 8
- TRYLATER = 9
- TRYLATER_TIME = 10
- TRYLATER_SIZE = 11
- DEADLINE = 12
- CORRUPTED = 13
- UNKNOWN = 255
-
-
+ """
+ OK = 0
+ ERROR = 1
+ ALREADY = 2
+ TIMEOUT = 3
+ RACE = 4
+ NODATA = 5
+ BLOCKED = 6
+ NOTREADY = 7
+ OVERRUN = 8
+ TRYLATER = 9
+ TRYLATER_TIME = 10
+ TRYLATER_SIZE = 11
+ DEADLINE = 12
+ CORRUPTED = 13
+ UNKNOWN = 255
+
+
@enum.unique
class TStorageStatusFlags(enum.IntEnum):
- """
- See /arcadia/kikimr/core/base/blobstorage.h
- TStorageStatusFlags::EStatus
- """
- StatusIsValid = 1,
- StatusDiskSpaceYellow = 1 << 1,
- StatusDiskSpaceOrange = 1 << 2,
- StatusDiskSpaceRed = 1 << 3
-
-
+ """
+ See /arcadia/kikimr/core/base/blobstorage.h
+ TStorageStatusFlags::EStatus
+ """
+ StatusIsValid = 1,
+ StatusDiskSpaceYellow = 1 << 1,
+ StatusDiskSpaceOrange = 1 << 2,
+ StatusDiskSpaceRed = 1 << 3
+
+
@enum.unique
class SchemeStatus(enum.IntEnum):
- """
+ """
See /arcadia/ydb/core/protos/flat_tx_scheme.proto
- enum EStatus
- """
- StatusSuccess = 0
- StatusAccepted = 1
- StatusPathDoesNotExist = 2
- StatusPathIsNotDirectory = 3
- StatusAlreadyExists = 4
- StatusSchemeError = 5
- StatusNameConflict = 6
- StatusInvalidParameter = 7
- StatusMultipleModifications = 8
+ enum EStatus
+ """
+ StatusSuccess = 0
+ StatusAccepted = 1
+ StatusPathDoesNotExist = 2
+ StatusPathIsNotDirectory = 3
+ StatusAlreadyExists = 4
+ StatusSchemeError = 5
+ StatusNameConflict = 6
+ StatusInvalidParameter = 7
+ StatusMultipleModifications = 8
ProxyShardNotAvailable = 13
diff --git a/ydb/tests/library/common/protobuf.py b/ydb/tests/library/common/protobuf.py
index 9dc40653fa3..05d7f0769a6 100644
--- a/ydb/tests/library/common/protobuf.py
+++ b/ydb/tests/library/common/protobuf.py
@@ -1,40 +1,40 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import abc
-from collections import namedtuple
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import abc
+from collections import namedtuple
import six
-from hamcrest import has_properties
-
+from hamcrest import has_properties
+
import ydb.core.protos.msgbus_kv_pb2 as msgbus_kv
import ydb.core.protos.msgbus_pb2 as msgbus
-
-
-def build_protobuf_if_necessary(protobuf_builder):
- if hasattr(protobuf_builder, 'protobuf'):
- return protobuf_builder.protobuf
- else:
- return protobuf_builder
-
-
-class AbstractProtobufBuilder(object):
- __metaclass__ = abc.ABCMeta
-
- def __init__(self, protobuf_object):
- super(AbstractProtobufBuilder, self).__init__()
- self.__protobuf = protobuf_object
- self.__hash = None
-
- @property
- def protobuf(self):
- return self.__protobuf
-
- def __hash__(self):
- if self.__hash is None:
- self.__hash = hash(str(self.protobuf))
- return self.__hash
-
-
+
+
+def build_protobuf_if_necessary(protobuf_builder):
+ if hasattr(protobuf_builder, 'protobuf'):
+ return protobuf_builder.protobuf
+ else:
+ return protobuf_builder
+
+
+class AbstractProtobufBuilder(object):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, protobuf_object):
+ super(AbstractProtobufBuilder, self).__init__()
+ self.__protobuf = protobuf_object
+ self.__hash = None
+
+ @property
+ def protobuf(self):
+ return self.__protobuf
+
+ def __hash__(self):
+ if self.__hash is None:
+ self.__hash = hash(str(self.protobuf))
+ return self.__hash
+
+
def to_bytes(v):
if v is None:
return None
@@ -47,182 +47,182 @@ def to_bytes(v):
return v
-class KVRequest(AbstractProtobufBuilder):
-
- def __init__(self):
- super(KVRequest, self).__init__(msgbus_kv.TKeyValueRequest())
-
- def write(self, key, value):
- write_cmd = self.protobuf.CmdWrite.add()
+class KVRequest(AbstractProtobufBuilder):
+
+ def __init__(self):
+ super(KVRequest, self).__init__(msgbus_kv.TKeyValueRequest())
+
+ def write(self, key, value):
+ write_cmd = self.protobuf.CmdWrite.add()
write_cmd.Key = to_bytes(key)
write_cmd.Value = to_bytes(value)
- return self
-
- def read(self, key, offset=0, size=0):
- read_cmd = self.protobuf.CmdRead.add()
+ return self
+
+ def read(self, key, offset=0, size=0):
+ read_cmd = self.protobuf.CmdRead.add()
read_cmd.Key = to_bytes(key)
- if offset:
- read_cmd.Offset = offset
- if size:
- read_cmd.Size = size
- return self
-
- def read_range(self, key_range, include_data=True, limit_bytes=None):
- read_range = self.protobuf.CmdReadRange.add()
+ if offset:
+ read_cmd.Offset = offset
+ if size:
+ read_cmd.Size = size
+ return self
+
+ def read_range(self, key_range, include_data=True, limit_bytes=None):
+ read_range = self.protobuf.CmdReadRange.add()
read_range.Range.From = to_bytes(key_range.from_key)
- read_range.Range.IncludeFrom = key_range.include_from
+ read_range.Range.IncludeFrom = key_range.include_from
read_range.Range.To = to_bytes(key_range.to_key)
- read_range.Range.IncludeTo = key_range.include_to
- read_range.IncludeData = include_data
- if limit_bytes is not None:
- read_range.LimitBytes = limit_bytes
- return self
-
- def copy_range(self, prefix_to_add, key_range=None, prefix_to_remove=None):
- clone_range = self.protobuf.CmdCopyRange.add()
+ read_range.Range.IncludeTo = key_range.include_to
+ read_range.IncludeData = include_data
+ if limit_bytes is not None:
+ read_range.LimitBytes = limit_bytes
+ return self
+
+ def copy_range(self, prefix_to_add, key_range=None, prefix_to_remove=None):
+ clone_range = self.protobuf.CmdCopyRange.add()
clone_range.PrefixToAdd = to_bytes(prefix_to_add)
- if key_range is not None:
+ if key_range is not None:
clone_range.Range.From = to_bytes(key_range.from_key)
- clone_range.Range.IncludeFrom = key_range.include_from
+ clone_range.Range.IncludeFrom = key_range.include_from
clone_range.Range.To = to_bytes(key_range.to_key)
- clone_range.Range.IncludeTo = key_range.include_to
- if prefix_to_remove is not None:
+ clone_range.Range.IncludeTo = key_range.include_to
+ if prefix_to_remove is not None:
clone_range.PrefixToRemove = to_bytes(prefix_to_remove)
- return self
-
- def concat(self, output_key, input_keys=None, keep_input=None):
- concat_cmd = self.protobuf.CmdConcat.add()
+ return self
+
+ def concat(self, output_key, input_keys=None, keep_input=None):
+ concat_cmd = self.protobuf.CmdConcat.add()
concat_cmd.OutputKey = to_bytes(output_key)
- if input_keys is not None:
+ if input_keys is not None:
concat_cmd.InputKeys.extend(list(map(to_bytes, input_keys)))
- if keep_input is not None:
- concat_cmd.KeepInputs = keep_input
-
- return self
-
- def inc_generation(self):
- self.protobuf.CmdIncrementGeneration.CopyFrom(self.protobuf.TCmdIncrementGeneration())
- return self
-
- def add_storage_channel_status(self, storage_channel_type=msgbus_kv.TKeyValueRequest.MAIN):
- self.protobuf.CmdGetStatus.add(
- StorageChannel=storage_channel_type
- )
- return self
-
-
-class THiveCreateTablet(AbstractProtobufBuilder):
-
- def __init__(self, domain_id=1):
- super(THiveCreateTablet, self).__init__(msgbus.THiveCreateTablet())
- self.protobuf.DomainUid = domain_id
-
- def create_tablet(self, owner_id, owner_idx, tablet_type, channels_profile=0, allowed_node_ids=()):
- create_tablet_cmd = self.protobuf.CmdCreateTablet.add()
- create_tablet_cmd.OwnerId = owner_id
- create_tablet_cmd.OwnerIdx = owner_idx
- create_tablet_cmd.TabletType = int(tablet_type)
- create_tablet_cmd.ChannelsProfile = channels_profile
- if allowed_node_ids:
- create_tablet_cmd.AllowedNodeIDs.extend(allowed_node_ids)
- return self
-
- def lookup_tablet(self, owner_id, owner_idx):
- self.protobuf.CmdLookupTablet.add(
- OwnerId=owner_id,
- OwnerIdx=owner_idx
- )
- return self
-
-
-class TCmdCreateTablet(
+ if keep_input is not None:
+ concat_cmd.KeepInputs = keep_input
+
+ return self
+
+ def inc_generation(self):
+ self.protobuf.CmdIncrementGeneration.CopyFrom(self.protobuf.TCmdIncrementGeneration())
+ return self
+
+ def add_storage_channel_status(self, storage_channel_type=msgbus_kv.TKeyValueRequest.MAIN):
+ self.protobuf.CmdGetStatus.add(
+ StorageChannel=storage_channel_type
+ )
+ return self
+
+
+class THiveCreateTablet(AbstractProtobufBuilder):
+
+ def __init__(self, domain_id=1):
+ super(THiveCreateTablet, self).__init__(msgbus.THiveCreateTablet())
+ self.protobuf.DomainUid = domain_id
+
+ def create_tablet(self, owner_id, owner_idx, tablet_type, channels_profile=0, allowed_node_ids=()):
+ create_tablet_cmd = self.protobuf.CmdCreateTablet.add()
+ create_tablet_cmd.OwnerId = owner_id
+ create_tablet_cmd.OwnerIdx = owner_idx
+ create_tablet_cmd.TabletType = int(tablet_type)
+ create_tablet_cmd.ChannelsProfile = channels_profile
+ if allowed_node_ids:
+ create_tablet_cmd.AllowedNodeIDs.extend(allowed_node_ids)
+ return self
+
+ def lookup_tablet(self, owner_id, owner_idx):
+ self.protobuf.CmdLookupTablet.add(
+ OwnerId=owner_id,
+ OwnerIdx=owner_idx
+ )
+ return self
+
+
+class TCmdCreateTablet(
namedtuple('TCmdCreateTablet', ['owner_id', 'owner_idx', 'type', 'allowed_node_ids', 'channels_profile', 'binded_channels'])
-):
+):
def __new__(cls, owner_id, owner_idx, type, allowed_node_ids=(), channels_profile=0, binded_channels=None):
return super(TCmdCreateTablet, cls).__new__(cls, owner_id, owner_idx, type, allowed_node_ids, channels_profile, binded_channels)
-
-
-TCmdWrite = namedtuple('TCmdWrite', ['key', 'value'])
-
-
+
+
+TCmdWrite = namedtuple('TCmdWrite', ['key', 'value'])
+
+
class TCmdRead(namedtuple('TCmdRead', ['key', 'offset', 'size'])):
pass
-
- @staticmethod
- def full_key(key):
- return TCmdRead(key=key, offset=0, size=0)
-
-
-class TKeyRange(
+
+ @staticmethod
+ def full_key(key):
+ return TCmdRead(key=key, offset=0, size=0)
+
+
+class TKeyRange(
namedtuple('TKeyRange', ['from_key', 'to_key', 'include_from', 'include_to', 'include_data', 'limit_bytes'])):
- def __new__(cls, from_key, to_key, include_from=True, include_to=True, include_data=True, limit_bytes=None):
+ def __new__(cls, from_key, to_key, include_from=True, include_to=True, include_data=True, limit_bytes=None):
return super(TKeyRange, cls).__new__(cls, to_bytes(from_key), to_bytes(to_key), include_from, include_to, include_data, limit_bytes)
-
- @staticmethod
- def range(func, from_, to_, include_from=True, include_to=True):
- from_ = func(from_)
- to_ = func(to_)
- return TKeyRange(from_, to_, include_from, include_to)
-
- @staticmethod
- def full_range():
- from_ = ''
- to_ = chr(255)
- return TKeyRange(from_, to_)
-
- def __contains__(self, item):
- return (
- (
- self.include_from and self.from_key <= item
- or not self.include_from and self.from_key < item
- ) and (
- self.include_to and item <= self.to_key
- or not self.include_to and item < self.to_key
- )
- )
-
-
-class TKeyValuePair(namedtuple('TKeyValuePair', ['key', 'value', 'size', 'creation_time'])):
- """
+
+ @staticmethod
+ def range(func, from_, to_, include_from=True, include_to=True):
+ from_ = func(from_)
+ to_ = func(to_)
+ return TKeyRange(from_, to_, include_from, include_to)
+
+ @staticmethod
+ def full_range():
+ from_ = ''
+ to_ = chr(255)
+ return TKeyRange(from_, to_)
+
+ def __contains__(self, item):
+ return (
+ (
+ self.include_from and self.from_key <= item
+ or not self.include_from and self.from_key < item
+ ) and (
+ self.include_to and item <= self.to_key
+ or not self.include_to and item < self.to_key
+ )
+ )
+
+
+class TKeyValuePair(namedtuple('TKeyValuePair', ['key', 'value', 'size', 'creation_time'])):
+ """
See TKeyValuePair from ydb/core/protos/msgbus_kv.proto
- """
- def __new__(cls, key, value, size=None, creation_time=None):
- if size is None and value is not None:
- size = len(value)
+ """
+ def __new__(cls, key, value, size=None, creation_time=None):
+ if size is None and value is not None:
+ size = len(value)
return super(TKeyValuePair, cls).__new__(cls, to_bytes(key), to_bytes(value), size, creation_time)
-
- def __cmp__(self, other):
- return self.key - other.key
-
- def protobuf_matcher(self):
- if self.creation_time is not None and self.size is not None and self.value is not None:
- return has_properties(
- Key=self.key,
- Value=self.value,
- ValueSize=self.size,
- CreationUnixTime=self.creation_time
- )
- elif self.value is not None:
- return has_properties(
- Key=self.key,
- Value=self.value,
- ValueSize=self.size
- )
- elif self.size is not None:
- return has_properties(
- Key=self.key,
- ValueSize=self.size
- )
- else:
- return has_properties(
- Key=self.key
- )
-
-
-TCmdRename = namedtuple('TCmdRename', ['old_key', 'new_key'])
-
-
+
+ def __cmp__(self, other):
+ return self.key - other.key
+
+ def protobuf_matcher(self):
+ if self.creation_time is not None and self.size is not None and self.value is not None:
+ return has_properties(
+ Key=self.key,
+ Value=self.value,
+ ValueSize=self.size,
+ CreationUnixTime=self.creation_time
+ )
+ elif self.value is not None:
+ return has_properties(
+ Key=self.key,
+ Value=self.value,
+ ValueSize=self.size
+ )
+ elif self.size is not None:
+ return has_properties(
+ Key=self.key,
+ ValueSize=self.size
+ )
+ else:
+ return has_properties(
+ Key=self.key
+ )
+
+
+TCmdRename = namedtuple('TCmdRename', ['old_key', 'new_key'])
+
+
class TSchemeDescribe(AbstractProtobufBuilder):
- def __init__(self, path):
+ def __init__(self, path):
super(TSchemeDescribe, self).__init__(msgbus.TSchemeDescribe())
- self.protobuf.Path = path
+ self.protobuf.Path = path
diff --git a/ydb/tests/library/common/protobuf_kv.py b/ydb/tests/library/common/protobuf_kv.py
index 6f7563b3ee5..f51e4e48023 100644
--- a/ydb/tests/library/common/protobuf_kv.py
+++ b/ydb/tests/library/common/protobuf_kv.py
@@ -1,32 +1,32 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import string
-
-from enum import unique, IntEnum
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import string
+
+from enum import unique, IntEnum
+
import ydb.core.protos.msgbus_kv_pb2 as msgbus_kv
-
-
-@unique
-class EStorageChannel(IntEnum):
- MAIN = 0
- EXTRA = 1
- EXTRA2 = 2
- EXTRA3 = 3
- EXTRA4 = 4
- EXTRA5 = 5
- INLINE = 65535
-
- def to_protobuf_object(self):
- return getattr(msgbus_kv.TKeyValueRequest, self.name)
-
- @staticmethod
- def from_string(s):
- """
- >>> EStorageChannel.from_string('MAIN')
- <EStorageChannel.MAIN: 0>
- >>> EStorageChannel.MAIN.name
- 'MAIN'
- """
- s = string.upper(s)
- return EStorageChannel[s]
+
+
+@unique
+class EStorageChannel(IntEnum):
+ MAIN = 0
+ EXTRA = 1
+ EXTRA2 = 2
+ EXTRA3 = 3
+ EXTRA4 = 4
+ EXTRA5 = 5
+ INLINE = 65535
+
+ def to_protobuf_object(self):
+ return getattr(msgbus_kv.TKeyValueRequest, self.name)
+
+ @staticmethod
+ def from_string(s):
+ """
+ >>> EStorageChannel.from_string('MAIN')
+ <EStorageChannel.MAIN: 0>
+ >>> EStorageChannel.MAIN.name
+ 'MAIN'
+ """
+ s = string.upper(s)
+ return EStorageChannel[s]
diff --git a/ydb/tests/library/common/protobuf_ss.py b/ydb/tests/library/common/protobuf_ss.py
index 90b0638eb41..677f894f96e 100644
--- a/ydb/tests/library/common/protobuf_ss.py
+++ b/ydb/tests/library/common/protobuf_ss.py
@@ -1,51 +1,51 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import itertools
-import string
-from os.path import basename, dirname, join
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import itertools
+import string
+from os.path import basename, dirname, join
+
from ydb.core.protos import msgbus_pb2
from ydb.core.protos import flat_scheme_op_pb2
from ydb.tests.library.common.protobuf import AbstractProtobufBuilder, build_protobuf_if_necessary
-
-
+
+
DEFAULT_SIZE_TO_SPLIT = 10 ** 6
-class TPartitionConfig(AbstractProtobufBuilder):
- """
+class TPartitionConfig(AbstractProtobufBuilder):
+ """
See /arcadia/ydb/core/protos/flat_scheme_op_pb2.proto
- """
-
- def __init__(self):
+ """
+
+ def __init__(self):
super(TPartitionConfig, self).__init__(flat_scheme_op_pb2.TPartitionConfig())
self.with_partitioning_policy(DEFAULT_SIZE_TO_SPLIT)
-
- def __ensure_has_compaction_policy(self):
- if not self.protobuf.HasField('CompactionPolicy'):
+
+ def __ensure_has_compaction_policy(self):
+ if not self.protobuf.HasField('CompactionPolicy'):
self.protobuf.CompactionPolicy.CopyFrom(flat_scheme_op_pb2.TCompactionPolicy())
- # default values
- self.protobuf.CompactionPolicy.ReadAheadHiThreshold = 67108864
- self.protobuf.CompactionPolicy.ReadAheadLoThreshold = 16777216
-
- def add_compaction_policy_generation(
- self, generation_id,
- size_to_compact, count_to_compact,
- force_size_to_compact, force_count_to_compact,
- compaction_broker_queue, keep_in_cache=False
- ):
- self.__ensure_has_compaction_policy()
- self.protobuf.CompactionPolicy.Generation.add(
- GenerationId=generation_id,
- SizeToCompact=size_to_compact,
- CountToCompact=count_to_compact,
- ForceCountToCompact=force_count_to_compact,
- ForceSizeToCompact=force_size_to_compact,
- CompactionBrokerQueue=compaction_broker_queue,
- KeepInCache=keep_in_cache,
- )
- return self
-
+ # default values
+ self.protobuf.CompactionPolicy.ReadAheadHiThreshold = 67108864
+ self.protobuf.CompactionPolicy.ReadAheadLoThreshold = 16777216
+
+ def add_compaction_policy_generation(
+ self, generation_id,
+ size_to_compact, count_to_compact,
+ force_size_to_compact, force_count_to_compact,
+ compaction_broker_queue, keep_in_cache=False
+ ):
+ self.__ensure_has_compaction_policy()
+ self.protobuf.CompactionPolicy.Generation.add(
+ GenerationId=generation_id,
+ SizeToCompact=size_to_compact,
+ CountToCompact=count_to_compact,
+ ForceCountToCompact=force_count_to_compact,
+ ForceSizeToCompact=force_size_to_compact,
+ CompactionBrokerQueue=compaction_broker_queue,
+ KeepInCache=keep_in_cache,
+ )
+ return self
+
def with_tx_read_size_limit(self, tx_read_size_limit):
self.protobuf.TxReadSizeLimit = tx_read_size_limit
return self
@@ -54,48 +54,48 @@ class TPartitionConfig(AbstractProtobufBuilder):
self.protobuf.ExecutorCacheSize = executor_cache_size
return self
- def with_in_mem_size_to_snapshot(self, in_mem_size_to_snapshot):
- self.__ensure_has_compaction_policy()
- self.protobuf.CompactionPolicy.InMemSizeToSnapshot = in_mem_size_to_snapshot
- return self
-
- def with_in_mem_steps_to_snapshot(self, in_mem_steps_to_snapshot):
- self.__ensure_has_compaction_policy()
- self.protobuf.CompactionPolicy.InMemStepsToSnapshot = in_mem_steps_to_snapshot
- return self
-
- def with_in_mem_force_size_to_snapshot(self, in_mem_force_size_to_snapshot):
- self.__ensure_has_compaction_policy()
- self.protobuf.CompactionPolicy.InMemForceSizeToSnapshot = in_mem_force_size_to_snapshot
- return self
-
- def with_in_mem_force_steps_to_snapshot(self, in_mem_force_steps_to_snapshot):
- self.__ensure_has_compaction_policy()
- self.protobuf.CompactionPolicy.InMemForceStepsToSnapshot = in_mem_force_steps_to_snapshot
- return self
-
+ def with_in_mem_size_to_snapshot(self, in_mem_size_to_snapshot):
+ self.__ensure_has_compaction_policy()
+ self.protobuf.CompactionPolicy.InMemSizeToSnapshot = in_mem_size_to_snapshot
+ return self
+
+ def with_in_mem_steps_to_snapshot(self, in_mem_steps_to_snapshot):
+ self.__ensure_has_compaction_policy()
+ self.protobuf.CompactionPolicy.InMemStepsToSnapshot = in_mem_steps_to_snapshot
+ return self
+
+ def with_in_mem_force_size_to_snapshot(self, in_mem_force_size_to_snapshot):
+ self.__ensure_has_compaction_policy()
+ self.protobuf.CompactionPolicy.InMemForceSizeToSnapshot = in_mem_force_size_to_snapshot
+ return self
+
+ def with_in_mem_force_steps_to_snapshot(self, in_mem_force_steps_to_snapshot):
+ self.__ensure_has_compaction_policy()
+ self.protobuf.CompactionPolicy.InMemForceStepsToSnapshot = in_mem_force_steps_to_snapshot
+ return self
+
def with_followers(self, follower_count, allow_follower_promotion=True):
self.protobuf.FollowerCount = follower_count
self.protobuf.AllowFollowerPromotion = allow_follower_promotion
- return self
-
- def with_partitioning_policy(self, size_to_split_bytes):
- if size_to_split_bytes is not None:
- self.protobuf.PartitioningPolicy.SizeToSplit = size_to_split_bytes
- return self
-
-
-class CreatePath(AbstractProtobufBuilder):
- def __init__(self, work_dir, name=None):
+ return self
+
+ def with_partitioning_policy(self, size_to_split_bytes):
+ if size_to_split_bytes is not None:
+ self.protobuf.PartitioningPolicy.SizeToSplit = size_to_split_bytes
+ return self
+
+
+class CreatePath(AbstractProtobufBuilder):
+ def __init__(self, work_dir, name=None):
super(CreatePath, self).__init__(msgbus_pb2.TSchemeOperation())
- if name is None:
- name = basename(work_dir)
- work_dir = dirname(work_dir)
- self.protobuf.Transaction.ModifyScheme.WorkingDir = work_dir
+ if name is None:
+ name = basename(work_dir)
+ work_dir = dirname(work_dir)
+ self.protobuf.Transaction.ModifyScheme.WorkingDir = work_dir
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpMkDir
- self.protobuf.Transaction.ModifyScheme.MkDir.Name = name
-
-
+ self.protobuf.Transaction.ModifyScheme.MkDir.Name = name
+
+
class RegisterTenant(AbstractProtobufBuilder):
class Options(object):
def __init__(self):
@@ -172,20 +172,20 @@ class RegisterTenant(AbstractProtobufBuilder):
return self.protobuf.Transaction.ModifyScheme.SubDomain
-def list_of_create_path_builders_from_full_path(full_path):
- list_of_dirs = [path for path in string.split(full_path, '/') if path]
- ret = []
- prev = ''
- for dir_name in list_of_dirs:
- current = join(prev, dir_name)
- if prev:
- ret.append(CreatePath(prev, dir_name))
- else:
- current = '/' + current
- prev = current
- return ret
-
-
+def list_of_create_path_builders_from_full_path(full_path):
+ list_of_dirs = [path for path in string.split(full_path, '/') if path]
+ ret = []
+ prev = ''
+ for dir_name in list_of_dirs:
+ current = join(prev, dir_name)
+ if prev:
+ ret.append(CreatePath(prev, dir_name))
+ else:
+ current = '/' + current
+ prev = current
+ return ret
+
+
class AbstractTSchemeOperationRequest(AbstractProtobufBuilder):
"""
See
@@ -194,7 +194,7 @@ class AbstractTSchemeOperationRequest(AbstractProtobufBuilder):
"""
def __init__(self):
super(AbstractTSchemeOperationRequest, self).__init__(msgbus_pb2.TSchemeOperation())
-
+
class _DropPolicyOptions(object):
def __init__(self):
@@ -303,20 +303,20 @@ class DropTopicRequest(AbstractTSchemeOperationRequest):
self.__drop.Name = topic_name
self.with_options(options or self.Options())
- @property
+ @property
def __modify_scheme_transaction(self):
return self.protobuf.Transaction.ModifyScheme
-
+
@property
def __drop(self):
return self.__modify_scheme_transaction.Drop
-
+
def with_options(self, options):
assert isinstance(options, self.Options)
-
+
if options.drop_policy is not None:
self.__drop.WaitPolicy = options.drop_policy
-
+
return self
@@ -449,19 +449,19 @@ class AlterTopicRequest(CreateTopicRequest):
return self._modify_scheme_transaction.AlterPersQueueGroup
-class DropPath(AbstractProtobufBuilder):
+class DropPath(AbstractProtobufBuilder):
def __init__(self, work_dir, name=None, drop_policy=flat_scheme_op_pb2.EDropFailOnChanges):
super(DropPath, self).__init__(msgbus_pb2.TSchemeOperation())
if name is None:
name = basename(work_dir)
work_dir = dirname(work_dir)
- self.protobuf.Transaction.ModifyScheme.WorkingDir = work_dir
+ self.protobuf.Transaction.ModifyScheme.WorkingDir = work_dir
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpRmDir
- self.protobuf.Transaction.ModifyScheme.Drop.Name = name
- self.protobuf.Transaction.ModifyScheme.Drop.WaitPolicy = drop_policy
-
-
-class CreateTableRequest(AbstractTSchemeOperationRequest):
+ self.protobuf.Transaction.ModifyScheme.Drop.Name = name
+ self.protobuf.Transaction.ModifyScheme.Drop.WaitPolicy = drop_policy
+
+
+class CreateTableRequest(AbstractTSchemeOperationRequest):
class Options(object):
ColumnStorage1 = flat_scheme_op_pb2.ColumnStorage1
ColumnStorage2 = flat_scheme_op_pb2.ColumnStorage2
@@ -479,7 +479,7 @@ class CreateTableRequest(AbstractTSchemeOperationRequest):
}
self.__data_threshold = 0
self.__external_threshold = 0
-
+
def appoint_syslog(self, pool_kind, allow_subsitude=False):
self.__targets['syslog'] = (pool_kind, allow_subsitude)
return self
@@ -582,40 +582,40 @@ class CreateTableRequest(AbstractTSchemeOperationRequest):
return self
def __init__(self, path, table_name=None, options=None, use_options=True):
- super(CreateTableRequest, self).__init__()
- self.__column_ids = itertools.count(start=1)
-
+ super(CreateTableRequest, self).__init__()
+ self.__column_ids = itertools.count(start=1)
+
if table_name is None:
table_name = basename(path)
path = dirname(path)
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpCreateTable
-
- self.protobuf.Transaction.ModifyScheme.WorkingDir = path
- self.__create_table_protobuf.Name = table_name
-
+
+ self.protobuf.Transaction.ModifyScheme.WorkingDir = path
+ self.__create_table_protobuf.Name = table_name
+
if use_options:
self.with_options(
options or self.Options()
)
- @property
- def __create_table_protobuf(self):
- return self.protobuf.Transaction.ModifyScheme.CreateTable
-
+ @property
+ def __create_table_protobuf(self):
+ return self.protobuf.Transaction.ModifyScheme.CreateTable
+
def add_column(self, name, ptype, is_key=False, column_family=None):
kwargs = {'Name': name, 'Type': str(ptype), 'Id': next(self.__column_ids)}
if column_family is not None:
kwargs['Family'] = column_family
self.__create_table_protobuf.Columns.add(**kwargs)
- if is_key:
- self.__create_table_protobuf.KeyColumnNames.append(name)
- return self
-
- def with_partitions(self, uniform_partitions_count):
- self.__create_table_protobuf.UniformPartitionsCount = uniform_partitions_count
- return self
-
+ if is_key:
+ self.__create_table_protobuf.KeyColumnNames.append(name)
+ return self
+
+ def with_partitions(self, uniform_partitions_count):
+ self.__create_table_protobuf.UniformPartitionsCount = uniform_partitions_count
+ return self
+
def with_column_family(self, id_, storage, column_cache, codec=0,
storage_config=None):
family = self.__create_table_protobuf.PartitionConfig.ColumnFamilies.add(
@@ -629,10 +629,10 @@ class CreateTableRequest(AbstractTSchemeOperationRequest):
return self
- def with_partition_config(self, partition_config):
- self.__create_table_protobuf.PartitionConfig.CopyFrom(build_protobuf_if_necessary(partition_config))
- return self
-
+ def with_partition_config(self, partition_config):
+ self.__create_table_protobuf.PartitionConfig.CopyFrom(build_protobuf_if_necessary(partition_config))
+ return self
+
def with_options(self, options):
assert isinstance(options, self.Options)
@@ -647,7 +647,7 @@ class CreateTableRequest(AbstractTSchemeOperationRequest):
self.add_column(name, ptype, is_key, column_family)
return self
-
+
class AlterTableRequest(AbstractTSchemeOperationRequest):
def __init__(self, path, table_name):
@@ -690,21 +690,21 @@ class AlterTableRequest(AbstractTSchemeOperationRequest):
return self
-class DropTableRequest(AbstractTSchemeOperationRequest):
+class DropTableRequest(AbstractTSchemeOperationRequest):
class Options(_DropPolicyOptions):
pass
def __init__(self, path, table_name=None, drop_policy=flat_scheme_op_pb2.EDropFailOnChanges, options=None):
- super(DropTableRequest, self).__init__()
+ super(DropTableRequest, self).__init__()
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpDropTable
-
+
if table_name is None:
table_name = basename(path)
path = dirname(path)
-
+
self.protobuf.Transaction.ModifyScheme.WorkingDir = path
self.protobuf.Transaction.ModifyScheme.Drop.Name = table_name
-
+
fixed_options = options or self.Options()
fixed_options.with_drop_policy(drop_policy)
self.with_options(fixed_options)
@@ -719,35 +719,35 @@ class DropTableRequest(AbstractTSchemeOperationRequest):
class SchemeOperationStatus(AbstractProtobufBuilder):
- def __init__(self, tx_id, scheme_shard_id, timeout_seconds=120):
+ def __init__(self, tx_id, scheme_shard_id, timeout_seconds=120):
super(SchemeOperationStatus, self).__init__(msgbus_pb2.TSchemeOperationStatus())
- self.protobuf.FlatTxId.TxId = tx_id
- self.protobuf.FlatTxId.SchemeShardTabletId = scheme_shard_id
- self.protobuf.PollOptions.Timeout = timeout_seconds * 1000
-
-
+ self.protobuf.FlatTxId.TxId = tx_id
+ self.protobuf.FlatTxId.SchemeShardTabletId = scheme_shard_id
+ self.protobuf.PollOptions.Timeout = timeout_seconds * 1000
+
+
# make a synonym for old code
TSchemeOperationStatus = SchemeOperationStatus
-class CopyTableRequest(AbstractTSchemeOperationRequest):
- def __init__(self, source_table_full_name, destination_path, destination_name):
- super(CopyTableRequest, self).__init__()
+class CopyTableRequest(AbstractTSchemeOperationRequest):
+ def __init__(self, source_table_full_name, destination_path, destination_name):
+ super(CopyTableRequest, self).__init__()
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpCreateTable
- self.__create_table_protobuf.CopyFromTable = source_table_full_name
- self.protobuf.Transaction.ModifyScheme.WorkingDir = destination_path
- self.__create_table_protobuf.Name = destination_name
-
- @property
- def __create_table_protobuf(self):
- return self.protobuf.Transaction.ModifyScheme.CreateTable
-
+ self.__create_table_protobuf.CopyFromTable = source_table_full_name
+ self.protobuf.Transaction.ModifyScheme.WorkingDir = destination_path
+ self.__create_table_protobuf.Name = destination_name
+
+ @property
+ def __create_table_protobuf(self):
+ return self.protobuf.Transaction.ModifyScheme.CreateTable
+
def with_partition_config(self, partition_config):
self.__create_table_protobuf.PartitionConfig.CopyFrom(build_protobuf_if_necessary(partition_config))
return self
+
-
-class SchemeDescribeRequest(AbstractProtobufBuilder):
+class SchemeDescribeRequest(AbstractProtobufBuilder):
class Options(object):
def __init__(self):
self.__partition_info = False
@@ -783,8 +783,8 @@ class SchemeDescribeRequest(AbstractProtobufBuilder):
def __init__(self, full_path, options=None):
super(SchemeDescribeRequest, self).__init__(msgbus_pb2.TSchemeDescribe())
- self.protobuf.Path = full_path
-
+ self.protobuf.Path = full_path
+
options = options or self.Options()
self.with_options(options)
diff --git a/ydb/tests/library/common/types.py b/ydb/tests/library/common/types.py
index 5ec564d65fa..f722b545dda 100644
--- a/ydb/tests/library/common/types.py
+++ b/ydb/tests/library/common/types.py
@@ -1,12 +1,12 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
import codecs
-
-from enum import unique, Enum, IntEnum
+
+from enum import unique, Enum, IntEnum
from ydb.tests.library.common.generators import int_between, one_of, float_in, string_with_length, actor_id
-
-
+
+
@unique
class DeltaTypes(IntEnum):
AddTable = 1,
@@ -25,70 +25,70 @@ class DeltaTypes(IntEnum):
@unique
-class PDiskCategory(IntEnum):
- ROT = 0
- SSD = 1
-
-
-@unique
-class FailDomainType(IntEnum):
- DC = 10
- Room = 20
- Rack = 30
- Body = 40
-
-
-@unique
-class VDiskCategory(IntEnum):
- Default = 0
- Test1 = 1
- Test2 = 2
- Test3 = 3
- Log = 10
- Extra2 = 22
- Extra3 = 23
-
-
+class PDiskCategory(IntEnum):
+ ROT = 0
+ SSD = 1
+
+
+@unique
+class FailDomainType(IntEnum):
+ DC = 10
+ Room = 20
+ Rack = 30
+ Body = 40
+
+
+@unique
+class VDiskCategory(IntEnum):
+ Default = 0
+ Test1 = 1
+ Test2 = 2
+ Test3 = 3
+ Log = 10
+ Extra2 = 22
+ Extra3 = 23
+
+
def _erasure_type(id_, min_fail_domains, min_alive_replicas):
return id_, min_fail_domains, min_alive_replicas
-@unique
-class Erasure(Enum):
- NONE = _erasure_type(id_=0, min_fail_domains=1, min_alive_replicas=1)
- MIRROR_3 = _erasure_type(id_=1, min_fail_domains=4, min_alive_replicas=1)
- BLOCK_3_1 = _erasure_type(id_=2, min_fail_domains=5, min_alive_replicas=4)
- STRIPE_3_1 = _erasure_type(id_=3, min_fail_domains=5, min_alive_replicas=4)
- BLOCK_4_2 = _erasure_type(id_=4, min_fail_domains=8, min_alive_replicas=6)
- BLOCK_3_2 = _erasure_type(id_=5, min_fail_domains=7, min_alive_replicas=5)
- STRIPE_4_2 = _erasure_type(id_=6, min_fail_domains=8, min_alive_replicas=6)
- STRIPE_3_2 = _erasure_type(id_=7, min_fail_domains=7, min_alive_replicas=5)
- MIRROR_3_2 = _erasure_type(id_=8, min_fail_domains=5, min_alive_replicas=3)
+@unique
+class Erasure(Enum):
+ NONE = _erasure_type(id_=0, min_fail_domains=1, min_alive_replicas=1)
+ MIRROR_3 = _erasure_type(id_=1, min_fail_domains=4, min_alive_replicas=1)
+ BLOCK_3_1 = _erasure_type(id_=2, min_fail_domains=5, min_alive_replicas=4)
+ STRIPE_3_1 = _erasure_type(id_=3, min_fail_domains=5, min_alive_replicas=4)
+ BLOCK_4_2 = _erasure_type(id_=4, min_fail_domains=8, min_alive_replicas=6)
+ BLOCK_3_2 = _erasure_type(id_=5, min_fail_domains=7, min_alive_replicas=5)
+ STRIPE_4_2 = _erasure_type(id_=6, min_fail_domains=8, min_alive_replicas=6)
+ STRIPE_3_2 = _erasure_type(id_=7, min_fail_domains=7, min_alive_replicas=5)
+ MIRROR_3_2 = _erasure_type(id_=8, min_fail_domains=5, min_alive_replicas=3)
MIRROR_3_DC = _erasure_type(id_=9, min_fail_domains=3, min_alive_replicas=3)
MIRROR_3OF4 = _erasure_type(id_=18, min_fail_domains=8, min_alive_replicas=6)
def __init__(self, id_, min_fail_domains, min_alive_replicas):
- self.__id = id_
- self.__min_fail_domains = min_fail_domains
+ self.__id = id_
+ self.__min_fail_domains = min_fail_domains
self.__min_alive_replicas = min_alive_replicas
-
+
def __str__(self):
- return self.name.replace("_", "-").lower()
+ return self.name.replace("_", "-").lower()
def __repr__(self):
return self.__str__()
- def __int__(self):
- return self.__id
-
- @property
- def min_fail_domains(self):
- return self.__min_fail_domains
+ def __int__(self):
+ return self.__id
+ @property
+ def min_fail_domains(self):
+ return self.__min_fail_domains
+
@property
def min_alive_replicas(self):
return self.__min_alive_replicas
-
+
@staticmethod
def from_string(string_):
string_ = string_.upper()
@@ -101,7 +101,7 @@ class Erasure(Enum):
if int(candidate) == species:
return candidate
raise ValueError("No valid candidate found")
-
+
@staticmethod
def common_used():
return (
@@ -110,7 +110,7 @@ class Erasure(Enum):
)
-@unique
+@unique
class TabletStates(IntEnum):
Created = 0,
ResolveStateStorage = 1,
@@ -122,7 +122,7 @@ class TabletStates(IntEnum):
Discover = 7,
Lock = 8,
Dead = 9,
- Active = 10
+ Active = 10
@staticmethod
def from_int(val):
@@ -130,22 +130,22 @@ class TabletStates(IntEnum):
if int(tablet_state) == val:
return tablet_state
return None
-
-
-def _tablet_type(id_, magic, is_unique=False, service_name=None):
- """
- Convenient wrapper for TabletTypes enum
-
- :return: tuple of all arguments
- """
- return id_, magic, is_unique, service_name
-
-
+
+
+def _tablet_type(id_, magic, is_unique=False, service_name=None):
+ """
+ Convenient wrapper for TabletTypes enum
+
+ :return: tuple of all arguments
+ """
+ return id_, magic, is_unique, service_name
+
+
@unique
-class TabletTypes(Enum):
- TX_DUMMY = _tablet_type(8, 999)
- RTMR_PARTITION = _tablet_type(10, 999)
- KEYVALUEFLAT = _tablet_type(12, 999)
+class TabletTypes(Enum):
+ TX_DUMMY = _tablet_type(8, 999)
+ RTMR_PARTITION = _tablet_type(10, 999)
+ KEYVALUEFLAT = _tablet_type(12, 999)
KESUS = _tablet_type(29, 999)
PERSQUEUE = _tablet_type(20, 999)
@@ -153,11 +153,11 @@ class TabletTypes(Enum):
BLOCKSTORE_VOLUME = _tablet_type(25, 999)
BLOCKSTORE_PARTITION = _tablet_type(26, 999)
- FLAT_TX_COORDINATOR = _tablet_type(13, 0x800001, service_name='TX_COORDINATOR')
+ FLAT_TX_COORDINATOR = _tablet_type(13, 0x800001, service_name='TX_COORDINATOR')
TX_MEDIATOR = _tablet_type(5, 0x810001, service_name='TX_MEDIATOR')
TX_ALLOCATOR = _tablet_type(23, 0x820001, service_name='TX_ALLOCATOR')
- FLAT_TX_PROXY = _tablet_type(17, 0x820001, service_name='TX_PROXY')
-
+ FLAT_TX_PROXY = _tablet_type(17, 0x820001, service_name='TX_PROXY')
+
FLAT_HIVE = _tablet_type(14, 0xA001, is_unique=True, service_name='HIVE')
FLAT_SCHEMESHARD = _tablet_type(16, 0x8587a0, is_unique=True, service_name='FLAT_TX_SCHEMESHARD')
@@ -167,101 +167,101 @@ class TabletTypes(Enum):
CONSOLE = _tablet_type(28, 0x2003, is_unique=True, service_name='CONSOLE')
FLAT_BS_CONTROLLER = _tablet_type(15, 0x1001, is_unique=True, service_name='BS_CONTROLLER')
- USER_TYPE_START = _tablet_type(0xFF, 0)
- TYPE_INVALID = _tablet_type(0xFFFFFFFF, 0)
-
- def __init__(self, id_, magic, is_unique=False, service_name=None):
- self.__id = id_
- self.__magic_preset = magic
- self.__is_unique = is_unique
- self.__service_name = service_name
-
- def __int__(self):
- return self.__id
-
- def __repr__(self):
- return self.name
-
- def __str__(self):
- return self.name
-
- @property
- def service_name(self):
- """
- :return: Name of the logging service for this tablet type
- """
- if self.__service_name is None:
- return self.name
- return self.__service_name
-
- def tablet_id_for(self, index, domain_id=1):
- if self.__is_unique:
+ USER_TYPE_START = _tablet_type(0xFF, 0)
+ TYPE_INVALID = _tablet_type(0xFFFFFFFF, 0)
+
+ def __init__(self, id_, magic, is_unique=False, service_name=None):
+ self.__id = id_
+ self.__magic_preset = magic
+ self.__is_unique = is_unique
+ self.__service_name = service_name
+
+ def __int__(self):
+ return self.__id
+
+ def __repr__(self):
+ return self.name
+
+ def __str__(self):
+ return self.name
+
+ @property
+ def service_name(self):
+ """
+ :return: Name of the logging service for this tablet type
+ """
+ if self.__service_name is None:
+ return self.name
+ return self.__service_name
+
+ def tablet_id_for(self, index, domain_id=1):
+ if self.__is_unique:
return domain_id << 56 | self.__magic_preset
- raw_tablet_id = self.__magic_preset + index
- return (domain_id << 56) | (domain_id << 44) | (raw_tablet_id & 0x00000FFFFFFFFFFF)
-
- @staticmethod
- def from_int(val):
- for tablet_type in list(TabletTypes):
- if tablet_type.__id == val:
- return tablet_type
- return TabletTypes.TYPE_INVALID
-
-
-def bool_converter(astr):
- if isinstance(astr, bool):
- return astr
+ raw_tablet_id = self.__magic_preset + index
+ return (domain_id << 56) | (domain_id << 44) | (raw_tablet_id & 0x00000FFFFFFFFFFF)
+
+ @staticmethod
+ def from_int(val):
+ for tablet_type in list(TabletTypes):
+ if tablet_type.__id == val:
+ return tablet_type
+ return TabletTypes.TYPE_INVALID
+
+
+def bool_converter(astr):
+ if isinstance(astr, bool):
+ return astr
if astr.lower() == 'true':
- return True
- else:
- return False
-
-
-class AbstractTypeEnum(Enum):
-
- def __str__(self):
- return self._name_
-
- def __repr__(self):
- return self.__str__()
-
- def as_obj(self, value):
- return self.to_obj_converter(value)
-
+ return True
+ else:
+ return False
+
+
+class AbstractTypeEnum(Enum):
+
+ def __str__(self):
+ return self._name_
+
+ def __repr__(self):
+ return self.__str__()
+
+ def as_obj(self, value):
+ return self.to_obj_converter(value)
+
@property
def idn(self):
return self._idn_
-
- @classmethod
- def from_int(cls, idn):
- for v in list(cls):
- if idn == v._idn_:
- return v
- raise AssertionError('There is no PType with value = ' + str(idn))
-
-
+
+ @classmethod
+ def from_int(cls, idn):
+ for v in list(cls):
+ if idn == v._idn_:
+ return v
+ raise AssertionError('There is no PType with value = ' + str(idn))
+
+
def from_bytes(val):
try:
return codecs.decode(val, 'utf8')
except (UnicodeEncodeError, TypeError):
return val
-
-
-def _ptype_from(idn, generator, to_obj_converter=str, proto_field='Bytes', min_value=None, max_value=None):
- return idn, generator, to_obj_converter, proto_field, min_value, max_value
-
-
-# noinspection PyTypeChecker
-@unique
-class PType(AbstractTypeEnum):
- Int32 = _ptype_from(1, int_between(-2 ** 31, 2 ** 31), int, proto_field='Int32', min_value=-2 ** 31, max_value=2 ** 31 - 1)
- Uint32 = _ptype_from(2, int_between(0, 2 ** 32), int, proto_field='Uint32', min_value=0, max_value=2 ** 32 - 1)
+
+
+def _ptype_from(idn, generator, to_obj_converter=str, proto_field='Bytes', min_value=None, max_value=None):
+ return idn, generator, to_obj_converter, proto_field, min_value, max_value
+
+
+# noinspection PyTypeChecker
+@unique
+class PType(AbstractTypeEnum):
+ Int32 = _ptype_from(1, int_between(-2 ** 31, 2 ** 31), int, proto_field='Int32', min_value=-2 ** 31, max_value=2 ** 31 - 1)
+ Uint32 = _ptype_from(2, int_between(0, 2 ** 32), int, proto_field='Uint32', min_value=0, max_value=2 ** 32 - 1)
Int64 = _ptype_from(3, int_between(-2 ** 63, 2 ** 63), int, proto_field='Int64', min_value=-2**63, max_value=2 ** 63 - 1)
- Uint64 = _ptype_from(4, int_between(0, 2 ** 64 - 1), int, proto_field='Uint64', min_value=0, max_value=2 ** 64 - 1)
- Byte = _ptype_from(5, int_between(0, 255), int, min_value=0, max_value=255)
- Bool = _ptype_from(6, one_of([True, False]), bool_converter, proto_field='Bool', min_value=True, max_value=False)
-
+ Uint64 = _ptype_from(4, int_between(0, 2 ** 64 - 1), int, proto_field='Uint64', min_value=0, max_value=2 ** 64 - 1)
+ Byte = _ptype_from(5, int_between(0, 255), int, min_value=0, max_value=255)
+ Bool = _ptype_from(6, one_of([True, False]), bool_converter, proto_field='Bool', min_value=True, max_value=False)
+
Double = _ptype_from(32, float_in(-100, 100), float, proto_field='Double')
Float = _ptype_from(33, float_in(-100, 100), float, proto_field='Float')
@@ -276,24 +276,24 @@ class PType(AbstractTypeEnum):
ActorID = _ptype_from(8193, actor_id(), str)
- def __init__(self, idn, generator, to_obj_converter, proto_field, min_value, max_value):
+ def __init__(self, idn, generator, to_obj_converter, proto_field, min_value, max_value):
self._idn_ = idn
- self.generator = generator
- self.to_obj_converter = to_obj_converter
- self._proto_field = proto_field
- self.__min_value = min_value
- self.__max_value = max_value
-
- @property
- def max_value(self):
- return self.__max_value
-
- @property
- def min_value(self):
- return self.__min_value
-
- @staticmethod
- def from_string(string_):
- if isinstance(string_, PType):
- return string_
- return PType[string_]
+ self.generator = generator
+ self.to_obj_converter = to_obj_converter
+ self._proto_field = proto_field
+ self.__min_value = min_value
+ self.__max_value = max_value
+
+ @property
+ def max_value(self):
+ return self.__max_value
+
+ @property
+ def min_value(self):
+ return self.__min_value
+
+ @staticmethod
+ def from_string(string_):
+ if isinstance(string_, PType):
+ return string_
+ return PType[string_]
diff --git a/ydb/tests/library/common/wait_for.py b/ydb/tests/library/common/wait_for.py
index f3104dac8a9..b17f1ebcab5 100644
--- a/ydb/tests/library/common/wait_for.py
+++ b/ydb/tests/library/common/wait_for.py
@@ -1,68 +1,68 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import logging
-import time
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import logging
+import time
+
from hamcrest import assert_that
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
-
-logger = logging.getLogger()
-
-
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
+
+logger = logging.getLogger()
+
+
def wait_for(predicate, timeout_seconds=5.0, step_seconds=0.5, multiply=2, max_step_seconds=5.0):
- finish_time = time.time() + timeout_seconds
- while time.time() < finish_time:
- if predicate():
- return True
+ finish_time = time.time() + timeout_seconds
+ while time.time() < finish_time:
+ if predicate():
+ return True
step_seconds = min(step_seconds * multiply, max_step_seconds)
- time.sleep(step_seconds)
- return False
-
-
-def wait_for_matcher(callable_, matcher, timeout_seconds=60.0, step_seconds=1.0, log_progress=False):
- """
- Wait for callable result to match given matcher
-
- :param callable_: zero argument function
- :param matcher: Hamcrest matcher for callable_ result
- :param timeout_seconds:
- :param step_seconds:
- :param log_progress: do we need to log intermediate progress to debug log
-
- :return: True if matches before timeout reached, False otherwise
- """
- matcher = wrap_matcher(matcher)
- horizontal_line = '\n' + '=' * 80 + '\n'
+ time.sleep(step_seconds)
+ return False
+
+
+def wait_for_matcher(callable_, matcher, timeout_seconds=60.0, step_seconds=1.0, log_progress=False):
+ """
+ Wait for callable result to match given matcher
+
+ :param callable_: zero argument function
+ :param matcher: Hamcrest matcher for callable_ result
+ :param timeout_seconds:
+ :param step_seconds:
+ :param log_progress: do we need to log intermediate progress to debug log
+
+ :return: True if matches before timeout reached, False otherwise
+ """
+ matcher = wrap_matcher(matcher)
+ horizontal_line = '\n' + '=' * 80 + '\n'
last_result = [None]
-
- def predicate():
- result = callable_()
- if log_progress:
- logger.info('Result from callable = ' + horizontal_line + str(result) + horizontal_line)
+
+ def predicate():
+ result = callable_()
+ if log_progress:
+ logger.info('Result from callable = ' + horizontal_line + str(result) + horizontal_line)
last_result[0] = result
- return matcher.matches(result)
-
+ return matcher.matches(result)
+
wait_for(predicate=predicate, timeout_seconds=timeout_seconds, step_seconds=step_seconds)
return last_result[0]
-
-
-def wait_for_and_assert(callable_, matcher, message='', timeout_seconds=60, step_seconds=1.0, log_progress=False):
- """
- Wait for callable result to match given matcher and when asserts that.
-
- :raise AssertionError: then callable result is not matched by the matcher after timeout
-
- :param callable_: zero argument function
- :param matcher: Hamcrest matcher for callable_ result
- :param message:
- :param timeout_seconds:
- :param step_seconds:
- :param log_progress: do we need to log intermediate progress to debug log
-
- :return: return value of last callable_ invocation
- """
- matcher = wrap_matcher(matcher)
+
+
+def wait_for_and_assert(callable_, matcher, message='', timeout_seconds=60, step_seconds=1.0, log_progress=False):
+ """
+ Wait for callable result to match given matcher and when asserts that.
+
+ :raise AssertionError: then callable result is not matched by the matcher after timeout
+
+ :param callable_: zero argument function
+ :param matcher: Hamcrest matcher for callable_ result
+ :param message:
+ :param timeout_seconds:
+ :param step_seconds:
+ :param log_progress: do we need to log intermediate progress to debug log
+
+ :return: return value of last callable_ invocation
+ """
+ matcher = wrap_matcher(matcher)
result = wait_for_matcher(
callable_,
matcher,
@@ -70,5 +70,5 @@ def wait_for_and_assert(callable_, matcher, message='', timeout_seconds=60, step
step_seconds=step_seconds,
log_progress=log_progress,
)
- assert_that(result, matcher, message)
- return result
+ assert_that(result, matcher, message)
+ return result
diff --git a/ydb/tests/library/common/yatest_common.py b/ydb/tests/library/common/yatest_common.py
index 0b836951552..0a7b31e65ec 100644
--- a/ydb/tests/library/common/yatest_common.py
+++ b/ydb/tests/library/common/yatest_common.py
@@ -1,70 +1,70 @@
-# -*- coding: utf-8 -*-
-import yatest.common as ya_common
-import yatest.common.network as ya_common_network
-
-"""
-For yatest.common package see file
-library/python/testing/yatest_common/yatest/common/__init__.py
-"""
-
-__author__ = '[email protected]'
-
-
-def wrap(func, alternative):
- def wrapped(*args, **kwargs):
- try:
- result = func(*args, **kwargs)
- except (NotImplementedError, AttributeError):
- result = alternative(*args, **kwargs)
- return result
-
- return wrapped
-
-
-PortManager = ya_common_network.PortManager
-
+# -*- coding: utf-8 -*-
+import yatest.common as ya_common
+import yatest.common.network as ya_common_network
+
+"""
+For yatest.common package see file
+library/python/testing/yatest_common/yatest/common/__init__.py
+"""
+
+__author__ = '[email protected]'
+
+
+def wrap(func, alternative):
+ def wrapped(*args, **kwargs):
+ try:
+ result = func(*args, **kwargs)
+ except (NotImplementedError, AttributeError):
+ result = alternative(*args, **kwargs)
+ return result
+
+ return wrapped
+
+
+PortManager = ya_common_network.PortManager
+
canonical_file = wrap(ya_common.canonical_file, lambda x: x)
-source_path = wrap(ya_common.source_path, lambda x: x)
+source_path = wrap(ya_common.source_path, lambda x: x)
build_path = wrap(ya_common.build_path, lambda x: x)
-binary_path = wrap(ya_common.binary_path, lambda x: x)
-output_path = wrap(ya_common.output_path, lambda x: x)
-work_path = wrap(ya_common.work_path, lambda x: x)
-
+binary_path = wrap(ya_common.binary_path, lambda x: x)
+output_path = wrap(ya_common.output_path, lambda x: x)
+work_path = wrap(ya_common.work_path, lambda x: x)
+
get_param = wrap(ya_common.get_param, lambda x, y=None: y)
-get_param_dict_copy = wrap(ya_common.get_param_dict_copy, lambda: dict())
+get_param_dict_copy = wrap(ya_common.get_param_dict_copy, lambda: dict())
-
-def get_bool_param(key, default):
- val = get_param(key, default)
+
+def get_bool_param(key, default):
+ val = get_param(key, default)
if isinstance(val, bool):
return val
-
+
return val.lower() == 'true'
-
-
-class Context(object):
-
- @property
- def test_name(self):
- return wrap(lambda: ya_common.context.test_name, lambda: None)()
-
- @property
- def sanitize(self):
- return wrap(lambda: ya_common.context.sanitize, lambda: None)()
-
-
-context = Context()
-
-ExecutionError = ya_common.ExecutionError
-
-execute = ya_common.execute
-
-
-def plain_or_under_sanitizer(plain, sanitized):
- """
- Ment to be used in test code for constants (timeouts, etc)
- See also arcadia/util/system/sanitizers.h
-
- :return: plain if no sanitizer enabled or sanitized otherwise
- """
+
+
+class Context(object):
+
+ @property
+ def test_name(self):
+ return wrap(lambda: ya_common.context.test_name, lambda: None)()
+
+ @property
+ def sanitize(self):
+ return wrap(lambda: ya_common.context.sanitize, lambda: None)()
+
+
+context = Context()
+
+ExecutionError = ya_common.ExecutionError
+
+execute = ya_common.execute
+
+
+def plain_or_under_sanitizer(plain, sanitized):
+ """
+ Ment to be used in test code for constants (timeouts, etc)
+ See also arcadia/util/system/sanitizers.h
+
+ :return: plain if no sanitizer enabled or sanitized otherwise
+ """
return plain if not context.sanitize else sanitized
diff --git a/ydb/tests/library/harness/daemon.py b/ydb/tests/library/harness/daemon.py
index edabe072629..bc7c246826f 100644
--- a/ydb/tests/library/harness/daemon.py
+++ b/ydb/tests/library/harness/daemon.py
@@ -1,22 +1,22 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import abc
-import logging
-import os
-import signal
-import tempfile
+import logging
+import os
+import signal
+import tempfile
import subprocess
import sys
-
+
from yatest.common import process
import six
-
+
from ydb.tests.library.common.wait_for import wait_for
from . import param_constants
-
-
-logger = logging.getLogger(__name__)
-
-
+
+
+logger = logging.getLogger(__name__)
+
+
def extract_stderr_details(stderr_file, max_lines=0):
if max_lines == 0:
return []
@@ -30,7 +30,7 @@ def extract_stderr_details(stderr_file, max_lines=0):
return result
-class DaemonError(RuntimeError):
+class DaemonError(RuntimeError):
def __init__(self, message, stdout, stderr, exit_code, max_stderr_lines=0):
super(DaemonError, self).__init__(
@@ -41,10 +41,10 @@ class DaemonError(RuntimeError):
"Stdout file name: \n{}".format(stdout if stdout is not None else "is not present."),
"Stderr file name: \n{}".format(stderr if stderr is not None else "is not present.")
] + extract_stderr_details(stderr, max_stderr_lines)
- )
+ )
)
-
-
+
+
class SeveralDaemonErrors(RuntimeError):
def __init__(self, exceptions):
super(SeveralDaemonErrors, self).__init__(
@@ -54,13 +54,13 @@ class SeveralDaemonErrors(RuntimeError):
)
-class Daemon(object):
+class Daemon(object):
def __init__(self, command, cwd, timeout, stdin_file=None, stdout_file=None, stderr_file=None, stderr_on_error_lines=0):
- self.__cwd = cwd
- self.__timeout = timeout
- self.__command = tuple(command)
+ self.__cwd = cwd
+ self.__timeout = timeout
+ self.__command = tuple(command)
self.__stderr_on_error_lines = stderr_on_error_lines
- self.__daemon = None
+ self.__daemon = None
self.__killed = False
self.logger = logger.getChild(self.__class__.__name__)
if stdout_file is None:
@@ -71,11 +71,11 @@ class Daemon(object):
self.__stdout_file = open(stdout_file, mode='w+b')
self.__stdin_file = open(stdin_file, mode='w+b')
self.__stderr_file = open(stderr_file, mode='w+b')
-
- @property
- def daemon(self):
- return self.__daemon
-
+
+ @property
+ def daemon(self):
+ return self.__daemon
+
@property
def stdin_file_name(self):
return os.path.abspath(self.__stdin_file.name)
@@ -88,44 +88,44 @@ class Daemon(object):
def stderr_file_name(self):
return os.path.abspath(self.__stderr_file.name)
- def is_alive(self):
- return self.__daemon is not None and self.__daemon.running
-
- def start(self):
- if self.is_alive():
- return
+ def is_alive(self):
+ return self.__daemon is not None and self.__daemon.running
+
+ def start(self):
+ if self.is_alive():
+ return
stderr_stream = self.__stderr_file
if param_constants.kikimr_stderr_to_console():
stderr_stream = sys.stderr
- self.__daemon = process.execute(
- self.__command,
- check_exit_code=False,
- cwd=self.__cwd,
+ self.__daemon = process.execute(
+ self.__command,
+ check_exit_code=False,
+ cwd=self.__cwd,
stdin=self.__stdin_file,
stdout=self.__stdout_file,
stderr=stderr_stream,
- wait=False
- )
- wait_for(self.is_alive, self.__timeout)
-
- if not self.is_alive():
- self.__check_before_fail()
- raise DaemonError(
- "Unexpectedly finished on start",
+ wait=False
+ )
+ wait_for(self.is_alive, self.__timeout)
+
+ if not self.is_alive():
+ self.__check_before_fail()
+ raise DaemonError(
+ "Unexpectedly finished on start",
exit_code=self.__daemon.exit_code,
stdout=self.stdout_file_name,
stderr=self.stderr_file_name,
max_stderr_lines=self.__stderr_on_error_lines,
- )
-
+ )
+
self.__killed = False
- return self
-
- def __check_before_fail(self):
- self.__daemon.verify_no_coredumps()
- self.__daemon.verify_sanitize_errors()
-
+ return self
+
+ def __check_before_fail(self):
+ self.__daemon.verify_no_coredumps()
+ self.__daemon.verify_sanitize_errors()
+
@property
def _acceptable_exit_codes(self):
return 0, -signal.SIGTERM
@@ -134,23 +134,23 @@ class Daemon(object):
if self.__daemon is None or self.__killed:
return False
- if self.__daemon is not None and self.__daemon.exit_code == 0:
+ if self.__daemon is not None and self.__daemon.exit_code == 0:
return False
-
- if not self.is_alive():
- self.__check_before_fail()
- raise DaemonError(
+
+ if not self.is_alive():
+ self.__check_before_fail()
+ raise DaemonError(
"Unexpectedly finished before %s" % stop_type,
- exit_code=self.__daemon.exit_code,
+ exit_code=self.__daemon.exit_code,
stdout=self.stdout_file_name,
stderr=self.stderr_file_name,
max_stderr_lines=self.__stderr_on_error_lines,
- )
-
+ )
+
return True
-
+
def __check_before_end_stop(self, stop_type):
- if self.is_alive():
+ if self.is_alive():
msg = "Cannot {stop_type} daemon cmd = {cmd}".format(cmd=' '.join(self.__command), stop_type=stop_type)
self.logger.error(msg)
raise DaemonError(
@@ -160,7 +160,7 @@ class Daemon(object):
stderr=self.stderr_file_name,
max_stderr_lines=self.__stderr_on_error_lines,
)
-
+
def stop(self):
if not self.__check_can_launch_stop("stop"):
return
@@ -175,19 +175,19 @@ class Daemon(object):
is_killed = True
self.__check_before_end_stop("stop")
- if not is_killed:
- exit_code = self.__daemon.exit_code
- self.__check_before_fail()
+ if not is_killed:
+ exit_code = self.__daemon.exit_code
+ self.__check_before_fail()
if exit_code not in self._acceptable_exit_codes:
- raise DaemonError(
+ raise DaemonError(
"Bad exit_code.",
exit_code=exit_code,
stdout=self.stdout_file_name,
stderr=self.stderr_file_name,
max_stderr_lines=self.__stderr_on_error_lines,
- )
- else:
+ )
+ else:
self.logger.warning("Exit code is not checked, cos binary was stopped by sigkill")
def kill(self):
diff --git a/ydb/tests/library/harness/kikimr_client.py b/ydb/tests/library/harness/kikimr_client.py
index d74383ae231..b956dff4568 100644
--- a/ydb/tests/library/harness/kikimr_client.py
+++ b/ydb/tests/library/harness/kikimr_client.py
@@ -8,7 +8,7 @@ from ydb.tests.library.common.protobuf_ss import TSchemeOperationStatus
import grpc
import six
-
+
from google.protobuf.text_format import Parse
from ydb.core.protos import blobstorage_config_pb2
import ydb.core.protos.msgbus_pb2 as msgbus
@@ -124,23 +124,23 @@ class KiKiMRMessageBusClient(object):
def send_request(self, protobuf_request, method=None):
return self.send(protobuf_request, method)
-
+
def send_and_poll_request(self, protobuf_request, method='SchemeOperation'):
response = self.send_request(protobuf_request, method)
- return self.__poll(response)
-
- def __poll(self, flat_transaction_response):
- if not MessageBusStatus.is_ok_status(flat_transaction_response.Status):
- return flat_transaction_response
-
+ return self.__poll(response)
+
+ def __poll(self, flat_transaction_response):
+ if not MessageBusStatus.is_ok_status(flat_transaction_response.Status):
+ return flat_transaction_response
+
return self.send_request(
TSchemeOperationStatus(
- flat_transaction_response.FlatTxId.TxId,
- flat_transaction_response.FlatTxId.SchemeShardTabletId
+ flat_transaction_response.FlatTxId.TxId,
+ flat_transaction_response.FlatTxId.SchemeShardTabletId
).protobuf,
'SchemeOperationStatus'
- )
-
+ )
+
def bind_storage_pools(self, domain_name, spools):
request = msgbus.TSchemeOperation()
scheme_transaction = request.Transaction
@@ -169,7 +169,7 @@ class KiKiMRMessageBusClient(object):
def send(self, request, method):
return self.invoke(request, method)
- def ddl_exec_status(self, flat_tx_id):
+ def ddl_exec_status(self, flat_tx_id):
return self.flat_transaction_status(flat_tx_id.tx_id, flat_tx_id.schemeshard_tablet_id)
def add_attr(self, working_dir, name, attributes, token=None):
@@ -243,12 +243,12 @@ class KiKiMRMessageBusClient(object):
'HiveCreateTablet'
)
- def local_enumerate_tablets(self, tablet_type, node_id=1):
+ def local_enumerate_tablets(self, tablet_type, node_id=1):
request = msgbus.TLocalEnumerateTablets()
request.DomainUid = self.__domain_id
request.NodeId = node_id
request.TabletType = int(tablet_type)
-
+
return self.invoke(request, 'LocalEnumerateTablets')
def kv_cmd_write(self, tablet_id, cmd_writes, generation=None):
@@ -288,7 +288,7 @@ class KiKiMRMessageBusClient(object):
return self.invoke(request, 'KeyValue')
- def kv_cmd_read_range(self, tablet_id, cmd_range_reads, generation=None):
+ def kv_cmd_read_range(self, tablet_id, cmd_range_reads, generation=None):
request = msgbus_kv.TKeyValueRequest()
for cmd in cmd_range_reads:
@@ -306,7 +306,7 @@ class KiKiMRMessageBusClient(object):
return self.invoke(request, 'KeyValue')
- def kv_cmd_rename(self, tablet_id, cmd_renames, generation=None):
+ def kv_cmd_rename(self, tablet_id, cmd_renames, generation=None):
request = msgbus_kv.TKeyValueRequest()
for cmd in cmd_renames:
@@ -340,8 +340,8 @@ class KiKiMRMessageBusClient(object):
raise RuntimeError('add_config_item failed: %s: %s' % (response.Status.Code, response.Status.Reason))
return response
- def kv_cmd_delete_range(self, tablet_id, cmd_range_delete, generation=None):
-
+ def kv_cmd_delete_range(self, tablet_id, cmd_range_delete, generation=None):
+
request = msgbus_kv.TKeyValueRequest()
for cmd in cmd_range_delete:
delete_range = request.CmdDeleteRange.add()
@@ -352,7 +352,7 @@ class KiKiMRMessageBusClient(object):
request.TabletId = tablet_id
if generation is not None:
request.Generation = generation
-
+
return self.invoke(request, 'KeyValue')
def kv_copy_range(self, tablet_id, key_range, prefix_to_add, prefix_to_remove=None):
@@ -370,7 +370,7 @@ class KiKiMRMessageBusClient(object):
return self.invoke(request, 'KeyValue')
- def kv_request(self, tablet_id, kv_request, generation=None, deadline_ms=None):
+ def kv_request(self, tablet_id, kv_request, generation=None, deadline_ms=None):
request = kv_request.protobuf
request.TabletId = tablet_id
if generation is not None:
@@ -378,12 +378,12 @@ class KiKiMRMessageBusClient(object):
if deadline_ms is not None:
request.DeadlineInstantMs = deadline_ms
return self.invoke(request, 'KeyValue')
-
+
def tablet_kill(self, tablet_id):
request = msgbus.TTabletKillRequest(TabletID=tablet_id)
return self.invoke(request, 'TabletKillRequest')
- def tablet_state(self, tablet_type=None, tablet_ids=()):
+ def tablet_state(self, tablet_type=None, tablet_ids=()):
request = msgbus.TTabletStateRequest()
if tablet_type is not None:
request.TabletType = int(tablet_type)
diff --git a/ydb/tests/library/harness/kikimr_cluster.py b/ydb/tests/library/harness/kikimr_cluster.py
index 942e1588ca4..c6b24938369 100644
--- a/ydb/tests/library/harness/kikimr_cluster.py
+++ b/ydb/tests/library/harness/kikimr_cluster.py
@@ -1,31 +1,31 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
import os
import itertools
import logging
import subprocess
import time
-import pprint
+import pprint
from concurrent import futures
import ydb.tests.library.common.yatest_common as yatest_common
-
+
from . import param_constants
from .kikimr_runner import KiKiMR, KikimrExternalNode
from .kikimr_cluster_interface import KiKiMRClusterInterface
from . import blockstore
import yaml
-
+
logger = logging.getLogger(__name__)
-
-DEFAULT_INTERCONNECT_PORT = 19001
+
+DEFAULT_INTERCONNECT_PORT = 19001
DEFAULT_MBUS_PORT = 2134
DEFAULT_MON_PORT = 8765
DEFAULT_GRPC_PORT = 2135
def kikimr_cluster_factory(configurator=None, config_path=None):
- logger.info("All test params = {}".format(pprint.pformat(yatest_common.get_param_dict_copy())))
+ logger.info("All test params = {}".format(pprint.pformat(yatest_common.get_param_dict_copy())))
logger.info("Starting standalone YDB cluster")
if config_path is not None:
return ExternalKiKiMRCluster(config_path)
@@ -62,7 +62,7 @@ class ExternalKiKiMRCluster(KiKiMRClusterInterface):
def add_storage_pool(self, erasure=None):
raise NotImplementedError()
- def start(self):
+ def start(self):
self._prepare_cluster()
self._start()
@@ -70,7 +70,7 @@ class ExternalKiKiMRCluster(KiKiMRClusterInterface):
def stop(self):
return self
-
+
def restart(self):
self._stop()
self._start()
@@ -181,9 +181,9 @@ class ExternalKiKiMRCluster(KiKiMRClusterInterface):
self._start()
- @property
- def nodes(self):
- return {
+ @property
+ def nodes(self):
+ return {
node_id: KikimrExternalNode(
node_id=node_id,
host=host,
@@ -194,7 +194,7 @@ class ExternalKiKiMRCluster(KiKiMRClusterInterface):
configurator=None,
) for node_id, host in zip(itertools.count(start=1), self.__hosts)
}
-
+
@property
def nbs(self):
return {}
diff --git a/ydb/tests/library/harness/kikimr_config.py b/ydb/tests/library/harness/kikimr_config.py
index 57c282b9f41..d9533fa45e5 100644
--- a/ydb/tests/library/harness/kikimr_config.py
+++ b/ydb/tests/library/harness/kikimr_config.py
@@ -1,8 +1,8 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import sys
import itertools
import os
-import tempfile
+import tempfile
import socket
import six
@@ -18,13 +18,13 @@ from .util import LogLevels
import yaml
from library.python import resource
-
+
PDISK_SIZE_STR = os.getenv("YDB_PDISK_SIZE", str(64 * 1024 * 1024 * 1024))
if PDISK_SIZE_STR.endswith("GB"):
PDISK_SIZE = int(PDISK_SIZE_STR[:-2]) * 1024 * 1024 * 1024
else:
PDISK_SIZE = int(PDISK_SIZE_STR)
-
+
def get_fqdn():
hostname = socket.gethostname()
@@ -75,8 +75,8 @@ def load_default_yaml(default_tablet_node_ids, ydb_domain_name, static_erasure,
return yaml_dict
-class KikimrConfigGenerator(object):
- def __init__(
+class KikimrConfigGenerator(object):
+ def __init__(
self,
erasure=None,
binary_path=None,
@@ -111,7 +111,7 @@ class KikimrConfigGenerator(object):
auth_config_path=None,
disable_mvcc=False,
enable_public_api_external_blobs=False,
- ):
+ ):
self._version = version
self.use_log_files = use_log_files
self.suppress_version_check = suppress_version_check
@@ -136,11 +136,11 @@ 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
+ 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:
+ if nodes is None:
nodes = rings_count * erasure.min_fail_domains
self._rings_count = rings_count
self._enable_nbs = enable_nbs
@@ -163,7 +163,7 @@ class KikimrConfigGenerator(object):
self._dcs = [1]
if erasure == Erasure.MIRROR_3_DC:
self._dcs = [1, 2, 3]
-
+
self.__additional_log_configs = {} if additional_log_configs is None else additional_log_configs
self.__additional_log_configs.update(get_additional_log_configs())
@@ -293,7 +293,7 @@ class KikimrConfigGenerator(object):
metering_file.write('')
self.yaml_config['metering_config'] = {'metering_file_path': metering_file_path}
- @property
+ @property
def metering_file_path(self):
return self.yaml_config.get('metering_config', {}).get('metering_file_path')
@@ -310,9 +310,9 @@ class KikimrConfigGenerator(object):
return self.__output_path
@property
- def binary_path(self):
- return self.__binary_path
-
+ def binary_path(self):
+ return self.__binary_path
+
def write_tls_data(self):
if self.__grpc_ssl_enable:
for fpath, data in ((self.grpc_tls_ca_path, self.grpc_tls_ca), (self.grpc_tls_cert_path, self.grpc_tls_cert), (self.grpc_tls_key_path, self.grpc_tls_key)):
@@ -351,7 +351,7 @@ class KikimrConfigGenerator(object):
result.append(full)
return result
- def all_node_ids(self):
+ def all_node_ids(self):
return self.__node_ids
def _add_pdisk_to_static_group(self, pdisk_id, path, node_id, pdisk_category, ring):
@@ -380,8 +380,8 @@ class KikimrConfigGenerator(object):
for dc in self._dcs:
self.yaml_config["blob_storage_config"]["service_set"]["groups"][0]["rings"].append({"fail_domains": []})
-
- for node_id in self.__node_ids:
+
+ for node_id in self.__node_ids:
datacenter_id = next(datacenter_id_generator)
for pdisk_id in range(1, self.__number_of_pdisks_per_node + 1):
diff --git a/ydb/tests/library/harness/kikimr_http_client.py b/ydb/tests/library/harness/kikimr_http_client.py
index 68bbfe73754..9c97e61786a 100644
--- a/ydb/tests/library/harness/kikimr_http_client.py
+++ b/ydb/tests/library/harness/kikimr_http_client.py
@@ -1,66 +1,66 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import json
-import logging
-
+import logging
+
from six.moves.urllib.request import urlopen
from six.moves.urllib.parse import urlencode
-
-logger = logging.getLogger()
-TIMEOUT = 120
-DEFAULT_HIVE_ID = 72057594037968897
-
-
-class HiveClient(object):
-
- def __init__(self, server, mon_port, hive_id=DEFAULT_HIVE_ID):
- self.__hive_id = hive_id
- self.__url = 'http://{server}:{mon_port}/tablets/app?TabletID={hive_id}'.format(
- server=server,
- mon_port=mon_port,
- hive_id=self.__hive_id
- )
-
+
+logger = logging.getLogger()
+TIMEOUT = 120
+DEFAULT_HIVE_ID = 72057594037968897
+
+
+class HiveClient(object):
+
+ def __init__(self, server, mon_port, hive_id=DEFAULT_HIVE_ID):
+ self.__hive_id = hive_id
+ self.__url = 'http://{server}:{mon_port}/tablets/app?TabletID={hive_id}'.format(
+ server=server,
+ mon_port=mon_port,
+ hive_id=self.__hive_id
+ )
+
def __get(self, url, timeout):
u = urlopen(url, timeout=TIMEOUT)
u.read()
- def rebalance_all_tablets(self):
+ def rebalance_all_tablets(self):
self.__get(
- self.__url + '&page=Rebalance',
- timeout=TIMEOUT
- )
-
- def change_tablet_group(self, tablet_id, channels=()):
- url_lst = [
- self.__url,
- 'page=ReassignTablet',
- 'tablet={tablet_id}'.format(tablet_id=tablet_id)
- ]
- if channels:
- url_lst.append('channel=' + ','.join(map(str, channels)))
-
+ self.__url + '&page=Rebalance',
+ timeout=TIMEOUT
+ )
+
+ def change_tablet_group(self, tablet_id, channels=()):
+ url_lst = [
+ self.__url,
+ 'page=ReassignTablet',
+ 'tablet={tablet_id}'.format(tablet_id=tablet_id)
+ ]
+ if channels:
+ url_lst.append('channel=' + ','.join(map(str, channels)))
+
self.__get('&'.join(url_lst), timeout=TIMEOUT)
-
- def change_tablet_group_by_tablet_type(self, tablet_type, percent=None, channels=()):
- url_lst = [
- self.__url,
- 'page=ReassignTablet',
- 'type={tablet_type}'.format(tablet_type=int(tablet_type))
- ]
- if percent is not None:
- url_lst.append(
- 'percent={percent}'.format(percent=percent)
- )
- if channels:
- url_lst.append('channel=' + ','.join(map(str, channels)))
+
+ def change_tablet_group_by_tablet_type(self, tablet_type, percent=None, channels=()):
+ url_lst = [
+ self.__url,
+ 'page=ReassignTablet',
+ 'type={tablet_type}'.format(tablet_type=int(tablet_type))
+ ]
+ if percent is not None:
+ url_lst.append(
+ 'percent={percent}'.format(percent=percent)
+ )
+ if channels:
+ url_lst.append('channel=' + ','.join(map(str, channels)))
self.__get('&'.join(url_lst), timeout=TIMEOUT)
-
+
def kick_tablets_from_node(self, node_id):
self.__get(
self.__url + "&page=KickNode&node={node}".format(node=node_id),
timeout=TIMEOUT
)
-
+
def block_node(self, node_id, block=True):
block = '1' if block else '0'
self.__get(
@@ -69,7 +69,7 @@ class HiveClient(object):
)
def unblock_node(self, node_id):
- self.block_node(node_id, block=False)
+ self.block_node(node_id, block=False)
def change_tablet_weight(self, tablet_id, tablet_weight):
self.__get(
@@ -89,23 +89,23 @@ class HiveClient(object):
timeout=TIMEOUT
)
- def set_min_scatter_to_balance(self, min_scatter_to_balance=101):
- """
- min_scatter_to_balance=101 -- effectively disables auto rebalancing
- """
+ def set_min_scatter_to_balance(self, min_scatter_to_balance=101):
+ """
+ min_scatter_to_balance=101 -- effectively disables auto rebalancing
+ """
self.__get(
- self.__url + "&page=Settings&minScatterToBalance={min_scatter_to_balance}".format(
+ self.__url + "&page=Settings&minScatterToBalance={min_scatter_to_balance}".format(
min_scatter_to_balance=min_scatter_to_balance), timeout=TIMEOUT
- )
+ )
- def set_max_scheduled_tablets(self, max_scheduled_tablets=10):
+ def set_max_scheduled_tablets(self, max_scheduled_tablets=10):
self.__get(
- self.__url + "&page=Settings&maxScheduledTablets={max_scheduled_tablets}".format(
- max_scheduled_tablets=max_scheduled_tablets
- ),
- timeout=TIMEOUT
- )
-
+ self.__url + "&page=Settings&maxScheduledTablets={max_scheduled_tablets}".format(
+ max_scheduled_tablets=max_scheduled_tablets
+ ),
+ timeout=TIMEOUT
+ )
+
def set_max_boot_batch_size(self, max_boot_batch_size=10):
self.__get(
self.__url + "&page=Settings&maxBootBatchSize={max_boot_batch_size}".format(
@@ -113,56 +113,56 @@ class HiveClient(object):
),
timeout=TIMEOUT
)
-
-
-class SwaggerClient(object):
- def __init__(self, host, port, hive_id=DEFAULT_HIVE_ID):
- super(SwaggerClient, self).__init__()
- self.__host = host
- self.__port = port
- self.__timeout = 10 * 1000
- self.__hive_id = hive_id
-
- self.__debug_enabled = logger.isEnabledFor(logging.DEBUG)
- self.__url = 'http://{server}:{port}/viewer'.format(
- server=host,
- port=port
- )
-
+
+
+class SwaggerClient(object):
+ def __init__(self, host, port, hive_id=DEFAULT_HIVE_ID):
+ super(SwaggerClient, self).__init__()
+ self.__host = host
+ self.__port = port
+ self.__timeout = 10 * 1000
+ self.__hive_id = hive_id
+
+ self.__debug_enabled = logger.isEnabledFor(logging.DEBUG)
+ self.__url = 'http://{server}:{port}/viewer'.format(
+ server=host,
+ port=port
+ )
+
def __get(self, url, timeout):
u = urlopen(url, timeout=TIMEOUT)
return json.load(u)
- def __http_get_and_parse_json(self, path, **kwargs):
+ def __http_get_and_parse_json(self, path, **kwargs):
params = urlencode(kwargs)
- url = self.__url + path + "?" + params
+ url = self.__url + path + "?" + params
response = self.__get(url, timeout=TIMEOUT)
return response
-
- def hive_info_by_tablet_id(self, tablet_id):
- return self.__hive_info(tablet_id=tablet_id)
-
- def hive_info_by_tablet_type(self, tablet_type):
- return self.__hive_info(tablet_type=int(tablet_type))
-
- def hive_info_all(self):
- return self.__hive_info()
-
- def __hive_info(self, **kwargs):
- return self.__http_get_and_parse_json(
- "/json/hiveinfo", hive_id=self.__hive_id, timeout=self.__timeout, **kwargs
- )
-
- def pdisk_info(self, node_id):
- return self.__http_get_and_parse_json(
- "/json/pdiskinfo", node_id=str(node_id), enums='true', timeout=self.__timeout
- )
-
+
+ def hive_info_by_tablet_id(self, tablet_id):
+ return self.__hive_info(tablet_id=tablet_id)
+
+ def hive_info_by_tablet_type(self, tablet_type):
+ return self.__hive_info(tablet_type=int(tablet_type))
+
+ def hive_info_all(self):
+ return self.__hive_info()
+
+ def __hive_info(self, **kwargs):
+ return self.__http_get_and_parse_json(
+ "/json/hiveinfo", hive_id=self.__hive_id, timeout=self.__timeout, **kwargs
+ )
+
+ def pdisk_info(self, node_id):
+ return self.__http_get_and_parse_json(
+ "/json/pdiskinfo", node_id=str(node_id), enums='true', timeout=self.__timeout
+ )
+
def vdisk_info(self):
return self.__http_get_and_parse_json(
"/json/vdiskinfo", timeout=self.__timeout
)
-
+
def tablet_info(self, tablet_type=None):
if tablet_type is not None:
return self.__http_get_and_parse_json(
diff --git a/ydb/tests/library/harness/kikimr_monitoring.py b/ydb/tests/library/harness/kikimr_monitoring.py
index 26f78a082f1..bc7010a060f 100644
--- a/ydb/tests/library/harness/kikimr_monitoring.py
+++ b/ydb/tests/library/harness/kikimr_monitoring.py
@@ -1,22 +1,22 @@
-# -*- coding: utf-8 -*-
-import time
-import json
+# -*- coding: utf-8 -*-
+import time
+import json
import collections
from six.moves.urllib import request
-
-
-class KikimrMonitor(object):
- def __init__(self, host, mon_port, update_interval_seconds=1.0):
- super(KikimrMonitor, self).__init__()
+
+
+class KikimrMonitor(object):
+ def __init__(self, host, mon_port, update_interval_seconds=1.0):
+ super(KikimrMonitor, self).__init__()
self.__host = host
self.__mon_port = mon_port
- self.__url = "http://{host}:{mon_port}/counters/json".format(host=host, mon_port=mon_port)
- self.__pdisks = set()
- self.__data = {}
- self.__next_update_time = time.time()
- self.__update_interval_seconds = update_interval_seconds
+ self.__url = "http://{host}:{mon_port}/counters/json".format(host=host, mon_port=mon_port)
+ self.__pdisks = set()
+ self.__data = {}
+ self.__next_update_time = time.time()
+ self.__update_interval_seconds = update_interval_seconds
self._by_sensor_name = collections.defaultdict(list)
-
+
def tabletcounters(self, tablet_id):
url = request.urlopen(
"http://{host}:{mon_port}/viewer/json/tabletcounters?tablet_id={tablet_id}".format(
@@ -25,65 +25,65 @@ class KikimrMonitor(object):
)
return json.load(url)
- @property
- def pdisks(self):
- return tuple(self.__pdisks)
-
+ @property
+ def pdisks(self):
+ return tuple(self.__pdisks)
+
def fetch(self, deadline=60):
self.__update_if_required(force_update=True, deadline=deadline)
return self
def __update_if_required(self, force_update=False, deadline=None):
if not force_update and time.time() < self.__next_update_time:
- return
-
- try:
+ return
+
+ try:
url = request.urlopen(self.__url)
except Exception:
return False
- try:
+ try:
raw = json.load(url)
- except ValueError:
+ except ValueError:
return False
self.__data = {}
- for sensor_dict in raw.get('sensors', ()):
- labels = sensor_dict.get('labels', {})
+ for sensor_dict in raw.get('sensors', ()):
+ labels = sensor_dict.get('labels', {})
sensor_name = labels.get('sensor')
- value = sensor_dict.get('value', None)
+ value = sensor_dict.get('value', None)
key = self.normalize(labels)
if labels.get('counters', None) == 'pdisks':
if 'pdisk' in labels:
self.__pdisks.add(int(labels['pdisk']))
- if value is not None:
- self.__data[key] = value
+ if value is not None:
+ self.__data[key] = value
self._by_sensor_name[sensor_name].append(
(key, value))
-
+
deadline = deadline if deadline is not None else self.__update_interval_seconds
self.__next_update_time = time.time() + deadline
return True
-
+
def get_by_name(self, sensor):
return self._by_sensor_name.get(sensor, [])
- @staticmethod
+ @staticmethod
def normalize(labels):
- return tuple(
- (key, value)
- for key, value in sorted(labels.items(), key=lambda x: x[0])
- )
-
+ return tuple(
+ (key, value)
+ for key, value in sorted(labels.items(), key=lambda x: x[0])
+ )
+
def has_actual_data(self):
return self.__update_if_required(force_update=True)
def force_update(self):
self.__update_if_required(force_update=True)
- def sensor(self, counters, sensor, _default=None, **kwargs):
- self.__update_if_required()
- kwargs.update({'counters': counters, 'sensor': sensor})
+ def sensor(self, counters, sensor, _default=None, **kwargs):
+ self.__update_if_required()
+ kwargs.update({'counters': counters, 'sensor': sensor})
key = self.normalize(kwargs)
- return self.__data.get(key, _default)
+ return self.__data.get(key, _default)
diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py
index 251f485b5db..6002162240f 100644
--- a/ydb/tests/library/harness/kikimr_runner.py
+++ b/ydb/tests/library/harness/kikimr_runner.py
@@ -1,14 +1,14 @@
-# -*- coding: utf-8 -*-
-import logging
+# -*- coding: utf-8 -*-
+import logging
import os
import shutil
import tempfile
-import time
+import time
import itertools
from google.protobuf import text_format
import ydb.tests.library.common.yatest_common as yatest_common
-
+
from ydb.tests.library.common.wait_for import wait_for
from . import daemon
from . import param_constants
@@ -20,31 +20,31 @@ import ydb.core.protos.blobstorage_config_pb2 as bs
from ydb.tests.library.predicates.blobstorage import blobstorage_controller_has_started_on_some_node
from library.python import resource
-
+
logger = logging.getLogger(__name__)
def get_unique_path_for_current_test(output_path, sub_folder):
test_name = yatest_common.context.test_name or ""
test_name = test_name.replace(':', '_')
-
+
return os.path.join(output_path, test_name, sub_folder)
+
-
-def ensure_path_exists(path):
- if not os.path.isdir(path):
- os.makedirs(path)
+def ensure_path_exists(path):
+ if not os.path.isdir(path):
+ os.makedirs(path)
return path
-
-
-def join(a, b):
- if a is None:
- a = ''
- if b is None:
- b = ''
- return os.path.join(a, b)
-
-
+
+
+def join(a, b):
+ if a is None:
+ a = ''
+ if b is None:
+ b = ''
+ return os.path.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):
@@ -52,9 +52,9 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
super(kikimr_node_interface.NodeInterface, self).__init__()
self.node_id = node_idx
self.__cwd = None
- self.__config_path = config_path
- self.__cluster_name = cluster_name
- self.__configurator = configurator
+ self.__config_path = config_path
+ self.__cluster_name = cluster_name
+ self.__configurator = configurator
self.__common_udfs_dir = udfs_dir
self.__encryption_key = encryption_key
@@ -93,15 +93,15 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
)
)
return self.__cwd
-
- @property
+
+ @property
def cms_config_cache_file_name(self):
return self.__cms_config_cache_file_name
@property
- def command(self):
- return self.__make_run_command()
-
+ def command(self):
+ return self.__make_run_command()
+
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'):
@@ -111,7 +111,7 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
out.seek(disk_size - 1)
out.write(b'\0')
- def __make_run_command(self):
+ def __make_run_command(self):
command = [self.__configurator.binary_path, "server"]
if self.__common_udfs_dir is not None:
command.append("--udfs-dir={}".format(self.__common_udfs_dir))
@@ -166,38 +166,38 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
return command
def stop(self):
- try:
- super(KiKiMRNode, self).stop()
- finally:
+ try:
+ super(KiKiMRNode, self).stop()
+ finally:
logger.info("Stopped node %s", self)
- def kill(self):
+ def kill(self):
try:
super(KiKiMRNode, self).kill()
self.start()
finally:
logger.info("Killed node %s", self)
- def send_signal(self, signal):
- self.daemon.process.send_signal(signal)
-
- @property
- def host(self):
- return 'localhost'
-
- @property
+ def send_signal(self, signal):
+ self.daemon.process.send_signal(signal)
+
+ @property
+ def host(self):
+ return 'localhost'
+
+ @property
def hostname(self):
return kikimr_config.get_fqdn()
@property
- def port(self):
+ def port(self):
return self.grpc_port
-
- @property
+
+ @property
def pid(self):
return self.daemon.process.pid
- def start(self):
+ def start(self):
try:
super(KiKiMRNode, self).start()
finally:
@@ -208,22 +208,22 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
def __init__(self, configurator=None, cluster_name=''):
super(KiKiMR, self).__init__()
- self.__tmpdir = tempfile.mkdtemp(prefix="kikimr_" + cluster_name + "_")
+ self.__tmpdir = tempfile.mkdtemp(prefix="kikimr_" + cluster_name + "_")
self.__common_udfs_dir = None
- self.__cluster_name = cluster_name
+ self.__cluster_name = cluster_name
self.__configurator = kikimr_config.KikimrConfigGenerator() if configurator is None else configurator
self.__port_allocator = self.__configurator.port_allocator
self._nodes = {}
self._slots = {}
- self.__server = 'localhost'
- self.__client = None
+ self.__server = 'localhost'
+ self.__client = None
self.__storage_pool_id_allocator = itertools.count(1)
self.__config_path = None
self._slot_index_allocator = itertools.count(1)
self._node_index_allocator = itertools.count(1)
self.default_channel_bindings = None
- @property
+ @property
def config(self):
return self.__configurator
@@ -236,22 +236,22 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
return self._slots
@property
- def domain_name(self):
+ def domain_name(self):
return self.__configurator.domain_name
-
- @property
- def server(self):
- return self.__server
-
- def __call_kikimr_new_cli(self, cmd, connect_to_server=True):
+
+ @property
+ def server(self):
+ return self.__server
+
+ def __call_kikimr_new_cli(self, cmd, connect_to_server=True):
server = 'grpc://{server}:{port}'.format(server=self.server, port=self.nodes[1].port)
full_command = [self.__configurator.binary_path]
- if connect_to_server:
+ if connect_to_server:
full_command += ["--server={server}".format(server=server)]
- full_command += cmd
-
- logger.debug("Executing command = {}".format(full_command))
- try:
+ full_command += cmd
+
+ logger.debug("Executing command = {}".format(full_command))
+ try:
return yatest_common.execute(full_command)
except yatest_common.ExecutionError as e:
logger.exception("KiKiMR command '{cmd}' failed with error: {e}\n\tstdout: {out}\n\tstderr: {err}".format(
@@ -260,25 +260,25 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
out=e.execution_result.std_out,
err=e.execution_result.std_err
))
- raise
-
+ raise
+
def start(self):
"""
Safely starts kikimr instance.
Do not override this method.
"""
- try:
+ try:
logger.debug("Working directory: " + self.__tmpdir)
- self.__run()
+ self.__run()
return self
- except Exception:
+ except Exception:
logger.exception("KiKiMR start failed")
- self.stop()
- raise
+ self.stop()
+ raise
- def __run(self):
- self.__client = None
+ def __run(self):
+ self.__client = None
self.__instantiate_udfs_dir()
self.__write_configs()
@@ -286,10 +286,10 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
for _ in self.__configurator.all_node_ids():
self.__register_node()
- for node_id in self.__configurator.all_node_ids():
- self.__run_node(node_id)
+ for node_id in self.__configurator.all_node_ids():
+ self.__run_node(node_id)
- self.__wait_for_bs_controller_to_start()
+ self.__wait_for_bs_controller_to_start()
self.__add_bs_box()
pools = {}
@@ -313,12 +313,12 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
)
)
- def __run_node(self, node_id):
+ def __run_node(self, node_id):
"""
:returns started KiKiMRNode instance
Can be overriden.
"""
- self.__format_disks(node_id)
+ self.__format_disks(node_id)
self._nodes[node_id].start()
return self._nodes[node_id]
@@ -328,7 +328,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
node_index,
self.config_path,
port_allocator=self.__port_allocator.get_node_port_allocator(node_index),
- cluster_name=self.__cluster_name,
+ cluster_name=self.__cluster_name,
configurator=self.__configurator,
udfs_dir=self.__common_udfs_dir,
)
@@ -381,7 +381,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
def stop(self):
saved_exceptions = []
-
+
for slot in self.slots.values():
exception = self.__stop_node(slot)
if exception is not None:
@@ -396,9 +396,9 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
if saved_exceptions:
raise daemon.SeveralDaemonErrors(saved_exceptions)
-
- @property
- def config_path(self):
+
+ @property
+ def config_path(self):
if self.__config_path is None:
self.__config_path = ensure_path_exists(
get_unique_path_for_current_test(
@@ -410,8 +410,8 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
)
return self.__config_path
- def __write_configs(self):
- self.__configurator.write_proto_configs(self.config_path)
+ def __write_configs(self):
+ self.__configurator.write_proto_configs(self.config_path)
def __instantiate_udfs_dir(self):
to_load = self.__configurator.get_yql_udfs_to_load()
@@ -423,7 +423,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
os.symlink(udf_path, link_name)
return self.__common_udfs_dir
- def __format_disks(self, node_id):
+ def __format_disks(self, node_id):
for pdisk in self.__configurator.pdisks_info:
if pdisk['node_id'] != node_id:
continue
@@ -503,37 +503,37 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
self._bs_config_invoke(request)
return name
- def __wait_for_bs_controller_to_start(self):
- monitors = [node.monitor for node in self.nodes.values()]
+ def __wait_for_bs_controller_to_start(self):
+ monitors = [node.monitor for node in self.nodes.values()]
def predicate():
return blobstorage_controller_has_started_on_some_node(monitors)
- timeout_seconds = yatest_common.plain_or_under_sanitizer(120, 240)
+ timeout_seconds = yatest_common.plain_or_under_sanitizer(120, 240)
bs_controller_started = wait_for(
predicate=predicate, timeout_seconds=timeout_seconds, step_seconds=1.0, multiply=1.3
)
- assert bs_controller_started
+ assert bs_controller_started
class KikimrExternalNode(daemon.ExternalNodeDaemon, kikimr_node_interface.NodeInterface):
- def __init__(
+ def __init__(
self, node_id, host, port, mon_port, ic_port, mbus_port, configurator=None, slot_id=None):
super(KikimrExternalNode, self).__init__(host)
- self.__node_id = node_id
- self.__host = host
- self.__port = port
+ self.__node_id = node_id
+ self.__host = host
+ self.__port = port
self.__grpc_port = port
- self.__mon_port = mon_port
- self.__ic_port = ic_port
- self.__configurator = configurator
+ self.__mon_port = mon_port
+ self.__ic_port = ic_port
+ self.__configurator = configurator
self.__mbus_port = mbus_port
self.logger = logger.getChild(self.__class__.__name__)
if slot_id is not None:
self.__slot_id = "%s" % str(self.__ic_port)
else:
self.__slot_id = None
-
+
self._can_update = None
self.current_version_idx = 0
self.versions = [
@@ -553,7 +553,7 @@ class KikimrExternalNode(daemon.ExternalNodeDaemon, kikimr_node_interface.NodeIn
self._can_update &= False
return self._can_update
- def start(self):
+ def start(self):
if self.__slot_id is None:
return self.ssh_command("sudo start kikimr")
return self.ssh_command(
@@ -568,7 +568,7 @@ class KikimrExternalNode(daemon.ExternalNodeDaemon, kikimr_node_interface.NodeIn
"ic={}".format(self.__ic_port),
]
)
-
+
def stop(self):
if self.__slot_id is None:
return self.ssh_command("sudo stop kikimr")
@@ -589,27 +589,27 @@ class KikimrExternalNode(daemon.ExternalNodeDaemon, kikimr_node_interface.NodeIn
def cwd(self):
assert False, "not supported"
- @property
- def mon_port(self):
- return self.__mon_port
-
+ @property
+ def mon_port(self):
+ return self.__mon_port
+
@property
def pid(self):
return None
- def is_alive(self):
- # TODO implement check
- return True
-
- @property
- def host(self):
- return self.__host
-
- @property
- def port(self):
- return self.__port
-
- @property
+ def is_alive(self):
+ # TODO implement check
+ return True
+
+ @property
+ def host(self):
+ return self.__host
+
+ @property
+ def port(self):
+ return self.__port
+
+ @property
def grpc_ssl_port(self):
# TODO(gvit): support in clusters
return None
@@ -623,13 +623,13 @@ class KikimrExternalNode(daemon.ExternalNodeDaemon, kikimr_node_interface.NodeIn
return self.__mbus_port
@property
- def ic_port(self):
- return self.__ic_port
-
- @property
- def node_id(self):
- return self.__node_id
-
+ def ic_port(self):
+ return self.__ic_port
+
+ @property
+ def node_id(self):
+ return self.__node_id
+
@property
def logs_directory(self):
folder = 'kikimr_%s' % self.__slot_id if self.__slot_id else 'kikimr'
diff --git a/ydb/tests/library/harness/param_constants.py b/ydb/tests/library/harness/param_constants.py
index c478696a589..09b4ef2bc52 100644
--- a/ydb/tests/library/harness/param_constants.py
+++ b/ydb/tests/library/harness/param_constants.py
@@ -1,15 +1,15 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import os
import ydb.tests.library.common.yatest_common as yatest_common
-
-
+
+
config_name = yatest_common.get_param("kikimr.ci.cluster_name", None)
ssh_username = yatest_common.get_param("kikimr.ci.ssh_username", os.getenv('NEMESIS_USER', 'robot-nemesis'))
deploy_cluster = yatest_common.get_bool_param("kikimr.ci.deploy_cluster", False)
use_packages = yatest_common.get_bool_param('kikimr.ci.packages', True)
-
+
log_level = int(yatest_common.get_param('kikimr.ci.driver.log_level', 5))
-
+
kikimr_binary_deploy_path = '/Berkanavt/kikimr/bin/kikimr'
kikimr_configure_binary_deploy_path = '/Berkanavt/kikimr/bin/kikimr_configure'
kikimr_configuration_deploy_path = '/Berkanavt/kikimr/cfg'
@@ -35,7 +35,7 @@ def kikimr_stderr_to_console():
return yatest_common.get_bool_param("kikimr.ci.stderr_to_console", False)
-def kikimr_driver_path():
+def kikimr_driver_path():
built_binary = yatest_common.get_param("kikimr.ci.kikimr_driver", None)
if os.getenv("YDB_DRIVER_BINARY"):
return yatest_common.binary_path(os.getenv("YDB_DRIVER_BINARY"))
diff --git a/ydb/tests/library/harness/util.py b/ydb/tests/library/harness/util.py
index a5075ce0e8d..20a1e56359c 100644
--- a/ydb/tests/library/harness/util.py
+++ b/ydb/tests/library/harness/util.py
@@ -1,19 +1,19 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import enum
-
-
+
+
@enum.unique
class LogLevels(enum.IntEnum):
- EMERG = 0,
- ALERT = 1,
- CRIT = 2,
- ERROR = 3,
- WARN = 4,
- NOTICE = 5,
- INFO = 6,
+ EMERG = 0,
+ ALERT = 1,
+ CRIT = 2,
+ ERROR = 3,
+ WARN = 4,
+ NOTICE = 5,
+ INFO = 6,
DEBUG = 7,
TRACE = 8
-
+
@staticmethod
def from_string(val):
names = []
@@ -22,54 +22,54 @@ class LogLevels(enum.IntEnum):
if val == x.name:
return x
raise ValueError("Invalid LogLevel: valid are %s" % names)
+
-
-def _pdisk_state(id_, is_valid_state):
- return id_, is_valid_state
-
-
+def _pdisk_state(id_, is_valid_state):
+ return id_, is_valid_state
+
+
@enum.unique
class PDiskState(enum.Enum):
- Initial = _pdisk_state(0, is_valid_state=True)
- InitialFormatRead = _pdisk_state(1, is_valid_state=True)
- InitialFormatReadError = _pdisk_state(2, is_valid_state=False)
- InitialSysLogRead = _pdisk_state(3, is_valid_state=True)
- InitialSysLogReadError = _pdisk_state(4, is_valid_state=False)
- InitialSysLogParseError = _pdisk_state(5, is_valid_state=False)
- InitialCommonLogRead = _pdisk_state(6, is_valid_state=True)
- InitialCommonLogReadError = _pdisk_state(7, is_valid_state=False)
- InitialCommonLogParseError = _pdisk_state(8, is_valid_state=False)
- CommonLoggerInitError = _pdisk_state(9, is_valid_state=False)
- Normal = _pdisk_state(10, is_valid_state=True)
- OpenFileError = _pdisk_state(11, is_valid_state=False)
-
- def __init__(self, id_, is_valid_state):
- self.__id = id_
- self.__is_valid_state = is_valid_state
-
- def __int__(self):
- return self.__id
-
- def __str__(self):
- return self.name
-
- def __repr__(self):
- return self.name
-
- @property
- def is_valid_state(self):
- return self.__is_valid_state
-
- @staticmethod
- def from_int(val):
- for x in list(PDiskState):
- if val == int(x):
- return x
- raise ValueError()
-
- @staticmethod
- def from_string(val):
- for x in list(PDiskState):
- if val == x.name:
- return x
- raise ValueError()
+ Initial = _pdisk_state(0, is_valid_state=True)
+ InitialFormatRead = _pdisk_state(1, is_valid_state=True)
+ InitialFormatReadError = _pdisk_state(2, is_valid_state=False)
+ InitialSysLogRead = _pdisk_state(3, is_valid_state=True)
+ InitialSysLogReadError = _pdisk_state(4, is_valid_state=False)
+ InitialSysLogParseError = _pdisk_state(5, is_valid_state=False)
+ InitialCommonLogRead = _pdisk_state(6, is_valid_state=True)
+ InitialCommonLogReadError = _pdisk_state(7, is_valid_state=False)
+ InitialCommonLogParseError = _pdisk_state(8, is_valid_state=False)
+ CommonLoggerInitError = _pdisk_state(9, is_valid_state=False)
+ Normal = _pdisk_state(10, is_valid_state=True)
+ OpenFileError = _pdisk_state(11, is_valid_state=False)
+
+ def __init__(self, id_, is_valid_state):
+ self.__id = id_
+ self.__is_valid_state = is_valid_state
+
+ def __int__(self):
+ return self.__id
+
+ def __str__(self):
+ return self.name
+
+ def __repr__(self):
+ return self.name
+
+ @property
+ def is_valid_state(self):
+ return self.__is_valid_state
+
+ @staticmethod
+ def from_int(val):
+ for x in list(PDiskState):
+ if val == int(x):
+ return x
+ raise ValueError()
+
+ @staticmethod
+ def from_string(val):
+ for x in list(PDiskState):
+ if val == x.name:
+ return x
+ raise ValueError()
diff --git a/ydb/tests/library/matchers/datashard_matchers.py b/ydb/tests/library/matchers/datashard_matchers.py
index 94ac5e9a9a4..d37f5873fbc 100644
--- a/ydb/tests/library/matchers/datashard_matchers.py
+++ b/ydb/tests/library/matchers/datashard_matchers.py
@@ -1,23 +1,23 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
from ydb.tests.library.common.msgbus_types import MessageBusStatus
from ydb.tests.library.matchers.response_matchers import AbstractProtobufMatcher, FakeProtobuf
-
-__author__ = '[email protected]'
-
-
-class TResponseMatcher(AbstractProtobufMatcher):
-
- def __init__(self, status=MessageBusStatus.MSTATUS_OK):
- super(TResponseMatcher, self).__init__()
- self.expected_protobuf.Status = status
-
- def with_minikql_compile_results(self, message):
- if 'ProgramCompileErrors' not in self.expected_protobuf.MiniKQLCompileResults:
- self.expected_protobuf.MiniKQLCompileResults.ProgramCompileErrors = []
-
- self.expected_protobuf.MiniKQLCompileResults.ProgramCompileErrors.append(
+
+__author__ = '[email protected]'
+
+
+class TResponseMatcher(AbstractProtobufMatcher):
+
+ def __init__(self, status=MessageBusStatus.MSTATUS_OK):
+ super(TResponseMatcher, self).__init__()
+ self.expected_protobuf.Status = status
+
+ def with_minikql_compile_results(self, message):
+ if 'ProgramCompileErrors' not in self.expected_protobuf.MiniKQLCompileResults:
+ self.expected_protobuf.MiniKQLCompileResults.ProgramCompileErrors = []
+
+ self.expected_protobuf.MiniKQLCompileResults.ProgramCompileErrors.append(
FakeProtobuf(message=message)
- )
- return self
+ )
+ return self
diff --git a/ydb/tests/library/matchers/response.py b/ydb/tests/library/matchers/response.py
index d492116b4b2..b33c6a072db 100644
--- a/ydb/tests/library/matchers/response.py
+++ b/ydb/tests/library/matchers/response.py
@@ -1,17 +1,17 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
import six
from hamcrest import all_of, has_property, has_properties
-from hamcrest.core.base_matcher import BaseMatcher
-
+from hamcrest.core.base_matcher import BaseMatcher
+
import ydb.core.protos.msgbus_kv_pb2 as msgbus_kv
from ydb.tests.library.common.msgbus_types import EReplyStatus, TStorageStatusFlags
from ydb.tests.library.common.msgbus_types import MessageBusStatus
from ydb.tests.library.matchers.collection import contains
from ydb.tests.library.matchers.response_matchers import ProtobufWithStatusMatcher
-
+
def to_bytes(v):
if v is None:
return None
@@ -24,29 +24,29 @@ def to_bytes(v):
return v
-class KeyValueResponseProtobufMatcher(BaseMatcher):
-
+class KeyValueResponseProtobufMatcher(BaseMatcher):
+
def __init__(self, status=MessageBusStatus.MSTATUS_OK, do_describe=True):
- self.__read_range_matchers = []
- self.__read_keys_matchers = []
+ self.__read_range_matchers = []
+ self.__read_keys_matchers = []
self.__write_matchers = []
self.__rename_matchers = []
self.__delete_matcher = None
- self.__copy_range_matchers = []
- self.__concat_keys_result_matchers = []
- self.__inc_gen_result_matcher = None
- self.__storage_channel_result_matchers = []
+ self.__copy_range_matchers = []
+ self.__concat_keys_result_matchers = []
+ self.__inc_gen_result_matcher = None
+ self.__storage_channel_result_matchers = []
self.__do_describe = do_describe
- self.__describe_actual_proto_fields = set()
- self.__status = status
-
- def no_describe(self, describe_fields=()):
+ self.__describe_actual_proto_fields = set()
+ self.__status = status
+
+ def no_describe(self, describe_fields=()):
self.__do_describe = False
- self.__describe_actual_proto_fields = set(describe_fields)
+ self.__describe_actual_proto_fields = set(describe_fields)
return self
- def describe_to(self, description):
- description.append_text('Valid response with Status: %i' % self.__status)
+ def describe_to(self, description):
+ description.append_text('Valid response with Status: %i' % self.__status)
if self.__do_describe:
if self.__inc_gen_result_matcher is not None:
description.append_text(' and IncrementGenerationResult = \n')
@@ -71,39 +71,39 @@ class KeyValueResponseProtobufMatcher(BaseMatcher):
contains(*self.__concat_keys_result_matchers).describe_to(description)
else:
description.append_text("(Verbose mismatch description was disabled for this test)")
-
- def describe_mismatch(self, actual_protobuf, mismatch_description):
- if self.__do_describe and not self.__describe_actual_proto_fields:
- actual_protobuf_str = str(actual_protobuf)
+
+ def describe_mismatch(self, actual_protobuf, mismatch_description):
+ if self.__do_describe and not self.__describe_actual_proto_fields:
+ actual_protobuf_str = str(actual_protobuf)
else:
- lst = []
- field_names = [f.name for f in actual_protobuf.DESCRIPTOR.fields]
- for f in field_names:
- if f in self.__describe_actual_proto_fields:
- value = getattr(actual_protobuf, f)
+ lst = []
+ field_names = [f.name for f in actual_protobuf.DESCRIPTOR.fields]
+ for f in field_names:
+ if f in self.__describe_actual_proto_fields:
+ value = getattr(actual_protobuf, f)
if not isinstance(value, six.text_type):
- try:
- value = list([v for v in value])
- except TypeError:
- pass
- lst.append("{f} = {v}".format(f=f, v=value))
- lst.append('\n')
- actual_protobuf_str = '\n'.join(lst)
-
- mismatch_description.append_text("Actual protobuf = \n")
- mismatch_description.append_text("=" * 60 + "\n")
- mismatch_description.append_text(actual_protobuf_str)
- mismatch_description.append_text("=" * 60 + "\n")
-
- def _matches(self, actual_protobuf):
- if not hasattr(actual_protobuf, 'Status') or actual_protobuf.Status != self.__status:
- return False
-
+ try:
+ value = list([v for v in value])
+ except TypeError:
+ pass
+ lst.append("{f} = {v}".format(f=f, v=value))
+ lst.append('\n')
+ actual_protobuf_str = '\n'.join(lst)
+
+ mismatch_description.append_text("Actual protobuf = \n")
+ mismatch_description.append_text("=" * 60 + "\n")
+ mismatch_description.append_text(actual_protobuf_str)
+ mismatch_description.append_text("=" * 60 + "\n")
+
+ def _matches(self, actual_protobuf):
+ if not hasattr(actual_protobuf, 'Status') or actual_protobuf.Status != self.__status:
+ return False
+
if self.__inc_gen_result_matcher is not None\
and not self.__inc_gen_result_matcher.matches(actual_protobuf.IncrementGenerationResult):
- return False
-
- if (
+ return False
+
+ if (
(self.__read_range_matchers and
not contains(*self.__read_range_matchers).matches(actual_protobuf.ReadRangeResult)
) or
@@ -124,49 +124,49 @@ class KeyValueResponseProtobufMatcher(BaseMatcher):
) or
(self.__read_keys_matchers and
not contains(*self.__read_keys_matchers).matches(actual_protobuf.ReadResult)
- ) or
- (self.__storage_channel_result_matchers and
- not contains(*self.__storage_channel_result_matchers).matches(actual_protobuf.GetStatusResult)
+ ) or
+ (self.__storage_channel_result_matchers and
+ not contains(*self.__storage_channel_result_matchers).matches(actual_protobuf.GetStatusResult)
)
- ):
- return False
-
- return True
-
+ ):
+ return False
+
+ return True
+
def read_range(self, key_value_pairs, status=EReplyStatus.OK):
- key_value_pair_matchers = tuple(kv_pair.protobuf_matcher() for kv_pair in key_value_pairs)
- self.__read_range_matchers.append(
- has_properties(
+ key_value_pair_matchers = tuple(kv_pair.protobuf_matcher() for kv_pair in key_value_pairs)
+ self.__read_range_matchers.append(
+ has_properties(
Status=status,
- Pair=contains(*tuple(
- key_value_pair_matchers
- ))
- )
- )
- return self
-
+ Pair=contains(*tuple(
+ key_value_pair_matchers
+ ))
+ )
+ )
+ return self
+
def read_key(self, value, status=EReplyStatus.OK):
- self.__read_keys_matchers.append(
- has_properties(
+ self.__read_keys_matchers.append(
+ has_properties(
Status=status,
Value=to_bytes(value)
- )
- )
- return self
-
- def write(self, num_of_writes=1):
+ )
+ )
+ return self
+
+ def write(self, num_of_writes=1):
self.__write_matchers.extend(
- has_properties(Status=int(EReplyStatus.OK), StatusFlags=int(TStorageStatusFlags.StatusIsValid))
- for _ in range(num_of_writes)
- )
- return self
-
- def add_write_result_with_status(self, status, flags):
- self.__write_matchers.append(
- has_properties(Status=int(status), StatusFlags=int(flags))
+ has_properties(Status=int(EReplyStatus.OK), StatusFlags=int(TStorageStatusFlags.StatusIsValid))
+ for _ in range(num_of_writes)
)
return self
+ def add_write_result_with_status(self, status, flags):
+ self.__write_matchers.append(
+ has_properties(Status=int(status), StatusFlags=int(flags))
+ )
+ return self
+
def rename(self, num_of_renames=1):
self.__rename_matchers.extend(
has_property('Status', int(EReplyStatus.OK)) for _ in range(num_of_renames)
@@ -176,70 +176,70 @@ class KeyValueResponseProtobufMatcher(BaseMatcher):
def delete(self, num_of_keys=1):
self.__delete_matcher = contains(*tuple(
has_property('Status', EReplyStatus.OK) for _ in range(num_of_keys)
- ))
- return self
-
- def copy_range(self, num_of_ranges_copied=1):
- self.__copy_range_matchers.extend(
- has_property('Status', EReplyStatus.OK) for _ in range(num_of_ranges_copied)
- )
- return self
-
- def concat_keys(self):
- self.__concat_keys_result_matchers.append(
- has_property('Status', EReplyStatus.OK)
- )
- return self
-
- def inc_generation(self, new_gen):
- self.__inc_gen_result_matcher = has_properties(
- Status=EReplyStatus.OK,
- Generation=new_gen
- )
- return self
-
- def add_storage_channel_status_result(
- self,
- flags=TStorageStatusFlags.StatusIsValid,
- storage_channel_type=msgbus_kv.TKeyValueRequest.MAIN,
- status=EReplyStatus.OK
- ):
- self.__storage_channel_result_matchers.append(
- has_properties(
- Status=status,
- StorageChannel=storage_channel_type,
- StatusFlags=int(flags)
- )
- )
- return self
-
-
-def is_response_with_status(status):
+ ))
+ return self
+
+ def copy_range(self, num_of_ranges_copied=1):
+ self.__copy_range_matchers.extend(
+ has_property('Status', EReplyStatus.OK) for _ in range(num_of_ranges_copied)
+ )
+ return self
+
+ def concat_keys(self):
+ self.__concat_keys_result_matchers.append(
+ has_property('Status', EReplyStatus.OK)
+ )
+ return self
+
+ def inc_generation(self, new_gen):
+ self.__inc_gen_result_matcher = has_properties(
+ Status=EReplyStatus.OK,
+ Generation=new_gen
+ )
+ return self
+
+ def add_storage_channel_status_result(
+ self,
+ flags=TStorageStatusFlags.StatusIsValid,
+ storage_channel_type=msgbus_kv.TKeyValueRequest.MAIN,
+ status=EReplyStatus.OK
+ ):
+ self.__storage_channel_result_matchers.append(
+ has_properties(
+ Status=status,
+ StorageChannel=storage_channel_type,
+ StatusFlags=int(flags)
+ )
+ )
+ return self
+
+
+def is_response_with_status(status):
return ProtobufWithStatusMatcher(status)
-
-
+
+
def is_ok_response():
- return is_response_with_status(MessageBusStatus.MSTATUS_OK)
-
+ return is_response_with_status(MessageBusStatus.MSTATUS_OK)
+
-def is_valid_response_with_field(field_name, field_matcher):
- return all_of(
+def is_valid_response_with_field(field_name, field_matcher):
+ return all_of(
has_property('Status', MessageBusStatus.MSTATUS_OK),
has_property(field_name, field_matcher)
- )
-
-
-def is_response_with_status_and_fields(status, **kwargs):
- return all_of(
- is_response_with_status(status),
- has_properties(**kwargs)
- )
-
-
+ )
+
+
+def is_response_with_status_and_fields(status, **kwargs):
+ return all_of(
+ is_response_with_status(status),
+ has_properties(**kwargs)
+ )
+
+
def is_valid_read_range_response(key_value_pairs,
main_status=MessageBusStatus.MSTATUS_OK, result_status=EReplyStatus.OK):
return KeyValueResponseProtobufMatcher(main_status).read_range(key_value_pairs, status=result_status)
-
-
+
+
def is_valid_keyvalue_protobuf_response():
- return KeyValueResponseProtobufMatcher()
+ return KeyValueResponseProtobufMatcher()
diff --git a/ydb/tests/library/matchers/response_matchers.py b/ydb/tests/library/matchers/response_matchers.py
index 5fb2abcdfda..2aca10edb32 100644
--- a/ydb/tests/library/matchers/response_matchers.py
+++ b/ydb/tests/library/matchers/response_matchers.py
@@ -1,126 +1,126 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import abc
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import abc
from six import iteritems
-
-from hamcrest.core.base_matcher import BaseMatcher
-from hamcrest.core.helpers.wrap_matcher import wrap_matcher
-
+
+from hamcrest.core.base_matcher import BaseMatcher
+from hamcrest.core.helpers.wrap_matcher import wrap_matcher
+
from ydb.tests.library.common.msgbus_types import MessageBusStatus
-
-__author__ = '[email protected]'
-
-
-class FakeProtobuf(object):
- """
- Fake protobuf-like object with dynamic fields.
- Special created to use in
-
- >>> d = FakeProtobuf()
- >>> d.val = 100
- >>> str(d.val)
- '<100>'
- >>> d.val2.sub = 100
- >>> str(d.val2.sub)
- '<100>'
- >>> list(map(lambda x: x[0], d))
- ['val', 'val2']
- >>> list(map(lambda x: x[0], d.val2))
- ['sub']
-
- """
-
- def __init__(self, **kwargs):
+
+__author__ = '[email protected]'
+
+
+class FakeProtobuf(object):
+ """
+ Fake protobuf-like object with dynamic fields.
+ Special created to use in
+
+ >>> d = FakeProtobuf()
+ >>> d.val = 100
+ >>> str(d.val)
+ '<100>'
+ >>> d.val2.sub = 100
+ >>> str(d.val2.sub)
+ '<100>'
+ >>> list(map(lambda x: x[0], d))
+ ['val', 'val2']
+ >>> list(map(lambda x: x[0], d.val2))
+ ['sub']
+
+ """
+
+ def __init__(self, **kwargs):
self.__dict__['_data'] = dict()
for k, v in iteritems(kwargs):
if v is not None:
setattr(self, k, v)
-
- def __getattr__(self, name):
+
+ def __getattr__(self, name):
ret = self._data.get(name, None)
- if ret is None:
- ret = FakeProtobuf()
+ if ret is None:
+ ret = FakeProtobuf()
self._data[name] = ret
- return ret
-
- def __setattr__(self, name, value):
- if isinstance(value, list):
+ return ret
+
+ def __setattr__(self, name, value):
+ if isinstance(value, list):
self._data[name] = value
- else:
+ else:
self._data[name] = wrap_matcher(value)
-
- def __getitem__(self, name):
+
+ def __getitem__(self, name):
return self._data.get(name, None)
-
+
def __len__(self):
return len(self._data)
- def __str__(self):
- return str(map(lambda x: (x[0], str(x[1])), iter(self)))
-
- def __iter__(self):
+ def __str__(self):
+ return str(map(lambda x: (x[0], str(x[1])), iter(self)))
+
+ def __iter__(self):
return iter(sorted(self._data.items(), key=lambda x: x[0]))
-
-
-class AbstractProtobufMatcher(BaseMatcher):
- __metaclass__ = abc.ABCMeta
-
- def __init__(self):
- self.__expected_protobuf = FakeProtobuf()
- self.__horizontal_line = "\n" + "=" * 60 + "\n"
-
- @property
- def expected_protobuf(self):
- return self.__expected_protobuf
-
- def describe_to(self, expected_description):
- expected_description.append_text(self.__horizontal_line)
- self.__describe2('', self.expected_protobuf, expected_description, 0)
- expected_description.append_text(self.__horizontal_line)
-
- def __describe2(self, attr_name, matcher, expected_description, level):
- prefix = " " * level
- if isinstance(matcher, BaseMatcher):
- expected_description.append_text(prefix + attr_name + ' = ')
- matcher.describe_to(expected_description)
- expected_description.append_text("\n")
- elif isinstance(matcher, list):
- for item in matcher:
- self.__describe2(attr_name, item, expected_description, level)
- expected_description.append_text("\n")
- else:
- # FakeProtobuf
- expected_description.append_text(prefix + attr_name + " {\n")
- for attr_name, value in matcher:
- self.__describe2(attr_name, value, expected_description, level + 1)
- expected_description.append_text("\n" + prefix + "}")
-
- def describe_mismatch(self, actual_protobuf, mismatch_description):
- mismatch_description.append_text("Actual protobuf = ")
- mismatch_description.append_text(self.__horizontal_line)
- mismatch_description.append_text(str(actual_protobuf))
- mismatch_description.append_text(self.__horizontal_line)
-
- def _matches(self, actual_protobuf):
- return self.__match(self.expected_protobuf, actual_protobuf)
-
- def __match(self, matcher, actual_protobuf):
- if isinstance(matcher, BaseMatcher):
+
+
+class AbstractProtobufMatcher(BaseMatcher):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self):
+ self.__expected_protobuf = FakeProtobuf()
+ self.__horizontal_line = "\n" + "=" * 60 + "\n"
+
+ @property
+ def expected_protobuf(self):
+ return self.__expected_protobuf
+
+ def describe_to(self, expected_description):
+ expected_description.append_text(self.__horizontal_line)
+ self.__describe2('', self.expected_protobuf, expected_description, 0)
+ expected_description.append_text(self.__horizontal_line)
+
+ def __describe2(self, attr_name, matcher, expected_description, level):
+ prefix = " " * level
+ if isinstance(matcher, BaseMatcher):
+ expected_description.append_text(prefix + attr_name + ' = ')
+ matcher.describe_to(expected_description)
+ expected_description.append_text("\n")
+ elif isinstance(matcher, list):
+ for item in matcher:
+ self.__describe2(attr_name, item, expected_description, level)
+ expected_description.append_text("\n")
+ else:
+ # FakeProtobuf
+ expected_description.append_text(prefix + attr_name + " {\n")
+ for attr_name, value in matcher:
+ self.__describe2(attr_name, value, expected_description, level + 1)
+ expected_description.append_text("\n" + prefix + "}")
+
+ def describe_mismatch(self, actual_protobuf, mismatch_description):
+ mismatch_description.append_text("Actual protobuf = ")
+ mismatch_description.append_text(self.__horizontal_line)
+ mismatch_description.append_text(str(actual_protobuf))
+ mismatch_description.append_text(self.__horizontal_line)
+
+ def _matches(self, actual_protobuf):
+ return self.__match(self.expected_protobuf, actual_protobuf)
+
+ def __match(self, matcher, actual_protobuf):
+ if isinstance(matcher, BaseMatcher):
return matcher.matches(actual_protobuf)
- elif isinstance(matcher, list):
- return len(actual_protobuf) == len(matcher) and \
+ elif isinstance(matcher, list):
+ return len(actual_protobuf) == len(matcher) and \
all(
self.__match(item, actual_protobuf[i])
for i, item in enumerate(matcher)
)
- else:
+ else:
return all(
self.__match(value, getattr(actual_protobuf, name))
- for name, value in matcher
+ for name, value in matcher
)
-
-
+
+
class ProtobufWithStatusMatcher(AbstractProtobufMatcher):
def __init__(self, status=MessageBusStatus.MSTATUS_OK, error_code=None, error_reason=None):
super(ProtobufWithStatusMatcher, self).__init__()
@@ -129,26 +129,26 @@ class ProtobufWithStatusMatcher(AbstractProtobufMatcher):
self.expected_protobuf.ErrorCode = error_code
if error_reason is not None:
self.expected_protobuf.ErrorReason = error_reason
-
-
-class DynamicFieldsProtobufMatcher(AbstractProtobufMatcher):
- """
- Highly dynamic matcher for Protobuf objects
- You can use it to match any Protobuf object without declaring fields.
-
- >>> d = DynamicFieldsProtobufMatcher()
- >>> d.val(100).qwe(120)
- DynamicFieldsProtobufMatcher[('qwe', '<120>'), ('val', '<100>')]
- """
- def __init__(self):
- super(DynamicFieldsProtobufMatcher, self).__init__()
-
- def __getattr__(self, name):
- def closure(val):
- setattr(self.expected_protobuf, name, val)
- return self
-
- return closure
-
- def __repr__(self):
- return 'DynamicFieldsProtobufMatcher' + str(self.expected_protobuf)
+
+
+class DynamicFieldsProtobufMatcher(AbstractProtobufMatcher):
+ """
+ Highly dynamic matcher for Protobuf objects
+ You can use it to match any Protobuf object without declaring fields.
+
+ >>> d = DynamicFieldsProtobufMatcher()
+ >>> d.val(100).qwe(120)
+ DynamicFieldsProtobufMatcher[('qwe', '<120>'), ('val', '<100>')]
+ """
+ def __init__(self):
+ super(DynamicFieldsProtobufMatcher, self).__init__()
+
+ def __getattr__(self, name):
+ def closure(val):
+ setattr(self.expected_protobuf, name, val)
+ return self
+
+ return closure
+
+ def __repr__(self):
+ return 'DynamicFieldsProtobufMatcher' + str(self.expected_protobuf)
diff --git a/ydb/tests/library/matchers/tablets.py b/ydb/tests/library/matchers/tablets.py
index c73b8e42972..08aae5d9368 100644
--- a/ydb/tests/library/matchers/tablets.py
+++ b/ydb/tests/library/matchers/tablets.py
@@ -1,17 +1,17 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
from hamcrest import has_property, all_of, has_length, has_items, anything
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.helpers.wrap_matcher import wrap_matcher
from ydb.tests.library.common.msgbus_types import EMessageStatus, MessageBusStatus
-
-
-def all_tablets_are_created(tablets_to_create):
+
+
+def all_tablets_are_created(tablets_to_create):
return all_of(
has_property('Status', MessageBusStatus.MSTATUS_OK),
- has_property(
+ has_property(
'CreateTabletResult',
all_of(
has_length(len(tablets_to_create)),
diff --git a/ydb/tests/library/nemesis/__init__.py b/ydb/tests/library/nemesis/__init__.py
index 5c8fc7caeb2..68772b95ee2 100644
--- a/ydb/tests/library/nemesis/__init__.py
+++ b/ydb/tests/library/nemesis/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-__author__ = '[email protected]'
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+__author__ = '[email protected]'
diff --git a/ydb/tests/library/nemesis/nemesis_core.py b/ydb/tests/library/nemesis/nemesis_core.py
index 6886982c23a..89402bcfe60 100644
--- a/ydb/tests/library/nemesis/nemesis_core.py
+++ b/ydb/tests/library/nemesis/nemesis_core.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import abc
-import heapq
-import itertools
+import heapq
+import itertools
import logging
import random
import time
@@ -32,14 +32,14 @@ class RunUnderNemesisContext(object):
def __exit__(self, type, value, traceback):
if self.__nemesis is not None:
self.__nemesis.stop()
- return False
-
+ return False
+
class NemesisProcess(threading.Thread):
def __init__(self, nemesis_factory, initial_sleep=10):
super(NemesisProcess, self).__init__(name='Nemesis')
- self.__nemesis_factory = nemesis_factory
- self.__private_nemesis_list = wrap_in_list(nemesis_factory)
+ self.__nemesis_factory = nemesis_factory
+ self.__private_nemesis_list = wrap_in_list(nemesis_factory)
self.__pq = PriorityQueue()
self.__is_running = threading.Event()
self.__finished_running = threading.Event()
@@ -49,10 +49,10 @@ class NemesisProcess(threading.Thread):
self.__logger = logger.getChild(self.__class__.__name__)
@property
- def __nemesis_list(self):
- if self.__private_nemesis_list is None:
- self.__private_nemesis_list = wrap_in_list(self.__nemesis_factory())
- return self.__private_nemesis_list
+ def __nemesis_list(self):
+ if self.__private_nemesis_list is None:
+ self.__private_nemesis_list = wrap_in_list(self.__nemesis_factory())
+ return self.__private_nemesis_list
def stop(self):
if self.__is_running.is_set():
@@ -60,14 +60,14 @@ class NemesisProcess(threading.Thread):
else:
return
- start_time = time.time()
+ start_time = time.time()
self.__logger.info("Stopping Nemesis")
# wait for Nemesis to stop
finish_time = time.time() + 480
while not self.__finished_running.is_set() and time.time() < finish_time:
time.sleep(1)
- finish_time = time.time()
+ finish_time = time.time()
self.__logger.info(
"Stopped Nemesis successfully in {} seconds".format(
int(finish_time - start_time)
@@ -75,32 +75,32 @@ class NemesisProcess(threading.Thread):
)
def run(self):
- try:
- self.__run()
- except Exception:
- self.__logger.exception("Some exception in NemesisProcess")
- raise
- finally:
- self.__stop_nemesis()
-
- def __run(self):
- random.seed()
+ try:
+ self.__run()
+ except Exception:
+ self.__logger.exception("Some exception in NemesisProcess")
+ raise
+ finally:
+ self.__stop_nemesis()
+
+ def __run(self):
+ random.seed()
self.__pq.clear()
self.__is_running.set()
self.__finished_running.clear()
time.sleep(self.__initial_sleep)
- self.__init_pq()
-
- while self.__is_running.is_set() and self.__pq:
- while self.__is_running.is_set() and time.time() < self.__pq.peek_priority():
- time.sleep(1)
- if not self.__is_running.is_set():
- break
-
- nemesis = self.__pq.pop()
- try:
- nemesis.inject_fault()
+ self.__init_pq()
+
+ while self.__is_running.is_set() and self.__pq:
+ while self.__is_running.is_set() and time.time() < self.__pq.peek_priority():
+ time.sleep(1)
+ if not self.__is_running.is_set():
+ break
+
+ nemesis = self.__pq.pop()
+ try:
+ nemesis.inject_fault()
except Exception:
self.__logger.exception(
'Inject fault for nemesis = {nemesis} failed.'.format(
@@ -108,15 +108,15 @@ class NemesisProcess(threading.Thread):
)
)
- priority = time.time() + nemesis.next_schedule()
- self.__pq.add_task(task=nemesis, priority=priority)
-
- def __init_pq(self):
+ priority = time.time() + nemesis.next_schedule()
+ self.__pq.add_task(task=nemesis, priority=priority)
+
+ def __init_pq(self):
self.__logger.info("NemesisProcess started")
- self.__logger.info("self.nemesis_list = " + str(self.__nemesis_list))
+ self.__logger.info("self.nemesis_list = " + str(self.__nemesis_list))
# noinspection PyTypeChecker
- for nemesis in self.__nemesis_list:
+ for nemesis in self.__nemesis_list:
prepared = False
while not prepared:
try:
@@ -129,22 +129,22 @@ class NemesisProcess(threading.Thread):
time.sleep(1)
# noinspection PyTypeChecker
- for nemesis in self.__nemesis_list:
+ for nemesis in self.__nemesis_list:
priority = time.time() + nemesis.next_schedule()
self.__pq.add_task(nemesis, priority=priority)
- self.__logger.debug("Initial PriorityQueue = " + str(self.__pq))
+ self.__logger.debug("Initial PriorityQueue = " + str(self.__pq))
- def __stop_nemesis(self):
+ def __stop_nemesis(self):
# Stopping Nemesis
self.__logger.info("Stopping Nemesis in run()")
# noinspection PyTypeChecker
- for nemesis in self.__nemesis_list:
+ for nemesis in self.__nemesis_list:
self.__logger.info("Extracting fault for Nemesis = " + str(nemesis))
- try:
- nemesis.extract_fault()
- except Exception:
- logger.exception('Nemesis = {nemesis} extract_fault() failed with exception = '.format(nemesis=nemesis))
+ try:
+ nemesis.extract_fault()
+ except Exception:
+ logger.exception('Nemesis = {nemesis} extract_fault() failed with exception = '.format(nemesis=nemesis))
self.__finished_running.set()
self.__logger.info("Stopped Nemesis successfully in run()")
@@ -155,79 +155,79 @@ class Nemesis(object):
def __init__(self, schedule):
self.__schedule = Schedule.from_tuple_or_int(schedule)
- self.__logger = logging.getLogger(self.__class__.__name__)
+ self.__logger = logging.getLogger(self.__class__.__name__)
def next_schedule(self):
- """
- Return amount of second from current time this Nemesis should be called with `inject_fault()`
-
- :return: amount of seconds to schedule this Nemesis next time
- """
+ """
+ Return amount of second from current time this Nemesis should be called with `inject_fault()`
+
+ :return: amount of seconds to schedule this Nemesis next time
+ """
return next(self.__schedule)
@abc.abstractmethod
def prepare_state(self):
- """
- Prepare state of your Nemesis. Called only once on start.
-
- :return: not specified
- """
+ """
+ Prepare state of your Nemesis. Called only once on start.
+
+ :return: not specified
+ """
pass
@abc.abstractmethod
def inject_fault(self):
- """
- Inject some fault into running cluster.
-
- :return: not specified
- """
+ """
+ Inject some fault into running cluster.
+
+ :return: not specified
+ """
pass
@abc.abstractmethod
def extract_fault(self):
- """
- Cancel all injected fault if this is possible. Some faults can't be canceled (e.g. node formatting).
- Usually called at the end of the Nemesis run.
-
- :return: not specified
- """
+ """
+ Cancel all injected fault if this is possible. Some faults can't be canceled (e.g. node formatting).
+ Usually called at the end of the Nemesis run.
+
+ :return: not specified
+ """
pass
- @property
- def logger(self):
- """
- Logger for current Nemesis.
-
- :return: logger
- """
- return self.__logger
-
- def __str__(self):
- return self.__repr__()
-
+ @property
+ def logger(self):
+ """
+ Logger for current Nemesis.
+
+ :return: logger
+ """
+ return self.__logger
+
+ def __str__(self):
+ return self.__repr__()
+
def __repr__(self):
- return '{ntype}'.format(ntype=type(self))
+ return '{ntype}'.format(ntype=type(self))
class AbstractNemesisNodeTerrorist(Nemesis):
__metaclass__ = abc.ABCMeta
- def __init__(self, node_list, act_interval, ssh_user=None, remote_sudo_user=None, timeout=60):
+ def __init__(self, node_list, act_interval, ssh_user=None, remote_sudo_user=None, timeout=60):
super(AbstractNemesisNodeTerrorist, self).__init__(act_interval)
self._remote_exec_method = remote_execution.execute_command
self.__nodes = node_list
self.__ssh_user = ssh_user
self.__sudo_user = remote_sudo_user
- self.__timeout = timeout
+ self.__timeout = timeout
def _get_victim_node(self):
return random.choice(self.__nodes)
- @property
- def timeout(self):
- return self.__timeout
-
+ @property
+ def timeout(self):
+ return self.__timeout
+
@abc.abstractmethod
def _commands_on_node(self, node=None):
pass
@@ -252,7 +252,7 @@ class AbstractNemesisNodeTerrorist(Nemesis):
self._pre_inject_fault(node, node_commands)
for command in node_commands:
- cmd_result = self._remote_exec_method(self._full_command(node, command))
+ cmd_result = self._remote_exec_method(self._full_command(node, command))
success = cmd_result == 0 and success
self._post_inject_fault(node, node_commands)
@@ -314,11 +314,11 @@ class Schedule(collections_abc.Iterator):
return Schedule(six.moves.map(lambda x: random.randint(a, b), itertools.count()))
-class RunOnceSchedule(Schedule):
- def __init__(self, time_at):
- super(RunOnceSchedule, self).__init__(iter([time_at, 2**50]))
-
-
+class RunOnceSchedule(Schedule):
+ def __init__(self, time_at):
+ super(RunOnceSchedule, self).__init__(iter([time_at, 2**50]))
+
+
class PriorityQueue(object):
def __init__(self):
super(PriorityQueue, self).__init__()
@@ -348,87 +348,87 @@ class PriorityQueue(object):
return len(self.__heap)
def __str__(self):
- # return str(self.__heap)
- return '\n'.join(map(str, sorted([(entry[0], entry[1]) for entry in self.__heap])))
+ # return str(self.__heap)
+ return '\n'.join(map(str, sorted([(entry[0], entry[1]) for entry in self.__heap])))
class FakeNemesis(Nemesis):
- """
- >>> n = FakeNemesis(None)
+ """
+ >>> n = FakeNemesis(None)
>>> print(n.logger.name)
- FakeNemesis
- """
+ FakeNemesis
+ """
- def __init__(self, out_queue, schedule=1):
- super(FakeNemesis, self).__init__(schedule=schedule)
- self.__out_queue = out_queue
+ def __init__(self, out_queue, schedule=1):
+ super(FakeNemesis, self).__init__(schedule=schedule)
+ self.__out_queue = out_queue
def inject_fault(self):
- self.__out_queue.put('inject_fault')
+ self.__out_queue.put('inject_fault')
def prepare_state(self):
- self.__out_queue.put('prepare_state')
+ self.__out_queue.put('prepare_state')
def extract_fault(self):
- self.__out_queue.put('extract_fault')
+ self.__out_queue.put('extract_fault')
def next_schedule(self):
- n = super(FakeNemesis, self).next_schedule()
- self.__out_queue.put('next_schedule = ' + str(n))
- return n
-
-
-class ExceptionThrowingNemesis(Nemesis):
-
- def __init__(self, out_queue, schedule=1):
- super(ExceptionThrowingNemesis, self).__init__(schedule=schedule)
- self.__out_queue = out_queue
-
- def inject_fault(self):
- # raise AssertionError("ExceptionThrowingNemesis")
- raise RuntimeError("ExceptionThrowingNemesis")
-
- def prepare_state(self):
- self.__out_queue.put('prepare_state')
-
- def extract_fault(self):
- self.__out_queue.put('extract_fault')
-
- def next_schedule(self):
- n = super(ExceptionThrowingNemesis, self).next_schedule()
- self.__out_queue.put('next_schedule = ' + str(n))
- return n
-
-
+ n = super(FakeNemesis, self).next_schedule()
+ self.__out_queue.put('next_schedule = ' + str(n))
+ return n
+
+
+class ExceptionThrowingNemesis(Nemesis):
+
+ def __init__(self, out_queue, schedule=1):
+ super(ExceptionThrowingNemesis, self).__init__(schedule=schedule)
+ self.__out_queue = out_queue
+
+ def inject_fault(self):
+ # raise AssertionError("ExceptionThrowingNemesis")
+ raise RuntimeError("ExceptionThrowingNemesis")
+
+ def prepare_state(self):
+ self.__out_queue.put('prepare_state')
+
+ def extract_fault(self):
+ self.__out_queue.put('extract_fault')
+
+ def next_schedule(self):
+ n = super(ExceptionThrowingNemesis, self).next_schedule()
+ self.__out_queue.put('next_schedule = ' + str(n))
+ return n
+
+
def test_priority_queue():
"""
>>> pq = PriorityQueue()
- >>> pq.add_task('last', time.time() + 10)
- >>> pq.add_task('first', time.time())
- >>> pq.add_task('task 4', time.time() + 4)
- >>> pq.add_task('task 3', time.time() + 3)
- >>> pq.add_task('task 2', time.time() + 2)
+ >>> pq.add_task('last', time.time() + 10)
+ >>> pq.add_task('first', time.time())
+ >>> pq.add_task('task 4', time.time() + 4)
+ >>> pq.add_task('task 3', time.time() + 3)
+ >>> pq.add_task('task 2', time.time() + 2)
>>> pq.pop()
- 'first'
+ 'first'
>>> pq.peek()
- 'task 2'
+ 'task 2'
>>> len(pq)
4
>>> pq.pop()
- 'task 2'
+ 'task 2'
>>> len(pq)
3
>>> bool(pq)
True
- >>> pq.add_task('first', time.time())
- >>> pq.pop()
- 'first'
+ >>> pq.add_task('first', time.time())
>>> pq.pop()
- 'task 3'
+ 'first'
>>> pq.pop()
- 'task 4'
+ 'task 3'
>>> pq.pop()
- 'last'
+ 'task 4'
+ >>> pq.pop()
+ 'last'
>>> bool(pq)
False
"""
@@ -437,32 +437,32 @@ def test_priority_queue():
def test_nemesis_process():
"""
>>> from multiprocessing import Queue
- >>> timeout = 10
+ >>> timeout = 10
>>> out_queue = Queue()
- >>> np = NemesisProcess(FakeNemesis(out_queue, schedule=1), initial_sleep=0)
+ >>> np = NemesisProcess(FakeNemesis(out_queue, schedule=1), initial_sleep=0)
>>> np.start()
>>> time.sleep(1)
- >>> out_queue.get(timeout=timeout)
+ >>> out_queue.get(timeout=timeout)
'prepare_state'
- >>> out_queue.get(timeout=timeout)
- 'next_schedule = 1'
- >>> out_queue.get(timeout=timeout)
+ >>> out_queue.get(timeout=timeout)
+ 'next_schedule = 1'
+ >>> out_queue.get(timeout=timeout)
'inject_fault'
- >>> out_queue.get(timeout=timeout)
- 'next_schedule = 1'
- >>> out_queue.get(timeout=timeout)
- 'inject_fault'
- >>> out_queue.get(timeout=timeout)
- 'next_schedule = 1'
-
- >>> np.stop()
- >>> out_queue.get(timeout=timeout)
+ >>> out_queue.get(timeout=timeout)
+ 'next_schedule = 1'
+ >>> out_queue.get(timeout=timeout)
+ 'inject_fault'
+ >>> out_queue.get(timeout=timeout)
+ 'next_schedule = 1'
+
+ >>> np.stop()
+ >>> out_queue.get(timeout=timeout)
'extract_fault'
-
- >>> np = NemesisProcess(ExceptionThrowingNemesis(out_queue, schedule=1), initial_sleep=0)
- >>> np.start()
- >>> time.sleep(3)
- >>> np.stop()
+
+ >>> np = NemesisProcess(ExceptionThrowingNemesis(out_queue, schedule=1), initial_sleep=0)
+ >>> np.start()
+ >>> time.sleep(3)
+ >>> np.stop()
"""
diff --git a/ydb/tests/library/nemesis/nemesis_network.py b/ydb/tests/library/nemesis/nemesis_network.py
index 6d136964ac8..b3848e7e15e 100644
--- a/ydb/tests/library/nemesis/nemesis_network.py
+++ b/ydb/tests/library/nemesis/nemesis_network.py
@@ -1,41 +1,41 @@
-# -*- coding: utf-8 -*-
-import random
-
+# -*- coding: utf-8 -*-
+import random
+
from ydb.tests.library.nemesis.nemesis_core import Nemesis
from ydb.tests.library.nemesis.network.client import NetworkClient
-
-
-class NetworkNemesis(Nemesis):
- def __init__(self, cluster, schedule=60, ssh_username=None, max_number_affected_nodes=4, probability=0.5):
- super(NetworkNemesis, self).__init__(schedule)
- self.__cluster = cluster
- self.__ssh_username = ssh_username
- self.__max_number_affected_nodes = max_number_affected_nodes
- self.__probability = probability
- self.__node_ids_to_clients = {
- node_id: NetworkClient(node.host, port=node.ic_port, ssh_username=ssh_username)
- for node_id, node in cluster.nodes.items()
- }
- self.__cur_affected_nodes = 0
-
- def prepare_state(self):
- self.logger.info('Prepare state')
-
- def inject_fault(self):
- self.__cur_affected_nodes += 1
- if self.__cur_affected_nodes > self.__max_number_affected_nodes:
- self.extract_fault()
- return
-
- random_node_client = random.choice(self.__node_ids_to_clients.values())
- self.logger.info('Injecting fault with client = {client}'.format(client=random_node_client))
- random_node_client.isolate_node()
-
- def extract_fault(self):
- self.logger.info('Extracting all faults')
- for node_client in self.__node_ids_to_clients.values():
- node_client.clear_all_drops()
- self.__cur_affected_nodes = 0
+
+
+class NetworkNemesis(Nemesis):
+ def __init__(self, cluster, schedule=60, ssh_username=None, max_number_affected_nodes=4, probability=0.5):
+ super(NetworkNemesis, self).__init__(schedule)
+ self.__cluster = cluster
+ self.__ssh_username = ssh_username
+ self.__max_number_affected_nodes = max_number_affected_nodes
+ self.__probability = probability
+ self.__node_ids_to_clients = {
+ node_id: NetworkClient(node.host, port=node.ic_port, ssh_username=ssh_username)
+ for node_id, node in cluster.nodes.items()
+ }
+ self.__cur_affected_nodes = 0
+
+ def prepare_state(self):
+ self.logger.info('Prepare state')
+
+ def inject_fault(self):
+ self.__cur_affected_nodes += 1
+ if self.__cur_affected_nodes > self.__max_number_affected_nodes:
+ self.extract_fault()
+ return
+
+ random_node_client = random.choice(self.__node_ids_to_clients.values())
+ self.logger.info('Injecting fault with client = {client}'.format(client=random_node_client))
+ random_node_client.isolate_node()
+
+ def extract_fault(self):
+ self.logger.info('Extracting all faults')
+ for node_client in self.__node_ids_to_clients.values():
+ node_client.clear_all_drops()
+ self.__cur_affected_nodes = 0
class DnsNemesis(Nemesis):
diff --git a/ydb/tests/library/nemesis/nemesis_process_killers.py b/ydb/tests/library/nemesis/nemesis_process_killers.py
index 2ec73a7b358..76d1f4f4fa3 100644
--- a/ydb/tests/library/nemesis/nemesis_process_killers.py
+++ b/ydb/tests/library/nemesis/nemesis_process_killers.py
@@ -1,10 +1,10 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import logging
-import random
+import random
from ydb.tests.library.nemesis.nemesis_core import AbstractNemesisNodeTerrorist
from ydb.tests.library.nemesis.remote_execution import execute_command_with_output
-logger = logging.getLogger(__name__)
+logger = logging.getLogger(__name__)
DEFAULT_KILL_ALL_CHANCE = 0.3
@@ -36,7 +36,7 @@ class NemesisProcessKiller(AbstractNemesisNodeTerrorist):
super(NemesisProcessKiller, self).__init__(cluster, act_interval, timeout=timeout,
ssh_user=ssh_user, remote_sudo_user=remote_sudo_user)
self.__victims_procs = processes_affected
- self.__kill_all_chance = kill_everything_chance
+ self.__kill_all_chance = kill_everything_chance
self._signal = signal
self._command_for_victim = kill_cmd if processes_filters is None else kill_pid_cmd
@@ -95,16 +95,16 @@ class NemesisProcessSuspender(NemesisProcessKiller):
kill_everything_chance=DEFAULT_KILL_ALL_CHANCE, processes_filters=None
):
- super(NemesisProcessSuspender, self).__init__(
+ super(NemesisProcessSuspender, self).__init__(
cluster, processes_affected, act_interval, ssh_user, remote_sudo_user,
kill_everything_chance, signal='SIGSTOP', processes_filters=processes_filters
- )
+ )
self.__to_unsuspend = []
def __wake_all_suspended(self):
for node, commands in self.__to_unsuspend:
for command in commands:
- self._remote_exec_method(self._full_command(node, command), timeout=self.timeout)
+ self._remote_exec_method(self._full_command(node, command), timeout=self.timeout)
self.__to_unsuspend = []
def _pre_inject_fault(self, node, commands):
@@ -114,40 +114,40 @@ class NemesisProcessSuspender(NemesisProcessKiller):
def extract_fault(self):
self.__wake_all_suspended()
-
-
+
+
def fake_execute_command(command):
print("{}".format(command))
-class TestNemesisProcessSuspender(NemesisProcessSuspender):
+class TestNemesisProcessSuspender(NemesisProcessSuspender):
_remote_exec_method = fake_execute_command
- """
- >>> random.seed(123)
- >>> n = TestNemesisProcessSuspender(range(8), range(2), 1)
- >>> n.prepare_state()
- >>> n.inject_fault()
+ """
+ >>> random.seed(123)
+ >>> n = TestNemesisProcessSuspender(range(8), range(2), 1)
+ >>> n.prepare_state()
+ >>> n.inject_fault()
['ssh', 0, 'killall', '-s', 'SIGSTOP', '0']
['ssh', 0, 'killall', '-s', 'SIGSTOP', '1']
- >>> n.inject_fault()
+ >>> n.inject_fault()
['ssh', 0, 'killall', '-s', 'SIGCONT', '0']
['ssh', 0, 'killall', '-s', 'SIGCONT', '1']
['ssh', 3, 'killall', '-s', 'SIGSTOP', '0']
['ssh', 3, 'killall', '-s', 'SIGSTOP', '1']
- >>> n.inject_fault()
+ >>> n.inject_fault()
['ssh', 3, 'killall', '-s', 'SIGCONT', '0']
['ssh', 3, 'killall', '-s', 'SIGCONT', '1']
['ssh', 7, 'killall', '-s', 'SIGSTOP', '0']
['ssh', 7, 'killall', '-s', 'SIGSTOP', '1']
- >>> n.inject_fault()
+ >>> n.inject_fault()
['ssh', 7, 'killall', '-s', 'SIGCONT', '0']
['ssh', 7, 'killall', '-s', 'SIGCONT', '1']
['ssh', 4, 'killall', '-s', 'SIGSTOP', '1']
- >>> n.inject_fault()
+ >>> n.inject_fault()
['ssh', 4, 'killall', '-s', 'SIGCONT', '1']
['ssh', 1, 'killall', '-s', 'SIGSTOP', '0']
- >>> n.inject_fault()
+ >>> n.inject_fault()
['ssh', 1, 'killall', '-s', 'SIGCONT', '0']
['ssh', 1, 'killall', '-s', 'SIGSTOP', '0']
['ssh', 1, 'killall', '-s', 'SIGSTOP', '1']
- """
+ """
diff --git a/ydb/tests/library/nemesis/nemesis_time_terrorist.py b/ydb/tests/library/nemesis/nemesis_time_terrorist.py
index 564b721bfba..5330350910d 100644
--- a/ydb/tests/library/nemesis/nemesis_time_terrorist.py
+++ b/ydb/tests/library/nemesis/nemesis_time_terrorist.py
@@ -37,7 +37,7 @@ class NemesisTimeChanger(AbstractNemesisNodeTerrorist):
def __get_curr_time(self, node):
result, output = execute_command_with_output(
- self._full_command(node, self.__get_time_cmd), timeout=self.timeout
+ self._full_command(node, self.__get_time_cmd), timeout=self.timeout
)
if result:
logger.error("Failed to fetch victim process on node {node}. Will not act this time".format(node=node))
diff --git a/ydb/tests/library/nemesis/network/__init__.py b/ydb/tests/library/nemesis/network/__init__.py
index cc096de342e..7029cda876b 100644
--- a/ydb/tests/library/nemesis/network/__init__.py
+++ b/ydb/tests/library/nemesis/network/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-__author__ = '[email protected]'
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+__author__ = '[email protected]'
diff --git a/ydb/tests/library/nemesis/network/client.py b/ydb/tests/library/nemesis/network/client.py
index 784741462c4..73b65882d93 100644
--- a/ydb/tests/library/nemesis/network/client.py
+++ b/ydb/tests/library/nemesis/network/client.py
@@ -1,45 +1,45 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import logging
-
-# noinspection PyUnresolvedReferences
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import logging
+
+# noinspection PyUnresolvedReferences
from ydb.tests.library.nemesis.remote_execution import execute_command_with_output_single_host
-
-__author__ = '[email protected]'
-
-
-logger = logging.getLogger()
-
-
-class NetworkClient(object):
- def __init__(self, host, port=19001, ssh_username=None, ipv6=True):
- super(NetworkClient, self).__init__()
- if ipv6:
- self.__iptables_bin = '/sbin/ip6tables'
- self.__iptables_save_bin = '/sbin/ip6tables-save'
- else:
- self.__iptables_bin = '/sbin/iptables'
- self.__iptables_save_bin = '/sbin/iptables-save'
-
- self.__port = str(port)
- self.__host = host
- self.__ssh_username = ssh_username
-
- def drop_incoming_packets(self, probability=0.01):
- drop_incoming_command = [
- 'sudo', self.__iptables_bin, '-A', 'INPUT', '-p', 'tcp', '--sport', self.__port,
- '-m', 'statistic', '--mode', 'random', '--probability', str(probability), '-j', 'DROP'
- ]
- return self.__exec_command(drop_incoming_command)
-
- def drop_outgoing_packets(self, probability=0.01):
- drop_outgoing_command = [
- 'sudo', self.__iptables_bin, '-A', 'INPUT', '-p', 'tcp', '--dport', self.__port,
- '-m', 'statistic', '--mode', 'random', '--probability', str(probability), '-j', 'DROP'
- ]
- return self.__exec_command(drop_outgoing_command)
-
+
+__author__ = '[email protected]'
+
+
+logger = logging.getLogger()
+
+
+class NetworkClient(object):
+ def __init__(self, host, port=19001, ssh_username=None, ipv6=True):
+ super(NetworkClient, self).__init__()
+ if ipv6:
+ self.__iptables_bin = '/sbin/ip6tables'
+ self.__iptables_save_bin = '/sbin/ip6tables-save'
+ else:
+ self.__iptables_bin = '/sbin/iptables'
+ self.__iptables_save_bin = '/sbin/iptables-save'
+
+ self.__port = str(port)
+ self.__host = host
+ self.__ssh_username = ssh_username
+
+ def drop_incoming_packets(self, probability=0.01):
+ drop_incoming_command = [
+ 'sudo', self.__iptables_bin, '-A', 'INPUT', '-p', 'tcp', '--sport', self.__port,
+ '-m', 'statistic', '--mode', 'random', '--probability', str(probability), '-j', 'DROP'
+ ]
+ return self.__exec_command(drop_incoming_command)
+
+ def drop_outgoing_packets(self, probability=0.01):
+ drop_outgoing_command = [
+ 'sudo', self.__iptables_bin, '-A', 'INPUT', '-p', 'tcp', '--dport', self.__port,
+ '-m', 'statistic', '--mode', 'random', '--probability', str(probability), '-j', 'DROP'
+ ]
+ return self.__exec_command(drop_outgoing_command)
+
def isolate_dns(self, probability=1.0):
drop_input = [
'sudo', self.__iptables_bin, '-A', 'INPUT', '-p', 'udp', '--sport', '53',
@@ -63,41 +63,41 @@ class NetworkClient(object):
return 0
- def isolate_node(self):
- probability = 1.0
- self.drop_incoming_packets(probability)
- self.drop_outgoing_packets(probability)
- return
-
- def clear_all_drops(self):
- """
- $IP6TABLES_SAVE | grep -e statistic -e probability | sed -e "s/-A/-D/g" | while read line; do
- $IP6TABLES $line
- done
- """
- clear_all_drops_command = [
- 'sudo', self.__iptables_save_bin,
- '|', 'grep', '-e', 'statistic', '-e', 'probability',
- '|', 'sed', '-e', '"s/-A/-D/g"',
- '|', 'while', 'read', 'line', ';',
- 'do',
- 'sudo', self.__iptables_bin, '$line', ';',
- 'done'
- ]
- return self.__exec_command(clear_all_drops_command)
-
- def __enter__(self):
- return self
-
- def __exit__(self, exc_type, exc_val, exc_tb):
- self.clear_all_drops()
- return False
-
- def __exec_command(self, command):
- retcode, output = execute_command_with_output_single_host(
- self.__host, command, username=self.__ssh_username
- )
- return retcode
-
- def __str__(self):
- return 'NetworkClient[{host}:{port}]'.format(host=self.__host, port=self.__port)
+ def isolate_node(self):
+ probability = 1.0
+ self.drop_incoming_packets(probability)
+ self.drop_outgoing_packets(probability)
+ return
+
+ def clear_all_drops(self):
+ """
+ $IP6TABLES_SAVE | grep -e statistic -e probability | sed -e "s/-A/-D/g" | while read line; do
+ $IP6TABLES $line
+ done
+ """
+ clear_all_drops_command = [
+ 'sudo', self.__iptables_save_bin,
+ '|', 'grep', '-e', 'statistic', '-e', 'probability',
+ '|', 'sed', '-e', '"s/-A/-D/g"',
+ '|', 'while', 'read', 'line', ';',
+ 'do',
+ 'sudo', self.__iptables_bin, '$line', ';',
+ 'done'
+ ]
+ return self.__exec_command(clear_all_drops_command)
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.clear_all_drops()
+ return False
+
+ def __exec_command(self, command):
+ retcode, output = execute_command_with_output_single_host(
+ self.__host, command, username=self.__ssh_username
+ )
+ return retcode
+
+ def __str__(self):
+ return 'NetworkClient[{host}:{port}]'.format(host=self.__host, port=self.__port)
diff --git a/ydb/tests/library/nemesis/remote_execution.py b/ydb/tests/library/nemesis/remote_execution.py
index b7b5be9c688..aba31e96d05 100644
--- a/ydb/tests/library/nemesis/remote_execution.py
+++ b/ydb/tests/library/nemesis/remote_execution.py
@@ -1,43 +1,43 @@
-# -*- coding: utf-8 -*-
-import time
-import logging
+# -*- coding: utf-8 -*-
+import time
+import logging
import tempfile
import subprocess
from concurrent import futures
-
-
-logger = logging.getLogger(__name__)
-
-
+
+
+logger = logging.getLogger(__name__)
+
+
def execute_command(command, timeout=60):
- logger.info("Running: {}".format(command))
+ logger.info("Running: {}".format(command))
process = subprocess.Popen(command)
wait_timeout(process, timeout)
return process.returncode
-def execute_command_with_output(command, timeout=60):
- logger.info("Running command = {}".format(command))
- list_of_lines = []
+def execute_command_with_output(command, timeout=60):
+ logger.info("Running command = {}".format(command))
+ list_of_lines = []
with tempfile.TemporaryFile() as f_out, tempfile.TemporaryFile() as f_err:
process = subprocess.Popen(command, stdout=f_out, stderr=f_err)
wait_timeout(process, timeout)
- process_return_code = process.returncode
- f_err.flush()
- f_err.seek(0)
- std_err_lines = list(f_err.readlines())
- if process_return_code is not None:
- f_out.flush()
- f_out.seek(0)
- list_of_lines = list(f_out.readlines())
+ process_return_code = process.returncode
+ f_err.flush()
+ f_err.seek(0)
+ std_err_lines = list(f_err.readlines())
+ if process_return_code is not None:
+ f_out.flush()
+ f_out.seek(0)
+ list_of_lines = list(f_out.readlines())
logger.info("Finished execution command = {}".format(command))
- if logger.isEnabledFor(logging.DEBUG):
- logger.debug('Command output = \n{}'.format('\n'.join(list_of_lines)))
- logger.debug('Stderr = \n{}'.format('\n'.join(std_err_lines)))
- return process_return_code, list_of_lines
-
+ if logger.isEnabledFor(logging.DEBUG):
+ logger.debug('Command output = \n{}'.format('\n'.join(list_of_lines)))
+ logger.debug('Stderr = \n{}'.format('\n'.join(std_err_lines)))
+ return process_return_code, list_of_lines
+
def wait_timeout(process, timeout):
start_time = time.time()
while time.time() < start_time + timeout:
@@ -46,15 +46,15 @@ def wait_timeout(process, timeout):
return
time.sleep(0.5)
process.kill()
- process.wait()
-
-
-def execute_command_with_output_on_hosts(list_of_hosts, command, per_host_timeout=60, username=None):
- full_output = []
- full_retcode = 0
+ process.wait()
+
+
+def execute_command_with_output_on_hosts(list_of_hosts, command, per_host_timeout=60, username=None):
+ full_output = []
+ full_retcode = 0
pool = futures.ProcessPoolExecutor(8)
fs = []
- for host in list_of_hosts:
+ for host in list_of_hosts:
fs.append(
pool.submit(
execute_command_with_output_single_host,
@@ -62,19 +62,19 @@ def execute_command_with_output_on_hosts(list_of_hosts, command, per_host_timeou
timeout=per_host_timeout,
username=username
)
- )
+ )
for f in fs:
retcode, output = f.result()
- if retcode:
- full_retcode = retcode
- full_output.extend(output)
- return full_retcode, full_output
-
-
-def execute_command_with_output_single_host(host, command, timeout=60, username=None):
- username_at_host = host if username is None else username + '@' + host
- full_cmd = ["ssh", username_at_host] + command
-
- retcode, output = execute_command_with_output(full_cmd, timeout=timeout)
- return retcode, output
+ if retcode:
+ full_retcode = retcode
+ full_output.extend(output)
+ return full_retcode, full_output
+
+
+def execute_command_with_output_single_host(host, command, timeout=60, username=None):
+ username_at_host = host if username is None else username + '@' + host
+ full_cmd = ["ssh", username_at_host] + command
+
+ retcode, output = execute_command_with_output(full_cmd, timeout=timeout)
+ return retcode, output
diff --git a/ydb/tests/library/nemesis/safety_warden.py b/ydb/tests/library/nemesis/safety_warden.py
index e9d43a0c381..9a982770ac4 100644
--- a/ydb/tests/library/nemesis/safety_warden.py
+++ b/ydb/tests/library/nemesis/safety_warden.py
@@ -1,137 +1,137 @@
# -*- coding: utf-8 -*-
import functools
-import itertools
+import itertools
import logging
from abc import ABCMeta, abstractmethod
from ydb.tests.library.nemesis.remote_execution import execute_command_with_output_on_hosts
-
+
logger = logging.getLogger()
class SafetyWarden(object):
__metaclass__ = ABCMeta
- def __init__(self, name):
- super(SafetyWarden, self).__init__()
- self.__name = name
-
+ def __init__(self, name):
+ super(SafetyWarden, self).__init__()
+ self.__name = name
+
@abstractmethod
def list_of_safety_violations(self):
pass
- @property
+ @property
def name(self):
- return self.__name
-
- def __str__(self):
- return self.name
+ return self.__name
+ def __str__(self):
+ return self.name
+
class AggregateSafetyWarden(SafetyWarden):
def __init__(self, list_of_safety_wardens):
- super(AggregateSafetyWarden, self).__init__('AggregateSafetyWarden')
- self.__list_of_safety_wardens = list(list_of_safety_wardens)
+ super(AggregateSafetyWarden, self).__init__('AggregateSafetyWarden')
+ self.__list_of_safety_wardens = list(list_of_safety_wardens)
def list_of_safety_violations(self):
all_safety_violations = []
- for warden in self.__list_of_safety_wardens:
+ for warden in self.__list_of_safety_wardens:
all_safety_violations.extend(
warden.list_of_safety_violations()
)
return all_safety_violations
-def split_in_chunks(list_of_lines, chunk_size):
- """
+def split_in_chunks(list_of_lines, chunk_size):
+ """
>>> a = list(map(str, range(6)))
- >>> split_in_chunks(a, 3)
- ['0\\n1\\n2', '3\\n4\\n5']
- >>> split_in_chunks(a, 2)
- ['0\\n1', '2\\n3', '4\\n5']
+ >>> split_in_chunks(a, 3)
+ ['0\\n1\\n2', '3\\n4\\n5']
+ >>> split_in_chunks(a, 2)
+ ['0\\n1', '2\\n3', '4\\n5']
>>> a = list(map(str, range(7)))
- >>> split_in_chunks(a, 3)
- ['0\\n1\\n2', '3\\n4\\n5', '6']
- >>> split_in_chunks([], 3)
- []
- >>> split_in_chunks(['a', 'b'], 3)
- ['a\\nb']
- >>> split_in_chunks(['a', 'b'], 1)
- Traceback (most recent call last):
- ...
- AssertionError: chunk_size > 1 is False
+ >>> split_in_chunks(a, 3)
+ ['0\\n1\\n2', '3\\n4\\n5', '6']
+ >>> split_in_chunks([], 3)
+ []
+ >>> split_in_chunks(['a', 'b'], 3)
+ ['a\\nb']
+ >>> split_in_chunks(['a', 'b'], 1)
+ Traceback (most recent call last):
+ ...
+ AssertionError: chunk_size > 1 is False
...
- >>> split_in_chunks(['a', 'b'], 0)
- Traceback (most recent call last):
- ...
- AssertionError: chunk_size > 1 is False
+ >>> split_in_chunks(['a', 'b'], 0)
+ Traceback (most recent call last):
+ ...
+ AssertionError: chunk_size > 1 is False
...
- """
- assert chunk_size > 1, "chunk_size > 1 is False"
-
- it = iter(list_of_lines)
-
- def callee():
- ret = list(itertools.islice(it, 0, chunk_size))
- if ret:
- return ret
- return None
-
- return ['\n'.join(x) for x in iter(callee, None)]
-
-
-def construct_list_of_grep_pattern_arguments(list_of_markers):
- """
- >>> construct_list_of_grep_pattern_arguments(['a', 'b'])
- ['-e', "'a'", '-e', "'b'"]
- """
+ """
+ assert chunk_size > 1, "chunk_size > 1 is False"
+
+ it = iter(list_of_lines)
+
+ def callee():
+ ret = list(itertools.islice(it, 0, chunk_size))
+ if ret:
+ return ret
+ return None
+
+ return ['\n'.join(x) for x in iter(callee, None)]
+
+
+def construct_list_of_grep_pattern_arguments(list_of_markers):
+ """
+ >>> construct_list_of_grep_pattern_arguments(['a', 'b'])
+ ['-e', "'a'", '-e', "'b'"]
+ """
return list(functools.reduce(
- lambda x, y: x + y, [("-e", "'{}'".format(p)) for p in list_of_markers]
- ))
-
-
-class AbstractRemoteCommandExecutionSafetyWarden(SafetyWarden):
-
- def __init__(self, name, list_of_hosts, remote_command, username=None, split_line_size=0):
- super(AbstractRemoteCommandExecutionSafetyWarden, self).__init__(name)
- self.__list_of_hosts = list_of_hosts
- self.__remote_command = remote_command
- self.__username = username
- self.__split_line_size = split_line_size
-
- def list_of_safety_violations(self):
- logger.info(
- "{me} executing on hosts = {hosts}, command = {command}".format(
- me=self, hosts=self.__list_of_hosts, command=self.__remote_command
- )
- )
- ret_code, output = execute_command_with_output_on_hosts(
- self.__list_of_hosts, self.__remote_command, username=self.__username
- )
- if self.__split_line_size > 1:
- output = split_in_chunks(output, self.__split_line_size)
-
- if output:
- return output
- else:
- return []
-
-
-class GrepLogFileForMarkers(AbstractRemoteCommandExecutionSafetyWarden):
+ lambda x, y: x + y, [("-e", "'{}'".format(p)) for p in list_of_markers]
+ ))
+
+
+class AbstractRemoteCommandExecutionSafetyWarden(SafetyWarden):
+
+ def __init__(self, name, list_of_hosts, remote_command, username=None, split_line_size=0):
+ super(AbstractRemoteCommandExecutionSafetyWarden, self).__init__(name)
+ self.__list_of_hosts = list_of_hosts
+ self.__remote_command = remote_command
+ self.__username = username
+ self.__split_line_size = split_line_size
+
+ def list_of_safety_violations(self):
+ logger.info(
+ "{me} executing on hosts = {hosts}, command = {command}".format(
+ me=self, hosts=self.__list_of_hosts, command=self.__remote_command
+ )
+ )
+ ret_code, output = execute_command_with_output_on_hosts(
+ self.__list_of_hosts, self.__remote_command, username=self.__username
+ )
+ if self.__split_line_size > 1:
+ output = split_in_chunks(output, self.__split_line_size)
+
+ if output:
+ return output
+ else:
+ return []
+
+
+class GrepLogFileForMarkers(AbstractRemoteCommandExecutionSafetyWarden):
def __init__(self, targets, log_file_name, list_of_markers, lines_after=10, username=None, only_count=False):
- name = "GrepLogFileForMarkersSafetyWarden for markers = {markers} on targets = {targets}".format(
- markers=list_of_markers, targets=targets
- )
- remote_command = (
- [
- 'grep',
- '-A', str(lines_after),
- ]
- + construct_list_of_grep_pattern_arguments(list_of_markers)
- + [
- log_file_name,
- ]
+ name = "GrepLogFileForMarkersSafetyWarden for markers = {markers} on targets = {targets}".format(
+ markers=list_of_markers, targets=targets
+ )
+ remote_command = (
+ [
+ 'grep',
+ '-A', str(lines_after),
+ ]
+ + construct_list_of_grep_pattern_arguments(list_of_markers)
+ + [
+ log_file_name,
+ ]
)
remote_command.extend(
@@ -149,48 +149,48 @@ class GrepLogFileForMarkers(AbstractRemoteCommandExecutionSafetyWarden):
'|', 'wc', '-l'
]
)
- super(GrepLogFileForMarkers, self).__init__(
- name, targets, remote_command=remote_command, username=username, split_line_size=lines_after
- )
-
-
-class GrepGzippedLogFilesForMarkersSafetyWarden(AbstractRemoteCommandExecutionSafetyWarden):
- def __init__(
- self, list_of_hosts, log_file_pattern, list_of_markers, lines_after=1, username=None,
+ super(GrepLogFileForMarkers, self).__init__(
+ name, targets, remote_command=remote_command, username=username, split_line_size=lines_after
+ )
+
+
+class GrepGzippedLogFilesForMarkersSafetyWarden(AbstractRemoteCommandExecutionSafetyWarden):
+ def __init__(
+ self, list_of_hosts, log_file_pattern, list_of_markers, lines_after=1, username=None,
modification_days=1, only_count=False,
- ):
- name = "GrepGzippedLogFilesForMarkersSafetyWarden for markers = {markers} on targets = {targets}".format(
- markers=list_of_markers, targets=list_of_hosts
- )
-
- if modification_days > 0:
- remote_command = [
- 'find',
- log_file_pattern,
- '-type',
- 'f',
- '-mtime',
- '-{days}'.format(days=modification_days),
- '|',
- 'xargs',
- 'zcat',
- ]
- else:
- remote_command = [
- 'zcat',
- log_file_pattern,
- ]
-
- remote_command.extend([
- '|',
- 'grep',
- '-A', str(lines_after),
- ])
-
- remote_command.extend(
- construct_list_of_grep_pattern_arguments(list_of_markers)
- )
-
+ ):
+ name = "GrepGzippedLogFilesForMarkersSafetyWarden for markers = {markers} on targets = {targets}".format(
+ markers=list_of_markers, targets=list_of_hosts
+ )
+
+ if modification_days > 0:
+ remote_command = [
+ 'find',
+ log_file_pattern,
+ '-type',
+ 'f',
+ '-mtime',
+ '-{days}'.format(days=modification_days),
+ '|',
+ 'xargs',
+ 'zcat',
+ ]
+ else:
+ remote_command = [
+ 'zcat',
+ log_file_pattern,
+ ]
+
+ remote_command.extend([
+ '|',
+ 'grep',
+ '-A', str(lines_after),
+ ])
+
+ remote_command.extend(
+ construct_list_of_grep_pattern_arguments(list_of_markers)
+ )
+
remote_command.extend(
[
'|',
@@ -207,23 +207,23 @@ class GrepGzippedLogFilesForMarkersSafetyWarden(AbstractRemoteCommandExecutionSa
]
)
- super(GrepGzippedLogFilesForMarkersSafetyWarden, self).__init__(
- name, list_of_hosts, remote_command=remote_command, username=username, split_line_size=lines_after
- )
-
-
-class GrepDMesgForPatternsSafetyWarden(AbstractRemoteCommandExecutionSafetyWarden):
- def __init__(self, list_of_hosts, list_of_markers, lines_after=1, username=None):
- name = "GrepDMesgForPatternsSafetyWarden for markers = {markers} on targets = {targets}".format(
- markers=list_of_markers, targets=list_of_hosts
- )
- remote_command = [
- 'dmesg', '-T',
- '|',
- 'grep',
- '-A', str(lines_after),
- ] + construct_list_of_grep_pattern_arguments(list_of_markers)
-
- super(GrepDMesgForPatternsSafetyWarden, self).__init__(
- name, list_of_hosts, remote_command=remote_command, username=username, split_line_size=lines_after
- )
+ super(GrepGzippedLogFilesForMarkersSafetyWarden, self).__init__(
+ name, list_of_hosts, remote_command=remote_command, username=username, split_line_size=lines_after
+ )
+
+
+class GrepDMesgForPatternsSafetyWarden(AbstractRemoteCommandExecutionSafetyWarden):
+ def __init__(self, list_of_hosts, list_of_markers, lines_after=1, username=None):
+ name = "GrepDMesgForPatternsSafetyWarden for markers = {markers} on targets = {targets}".format(
+ markers=list_of_markers, targets=list_of_hosts
+ )
+ remote_command = [
+ 'dmesg', '-T',
+ '|',
+ 'grep',
+ '-A', str(lines_after),
+ ] + construct_list_of_grep_pattern_arguments(list_of_markers)
+
+ super(GrepDMesgForPatternsSafetyWarden, self).__init__(
+ name, list_of_hosts, remote_command=remote_command, username=username, split_line_size=lines_after
+ )