Skip to content

fix(tests): profile in setUpClass so test_list_entity_profiles has data - #31882

Merged
Khairajani merged 2 commits into
mainfrom
fix/profiler-test-ordering-entity-profiles
Aug 21, 2026
Merged

fix(tests): profile in setUpClass so test_list_entity_profiles has data#31882
Khairajani merged 2 commits into
mainfrom
fix/profiler-test-ordering-entity-profiles

Conversation

@Khairajani

@Khairajani Khairajani commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Fixes the py-tests / py-tests-postgres shard-2 failure that is currently blocking the merge queue for every PR that touches ingestion.

FAILED tests/integration/profiler/test_sqa_profiler.py::TestSQAProfiler::test_list_entity_profiles
>       self.assertGreater(len(profiles_table.entities), 0)
E       AssertionError: 0 not greater than 0

Root cause

test_list_entity_profiles runs first in its class — before the two tests that create the profiles it asserts on. pytest orders unittest.TestCase methods alphabetically (l < p), and the module-level TestLoader.sortTestMethodsUsing = None intended to force definition order only affects unittest’s own loader; pytest collects TestCase methods itself and ignores it.

Verified against an unmodified checkout — with that line present, collection still yields:

TestSQAProfiler::test_list_entity_profiles          <-- runs first
TestSQAProfiler::test_profiler_workflow
TestSQAProfiler::test_profiler_workflow_w_globale_config

The CI artifacts agree: the junit XML records test_list_entity_profiles executing first, with the other two passing afterwards.

Why it passed until 2026-08-20

The test asserts on a global 24-hour window across every table rather than on data it owns. Hard-deleted tables used to leak their profiler rows into that window, so unrelated tests earlier in the shard left behind enough data to satisfy it.

#31556 fixed that leak (issue #27041). The server log from a failing run shows the new purge doing exactly its job:

INFO o.o.s.j.TableRepository - Purged 10 profiler row(s) for hard-deleted table
     docker_test_mssql_2b436f53_mssql_pytds.AdventureWorksLT2022.dbo.ErrorLog

26 such purges in a single run. With the leak gone, the window is genuinely empty when the listing test runs, and a test that was always logically broken finally started reporting it. #31556 is correct and should not be reverted.

Why it looked branch-specific

PRs that do not touch ingestion skip the integration matrix entirely and report green. Across ~40 recent py-tests-postgres runs, every "pass" had python / Integration Tests skipped, and every run that actually executed it failed. So the queue looks healthy while rejecting all ingestion PRs — currently fix/expat-cve-2026-72522, fix/airflow-3.3.1-cve, taipei, pr-31761 and ayush-shah/ingestion-source-config-type.

The change

  • Run the profiler in setUpClass via a new run_profiler_workflows() helper, so profiles are class fixture data and no test depends on another’s ordering. This also removes one redundant profiler run.
  • Extract list_profiled_tables(), which was duplicated across both workflow tests.
  • Drop the ineffective TestLoader.sortTestMethodsUsing hack rather than leave code that looks like it controls ordering.
  • Turn if profiles_all.entities: into an assertion. That guard swallowed an empty unfiltered listing and hid which of the two calls was empty — the one signal needed to diagnose this.

test_profiler_workflow_w_globale_config still re-profiles itself, since it must run after changing the global metric settings.

Verification

  • ruff check clean, ruff format clean.
  • Collection order confirmed before and after.
  • The endpoint itself was verified healthy against a server running this same code (/v1/entity/profiles/table returned 6 table + 37 column profiles), confirming the API is fine and the defect is purely test ordering.

Full integration run is on CI — it needs Docker testcontainers plus a live server.

Greptile Summary

Moves the initial profiler execution into class setup so profile-listing tests have deterministic fixture data regardless of test order.

  • Extracts reusable profiler execution and profiled-table listing helpers.
  • Keeps the global-settings test’s explicit re-profiling step.
  • Replaces the conditional unfiltered-profile check with a required non-empty assertion.
  • Removes the ineffective unittest loader-order override.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
ingestion/tests/integration/profiler/test_sqa_profiler.py Establishes profile data during class setup and consolidates duplicated profiler-test helpers without an eligible follow-up defect.

Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/profiler-te..." | Re-trigger Greptile

pytest orders unittest TestCase methods alphabetically, so
test_list_entity_profiles runs first -- before test_profiler_workflow has
created any profile. The module sets TestLoader.sortTestMethodsUsing = None
to force definition order, but that only affects unittest's own loader:
pytest collects TestCase methods itself and ignores it. Verified against an
unmodified checkout -- collection still yields list_entity_profiles first
with that line in place, so it has never had any effect here.

The test still passed, because it asserts on a global 24h window across
every table rather than on data it owns, and hard-deleted tables used to
leak their profiler rows into that window. #31556 stopped that leak (issue
#27041), and the latent ordering bug surfaced: shard-2 now fails with
"0 not greater than 0" on every PR that actually runs the ingestion
integration matrix, blocking the merge queue. PRs that do not touch
ingestion skip the matrix and report green, which is why this looked
branch-specific rather than repo-wide.

Run the profiler in setUpClass, where fixture data belongs, so no test
depends on another's ordering. Drop the ineffective loader hack, and turn
the `if profiles_all.entities:` guard into an assertion -- that guard
swallowed an empty unfiltered listing and hid which of the two calls was
actually empty, which is the signal needed to diagnose this.
@Khairajani
Khairajani requested a review from a team as a code owner August 21, 2026 10:51
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@Khairajani Khairajani added safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Aug 21, 2026
@Khairajani
Khairajani enabled auto-merge August 21, 2026 11:10
@Khairajani Khairajani added safe to test Add this label to run secure Github workflows on PRs and removed safe to test Add this label to run secure Github workflows on PRs labels Aug 21, 2026
@gitar-bot

