Merge pull request #29164 from azat/test_send_crash_reports-fix

test_send_crash_reports: suppress Fatal messages check (due to explicit SIGSEGV)
This commit is contained in:
alexey-milovidov 2021-09-27 03:54:10 +03:00 committed by GitHub
commit 3609d4adad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,14 @@
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=line-too-long
# pylint: disable=bare-except
import os import os
import time import time
import pytest
import helpers.cluster import helpers.cluster
import helpers.test_tools import helpers.test_tools
import pytest
from . import fake_sentry_server from . import fake_sentry_server
@ -20,7 +25,11 @@ def started_node():
cluster.start() cluster.start()
yield node yield node
finally: finally:
cluster.shutdown() # It will print Fatal message after pkill -SEGV, suppress it
try:
cluster.shutdown()
except:
pass
def test_send_segfault(started_node): def test_send_segfault(started_node):
@ -30,7 +39,7 @@ def test_send_segfault(started_node):
started_node.copy_file_to_container(os.path.join(SCRIPT_DIR, "fake_sentry_server.py"), "/fake_sentry_server.py") started_node.copy_file_to_container(os.path.join(SCRIPT_DIR, "fake_sentry_server.py"), "/fake_sentry_server.py")
started_node.exec_in_container(["bash", "-c", "python3 /fake_sentry_server.py > /fake_sentry_server.log 2>&1"], detach=True, user="root") started_node.exec_in_container(["bash", "-c", "python3 /fake_sentry_server.py > /fake_sentry_server.log 2>&1"], detach=True, user="root")
time.sleep(1) time.sleep(1)
started_node.exec_in_container(["bash", "-c", "pkill -11 clickhouse"], user="root") started_node.exec_in_container(["bash", "-c", "pkill -SEGV clickhouse"], user="root")
result = None result = None
for attempt in range(1, 6): for attempt in range(1, 6):
@ -38,9 +47,9 @@ def test_send_segfault(started_node):
result = started_node.exec_in_container(['cat', fake_sentry_server.RESULT_PATH], user='root') result = started_node.exec_in_container(['cat', fake_sentry_server.RESULT_PATH], user='root')
if result == 'OK': if result == 'OK':
break break
elif result == 'INITIAL_STATE': if result == 'INITIAL_STATE':
continue continue
elif result: if result:
assert False, 'Unexpected state: ' + result assert False, 'Unexpected state: ' + result
assert result == 'OK', 'Crash report not sent' assert result == 'OK', 'Crash report not sent'