Skip to content

test(frontend): use MockLink catch-all handler to fix Routes.test.tsx timeout#16383

Open
daha wants to merge 4 commits into
datahub-project:masterfrom
daha:fix-frontend-pr-tests
Open

test(frontend): use MockLink catch-all handler to fix Routes.test.tsx timeout#16383
daha wants to merge 4 commits into
datahub-project:masterfrom
daha:fix-frontend-pr-tests

Conversation

@daha
Copy link
Copy Markdown
Contributor

@daha daha commented Feb 27, 2026

Summary

The renders embed page properly test in Routes.test.tsx times out on fork CI runners (2-CPU). The root cause is the cumulative cost of the full <Routes /> component tree rendering, compounded by error-handling and retry logic in components that receive errors from unmatched GraphQL queries. Apollo's MockLink calls observer.error() for any query without a matching mock, and adding mocks one-by-one proved to be a losing game as the component tree fires many queries.

Fix: Create a custom MockLink with a setOnError catch-all handler that returns empty data ({ data: {} }) for any unmatched query instead of erroring. This eliminates the error-handling overhead and makes the test resilient to
future component changes that introduce new queries. Also increases the test timeout to 15s as a safety net for slow runners.

Additionally keeps the manageServiceAccounts: true fix added to the inline GetMe mock in a prior commit, and removes the individual mocks that were added in previous attempts (GetGlobalViewsSettings, GetHomePageSettings,
BatchGetStepStates, GetSearchAcrossLineageCounts) since the catch-all makes them unnecessary.

Checklist

@github-actions
Copy link
Copy Markdown
Contributor

Linear: CAT-1423

@daha daha marked this pull request as draft February 27, 2026 15:30
@github-actions github-actions Bot added product PR or Issue related to the DataHub UI/UX community-contribution PR or Issue raised by member(s) of DataHub Community labels Feb 27, 2026
@daha daha force-pushed the fix-frontend-pr-tests branch from 9442e12 to a4bb560 Compare February 27, 2026 16:07
@daha daha changed the title fix(frontend): add missing GraphQL mocks to fix Routes.test.tsx timeout test(frontend): use MockLink catch-all handler to fix Routes.test.tsx timeout Feb 27, 2026
… timeout

Replace individual GraphQL mocks with a MockLink setOnError catch-all that
returns empty data for unmatched queries instead of erroring. This eliminates
error-handling/retry overhead in the component tree that caused timeouts on
slow CI runners. Also increases the embed test timeout to 15s as a safety net.
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@daha daha marked this pull request as ready for review February 27, 2026 21:10
@github-actions
Copy link
Copy Markdown
Contributor

Linear: CAT-1427

@datahub-cyborg datahub-cyborg Bot added the needs-review Label for PRs that need review from a maintainer. label Feb 27, 2026
@gabe-lyons
Copy link
Copy Markdown
Contributor

thanks for the contribution @daha

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

Your PR has been assigned to gabe for review (CAT-1423).

@maggiehays maggiehays added merge-pending-ci A PR that has passed review and should be merged once CI is green. and removed needs-review Label for PRs that need review from a maintainer. labels Mar 9, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Bundle Report

Bundle size has no change ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution PR or Issue raised by member(s) of DataHub Community merge-pending-ci A PR that has passed review and should be merged once CI is green. product PR or Issue related to the DataHub UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants