Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Unisikhin committed Dec 5, 2024
1 parent 164054b commit 39702c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ export DEB_BUILD_DISTRIBUTION ?=


define ensure_poetry
if [ ! -e $(POETRY) ]; then
echo "Poetry could not be found. Please install it manually 'make install-poetry'";
exit 1;
if [ ! -e $(POETRY) ]; then \
echo "Poetry could not be found. Please install it manually 'make install-poetry'"; \
exit 1; \
fi
endef

Expand Down Expand Up @@ -203,9 +203,9 @@ test-unit: install-deps

.PHONY: test-integration
test-integration: install-deps build-python-packages
cd $(TESTS_DIR)
export PYTHONPATH=$(CURDIR):$$PATH
$(POETRY) run behave --show-timings --stop --junit $(BEHAVE_ARGS)
cd $(TESTS_DIR) && \
export PYTHONPATH=$(CURDIR):$$PATH && \
$(POETRY) run behave --show-timings --stop --junit $(BEHAVE_ARGS) -i monrun.feature


.PHONY: publish
Expand Down
4 changes: 2 additions & 2 deletions ch_tools/monrun_checks/ch_orphaned_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ch_tools.chadmin.internal.zookeeper import get_zk_node
from ch_tools.common.result import CRIT, OK, WARNING, Result

ERROR_MESSAGE_PATTERN = r"(Code:\s\d+\.\sDB::Exception:\s).*(\s\([A-Z_]*\)\s\(version\s.*\s\(official build\)\)).*"
ERROR_MESSAGE_PATTERN = r"(Code:\s\d+\.\sDB::Exception:\s)(.*)(\s\([A-Z_]*\)\s\(version\s.*\s\(official build\)\))(.*)"


@click.command("orphaned-objects")
Expand Down Expand Up @@ -107,5 +107,5 @@ def _zk_get_orphaned_objects_state(


def _error_message_format(error_msg: str) -> str:
error_msg = re.sub(ERROR_MESSAGE_PATTERN, r"\1...\2", error_msg)
error_msg = re.sub(ERROR_MESSAGE_PATTERN, r"\1...\3...", error_msg)
return error_msg
4 changes: 2 additions & 2 deletions tests/features/monrun.feature
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,12 @@ Feature: ch-monitoring tool
"""

Scenario: Check clickhouse orphaned objects with long error_msg
When we create file /tmp/object_storage_cleanup_state.json with data "{ \"orphaned_objects_size\": 0, \"error_msg\": \"Code: 27. DB::Exception: Cannot parse: input:: expected '\\t' before: 'klg%2D1acvr8hmq0n16qm5%2Edb%2Eyandex%2Enet\\ndefault\\n6736d483-516a-4892-87d4-084d5c1f6d3c\\n': While executing SystemRemoteDataPaths. (CANNOT_PARSE_INPUT_ASSERTION_FAILED) (version 24.8.5.115 (official build)) Query: SELECT obj_path, obj_size FROM _system.listing_objects_from_object_storage AS object_storage LEFT ANTI JOIN remoteSecure('klg-1acvr8hmq0n16qm5.db.yandex.net', system.remote_data_paths) AS object_table ON object_table.remote_path = object_storage.obj_path AND object_table.disk_name = 'object_storage' SETTINGS traverse_shadow_remote_data_paths=1 FORMAT TabSeparated (klg-1acvr8hmq0n16qm5.mdb.yandex.net)\" }"
When we create file /tmp/object_storage_cleanup_state.json with data "{ \"orphaned_objects_size\": 0, \"error_msg\": \"Code: 27. DB::Exception: Cannot parse: input:: expected '\\\\t' before: 'klg%2D1acvr8hmq0n16qm5%2Edb%2Eyandex%2Enet\\\\ndefault\\\\n6736d483-516a-4892-87d4-084d5c1f6d3c\\\\n': While executing SystemRemoteDataPaths. (CANNOT_PARSE_INPUT_ASSERTION_FAILED) (version 24.8.5.115 (official build)) Query: SELECT obj_path, obj_size FROM _system.listing_objects_from_object_storage AS object_storage LEFT ANTI JOIN remoteSecure('klg-1acvr8hmq0n16qm5.db.yandex.net', system.remote_data_paths) AS object_table ON object_table.remote_path = object_storage.obj_path AND object_table.disk_name = 'object_storage' SETTINGS traverse_shadow_remote_data_paths=1 FORMAT TabSeparated (klg-1acvr8hmq0n16qm5.mdb.yandex.net)\" }"
And we execute command on clickhouse01
"""
ch-monitoring orphaned-objects --state-local
"""
Then we get response
"""
2;Code: 27. DB::Exception: ... (CANNOT_PARSE_INPUT_ASSERTION_FAILED) (version 24.8.5.115 (official build))
2;Code: 27. DB::Exception: ... (CANNOT_PARSE_INPUT_ASSERTION_FAILED) (version 24.8.5.115 (official build)) ...
"""

0 comments on commit 39702c4

Please sign in to comment.