gitar-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Moves profiler workflow execution to setUpClass in TestSQAProfiler to ensure entity profiles exist before test execution, fixing test ordering dependencies. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit f2eea00777537d12dd14e12308b34dc31bf6ed75 in Playwright run 32476818531, attempt 1.

✅ 110 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 26m 40s

⏱️ Max setup 4m 43s · max shard execution 10m 29s · max shard-job elapsed before upload 16m 17s · reporting 4s

🌐 216.15 requests/attempt · 1.79 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 216.15 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 1.79 per UI scenario (216 boots / 121 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 46 0 0 0 0 0
✅ Shard ingestion-01 34 0 0 0 0 0
✅ Shard ingestion-02 30 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@sonarqubecloud

Copy link
Copy Markdown

@Khairajani
Khairajani added this pull request to the merge queue Aug 21, 2026
Merged via the queue into main with commit 681644d Aug 21, 2026
101 checks passed
@Khairajani
Khairajani deleted the fix/profiler-test-ordering-entity-profiles branch August 21, 2026 13:05
harsh-vador added a commit that referenced this pull request Aug 21, 2026
* fix(tests): profile in setUpClass so test_list_entity_profiles has data (#31882)

pytest orders unittest TestCase methods alphabetically, so
test_list_entity_profiles runs first -- before test_profiler_workflow has
created any profile. The module sets TestLoader.sortTestMethodsUsing = None
to force definition order, but that only affects unittest's own loader:
pytest collects TestCase methods itself and ignores it. Verified against an
unmodified checkout -- collection still yields list_entity_profiles first
with that line in place, so it has never had any effect here.

The test still passed, because it asserts on a global 24h window across
every table rather than on data it owns, and hard-deleted tables used to
leak their profiler rows into that window. #31556 stopped that leak (issue
#27041), and the latent ordering bug surfaced: shard-2 now fails with
"0 not greater than 0" on every PR that actually runs the ingestion
integration matrix, blocking the merge queue. PRs that do not touch
ingestion skip the matrix and report green, which is why this looked
branch-specific rather than repo-wide.

Run the profiler in setUpClass, where fixture data belongs, so no test
depends on another's ordering. Drop the ineffective loader hack, and turn
the `if profiles_all.entities:` guard into an assertion -- that guard
swallowed an empty unfiltered listing and hid which of the two calls was
actually empty, which is the signal needed to diagnose this.

* fix(ui): make whole Domain and Data Product rows clickable (#31876)

* fix(ui): make whole Domain and Data Product rows clickable

* addressed comments

* Added unit test for the fix

* test(playwright): fix five AUT nightly flakes at their cause

Collate's AUT nightly run 32476747983 retried 25 tests on each database
lane. Fourteen of the distinct specs live here. These five have a cause
the artifacts explain; the rest are listed below rather than guessed at.

Lineage node clicks (LineageInteraction, both lanes)
  clickLineageNode clicked the node the moment the caller's getLineage
  wait returned. React Flow mounts nodes in its own layout pass after
  that, so the click auto-waited with no timeout of its own and the
  spec died as a bare "Test timeout of 60000ms exceeded" naming
  nothing. Assert the node is visible first.

Ingestion wizard Next (ServiceIngestion)
  Creating the service triggers AutoPilot, whose toast renders
  bottom-center — over the wizard footer. The trace shows the click on
  next-button intercepted by the toast's own alert-message span, then
  auto-waiting until the test timed out. Wait for that toast to dismiss
  before advancing.

Knowledge Center owner chip (ExplorePageRightPanel_KnowledgeCenter,
both lanes)
  The Explore summary panel renders owners from the search document,
  refreshed asynchronously after the owner PATCH. A panel that rendered
  before the refresh will never show the chip, so the 60s wait was
  waiting on the wrong thing. Re-open the entity until it is there.

Glossary hierarchy modal (GlossaryHierarchy)
  getByLabel('Select Parent') is page-scoped and also matches the
  control of a hierarchy modal an earlier step left in the DOM; the
  click then spent the whole test on a hidden element. Scope it to the
  modal and check it is visible and enabled first.

Language switch (Glossary — Dutch)
  The menuitem click ran against an ant-dropdown mid-enter-animation,
  which is exactly what waitForAntdPopupToSettle exists for. Use it on
  both switches.

Not addressed here, for lack of evidence rather than lack of interest:
AdvancedSearchSuggestions, SearchSettings, ContextCenterArticles,
ContextCenterMemories, ServiceEntity, GlossaryP2Tests and
SSOConfiguration all failed as bare 60s timeouts with no anchor and
passed on retry in seconds. Marking them slow would hide a regression
just as easily as fix a flake, so they need a trace first.
PlatformLineage and DataProductRename are already fixed on main by
#31736.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* test(playwright): bound the wizard Next click instead of waiting the toast out

Review point: waiting for the AutoPilot toast to detach is a no-op when
the toast has not rendered yet, so a toast that appears a moment later
still intercepts the click.

Correct, and waiting for it to appear first is not the answer either —
the toast is fired by the create call several steps earlier and
auto-closes after 5s (showSuccessToast(..., 5000) in AddServicePage), so
by the time this line runs it may equally have already closed. Any gate
on its presence is wrong for one of the two orderings.

Bound the click instead. Playwright retries an intercepted click for the
whole action timeout, and 30s outlasts the toast in every ordering: not
yet rendered, on screen now, or already gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Himanshu Khairajani <46777429+Khairajani@users.noreply.github.com>
Co-authored-by: Anujkumar Yadav <anujf0510@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants