Merge pull request #63130 from Algunenano/coverage_test

Try to fix coverage tests
This commit is contained in:
Raúl Marín 2024-05-02 09:34:57 +00:00 committed by GitHub
commit 7e06b01e15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 11 deletions

View File

@ -734,9 +734,9 @@ def get_localzone():
class SettingsRandomizer:
settings = {
"max_insert_threads": lambda: 0
if random.random() < 0.5
else random.randint(1, 16),
"max_insert_threads": lambda: (
0 if random.random() < 0.5 else random.randint(1, 16)
),
"group_by_two_level_threshold": threshold_generator(0.2, 0.2, 1, 1000000),
"group_by_two_level_threshold_bytes": threshold_generator(
0.2, 0.2, 1, 50000000
@ -1470,11 +1470,14 @@ class TestCase:
args.collect_per_test_coverage
and BuildFlags.SANITIZE_COVERAGE in args.build_flags
):
clickhouse_execute(
args,
f"INSERT INTO system.coverage_log SELECT now(), '{self.case}', coverageCurrent()",
retry_error_codes=True,
)
try:
clickhouse_execute(
args,
f"INSERT INTO system.coverage_log SELECT now(), '{self.case}', coverageCurrent()",
retry_error_codes=True,
)
except Exception as e:
print("Cannot insert coverage data: ", str(e))
# Check for dumped coverage files
file_pattern = "coverage.*"
@ -1484,7 +1487,9 @@ class TestCase:
body = read_file_as_binary_string(file_path)
clickhouse_execute(
args,
f"INSERT INTO system.coverage_log SELECT now(), '{self.case}', groupArray(data) FROM input('data UInt64') FORMAT RowBinary",
"INSERT INTO system.coverage_log "
"SETTINGS async_insert=1, wait_for_async_insert=0, async_insert_busy_timeout_min_ms=200, async_insert_busy_timeout_max_ms=1000 "
f"SELECT now(), '{self.case}', groupArray(data) FROM input('data UInt64') FORMAT RowBinary",
body=body,
retry_error_codes=True,
)
@ -1493,6 +1498,8 @@ class TestCase:
# Remove the file even in case of exception to avoid accumulation and quadratic complexity.
os.remove(file_path)
_ = clickhouse_execute(args, "SYSTEM FLUSH ASYNC INSERT QUEUE")
coverage = clickhouse_execute(
args,
"SELECT length(coverageCurrent())",

View File

@ -1,4 +1,4 @@
SYSTEM FLUSH LOGS;
SELECT 'Column ' || name || ' from table ' || concat(database, '.', table) || ' should have a comment'
FROM system.columns
WHERE (database = 'system') AND (comment = '') AND (table NOT ILIKE '%_log_%') AND (table NOT IN ('numbers', 'numbers_mt', 'one', 'generate_series', 'generateSeries')) AND (default_kind != 'ALIAS');
WHERE (database = 'system') AND (comment = '') AND (table NOT ILIKE '%_log_%') AND (table NOT IN ('numbers', 'numbers_mt', 'one', 'generate_series', 'generateSeries', 'coverage_log')) AND (default_kind != 'ALIAS');

View File

@ -2,7 +2,7 @@ SYSTEM FLUSH LOGS;
-- Check for system tables which have non-default sorting key
WITH
['asynchronous_metric_log', 'asynchronous_insert_log', 'opentelemetry_span_log'] AS known_tables,
['asynchronous_metric_log', 'asynchronous_insert_log', 'opentelemetry_span_log', 'coverage_log'] AS known_tables,
'event_date, event_time' as default_sorting_key
SELECT
'Table ' || name || ' has non-default sorting key: ' || sorting_key