|
13 | 13 | temp_dir = f"{Utils.cwd()}/ci/tmp/" |
14 | 14 |
|
15 | 15 | MIN_TOTAL_TESTS = 5_939_581 |
16 | | -MAX_FAILED_TESTS = 201_707 |
| 16 | +MAX_FAILED_TESTS = 173_986 |
17 | 17 |
|
18 | 18 |
|
19 | 19 | # Reuse the same ClickHouseBinary helper from sqltest_job.py |
@@ -105,10 +105,15 @@ def load_stage_reports(out_dir, mode_name): |
105 | 105 | return reports |
106 | 106 |
|
107 | 107 |
|
| 108 | +MAX_EXAMPLES_PER_CATEGORY = 5 |
| 109 | + |
| 110 | + |
108 | 111 | def classify_failures(report): |
109 | 112 | """Classify failed requests from a stage report by reason category. |
110 | | - Returns sorted list of (count, category) tuples, descending by count.""" |
| 113 | + Returns sorted list of (count, category, examples) tuples, descending by count. |
| 114 | + Each example is a query string (up to MAX_EXAMPLES_PER_CATEGORY per category).""" |
111 | 115 | categories = {} |
| 116 | + examples = {} |
112 | 117 | code_re = re.compile(r"Code: (\d+)") |
113 | 118 |
|
114 | 119 | for test_data in report.get("tests", {}).values(): |
@@ -140,7 +145,17 @@ def classify_failures(report): |
140 | 145 |
|
141 | 146 | categories[cat] = categories.get(cat, 0) + 1 |
142 | 147 |
|
143 | | - return sorted(categories.items(), key=lambda x: -x[1]) |
| 148 | + if cat not in examples: |
| 149 | + examples[cat] = [] |
| 150 | + if len(examples[cat]) < MAX_EXAMPLES_PER_CATEGORY: |
| 151 | + query = req.get("request", "") |
| 152 | + if query: |
| 153 | + examples[cat].append(query) |
| 154 | + |
| 155 | + return sorted( |
| 156 | + [(count, cat, examples.get(cat, [])) for cat, count in categories.items()], |
| 157 | + key=lambda x: -x[0], |
| 158 | + ) |
144 | 159 |
|
145 | 160 |
|
146 | 161 | def check_thresholds(complete_test_reports): |
@@ -250,12 +265,22 @@ def color_tag(ratio): |
250 | 265 | classified = classify_failures(report) |
251 | 266 | if classified: |
252 | 267 | f.write(f" Failure categories:\n") |
253 | | - for cat, count in classified: |
| 268 | + for count, cat, cat_examples in classified: |
254 | 269 | pct = 100.0 * count / fail if fail else 0 |
255 | 270 | f.write( |
256 | 271 | f" <b style='color: red;'>{count:>9,}</b>" |
257 | 272 | f" {pct:5.1f}% {html.escape(cat)}\n" |
258 | 273 | ) |
| 274 | + for example in cat_examples: |
| 275 | + truncated = example[:200] |
| 276 | + if len(example) > 200: |
| 277 | + truncated += "..." |
| 278 | + # Collapse multi-line queries to single line |
| 279 | + truncated = truncated.replace("\n", " ") |
| 280 | + f.write( |
| 281 | + f" <span style='color: gray;'>" |
| 282 | + f"{html.escape(truncated)}</span>\n" |
| 283 | + ) |
259 | 284 |
|
260 | 285 | f.write("\n") |
261 | 286 |
|
|
0 commit comments