Skip to content

Do not hide setup and teardown errors of xfail integration tests - #132827

Merged
fm4v merged 1 commit into
masterfrom
integration-xfail-teardown-errors
Nov 19, 2026
Merged

fm4v merged 1 commit into
masterfrom
integration-xfail-teardown-errors

Conversation

@fm4v

@fm4v fm4v commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

pytest applies an xfail mark to every phase of a test, so an exception in a fixture of such a test is reported as an expected failure, which CI counts as passed. When an xfail test is the last one of its module, the module fixture teardown that raises from ClickHouseCluster.shutdown (a <Fatal>, a LOGICAL_ERROR or a sanitizer report in the server logs) is hidden. Real cases on master:

  • test_storage_paimon_with_spark: test_explicit_structure[azure] and test_primary_key_table[azure], Integration tests (amd_llvm_coverage_per_test, per_test_coverage, 6/8), master 79929b2c (2026-11-15): teardown found Crash in instance 'node1' with Segmentation fault, recorded as OK.
  • test_database_iceberg/test.py::test_soak_delta_lake_insert_and_read: teardown found Logical error: 'The base metadata file is not set...', recorded as OK on master and on Iceberg OPTIMIZE TABLE commits a new snapshot instead of rewriting the table #124114.

This adds a pytest_runtest_makereport wrapper in tests/integration/conftest.py that reports errors in setup and teardown of xfail-marked tests as errors. The mark keeps its meaning in the test body (XFAIL, and XPASS(strict) still fails), and an explicit pytest.xfail call keeps its meaning in every phase. Checked with pytest 9 on a throwaway project; ResultTranslator.from_pytest_jsonl then reports the test as FAIL. Expect the two crashes above to show up in CI now.

Related: #124114

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Workflow [PR]
Sync PR [sync-upstream/pr/132827]

Version info

  • Merged into: 26.11.1.2838-master (included in 26.11 and later)

pytest applies an `xfail` mark to every phase of a test, so an exception in a fixture of such a test is reported as an expected failure, and CI counts it as passed. When an `xfail` test was the last one of its module, the module fixture teardown that raised from `ClickHouseCluster.shutdown` was hidden. This hid a `Segmentation fault` of `node1` in `test_storage_paimon_with_spark` (`test_explicit_structure[azure]`, `test_primary_key_table[azure]`, NightlyCoverage on master `79929b2c`, 2026-11-15) and a `Logical error` in `test_database_iceberg/test.py::test_soak_delta_lake_insert_and_read`.

Add a `pytest_runtest_makereport` wrapper that reports such errors in setup and teardown as errors. The mark keeps its meaning in the test body, and an explicit `pytest.xfail` call keeps its meaning in every phase.
@clickhouse-gh

clickhouse-gh Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b7014f8]

Summary: ❌

job_name test_name status info comment
Integration tests (arm_binary, distributed plan, targeted) FAIL
test_grpc_protocol/test.py::test_ipv6_select_one FAIL cidb IGNORED

AI Review

Summary

The change exposes setup and teardown errors from tests marked xfail, while preserving expected failures in test bodies, strict XPASS, and explicit pytest.xfail calls. No actionable findings at b7014f84860106435454c9c000bbc20fe230caed. Twenty focused cases passed validation with the CI-pinned pytest 9.0.3 and pluggy 1.6.0, both serially and through xdist, including module finalization, JUnit output, JSON report serialization, and ResultTranslator.from_pytest_jsonl.

Final Verdict

✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Nov 18, 2026
@fm4v
fm4v enabled auto-merge November 18, 2026 23:37
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Nov 19, 2026
@fm4v
fm4v added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 78a3837 Nov 19, 2026
194 of 196 checks passed
@fm4v
fm4v deleted the integration-xfail-teardown-errors branch November 19, 2026 12:14
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants