Skip to content

Add Trino e2e testcoverage - #373

Open
Bohreromir wants to merge 11 commits into
mainfrom
worktree-test-345-trino-e2e
Open

Bohreromir wants to merge 11 commits into
mainfrom
worktree-test-345-trino-e2e

Conversation

@Bohreromir

Copy link
Copy Markdown
Member

No description provided.

Unit tests for the query, catalog and completion metadata endpoints:
request validation, connection checks, generated SQL including identifier
and literal escaping, result mapping and error status codes.
Covers sequential script execution and stop conditions, cancellation,
snapshots, tab removal and the TTL-based eviction sweep.
- Count a submit without query ID as failed, so trino_query_total stays
  balanced.
- Don't expose a terminal state straight from the submit response. The
  query previously skipped draining any remaining pages and never got a
  completion time or outcome metric.
…345)

While a script waited for Trino to accept its next statement, the tab had
no active query: cancelling did nothing, and a re-run's results were mixed
with those of the old script, which kept executing.

Track the running script per tab with an AbortController. cancelQuery,
resetTabQueries and a new script abort it; a statement accepted after the
abort is cancelled in Trino instead of stored. Cancellation now updates
state synchronously before calling Trino, so concurrent callers cannot
cancel or count a query twice and a reset cannot wipe a newer script.
Mapping terminal submit states to RUNNING turned a FAILED response
without an error object into a completed query, and the script went on
to the next statement.
collectResults only failed a query when the page carried an error object.
A FAILED state without one was ignored and the query ended as FINISHED.
Opt-in SQL markers make the mock speak Trino's paging protocol: paged
results, running queries held until released, withheld submits, and
FAILED responses without error details. A request log and release
endpoint let E2E tests drive and observe the server deterministically.
Existing fixtures keep their single-response behaviour.
Covers paged results, running state and cancellation, restoring a running
script after reload, failures without error details, and re-running a
script while it is between statements.
Covers the login redirect for unauthenticated requests, the submit/poll/
cleanup cycle, and cancelling a script between statements.
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 56.72% 2797 / 4931
🔵 Statements 61.68% 4038 / 6546
🔵 Functions 68.08% 1071 / 1573
🔵 Branches 48.47% 1479 / 3051
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/lib/server/trino/queries.ts 100% 94.54% 100% 100%
src/lib/server/trino/result-collector.ts 70.21% 67.85% 100% 75% 24, 30-36, 39, 44, 80, 93-95
Generated in workflow #1059 for commit 5fa5a20 by the Vitest Coverage Report Action

@Bohreromir Bohreromir changed the title Add Trino testcoverage Add Trino e2e testcoverage Oct 8, 2026
@Bohreromir Bohreromir linked an issue Oct 9, 2026 that may be closed by this pull request
@Bohreromir
Bohreromir force-pushed the worktree-test-345-trino-e2e branch from d7a3c1c to 5fa5a20 Compare October 9, 2026 10:46
@Bohreromir
Bohreromir marked this pull request as ready for review October 9, 2026 11:01
@Bohreromir Bohreromir self-assigned this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: Waiting for Review

Development

Successfully merging this pull request may close these issues.

Improve Trino (api) testcoverage

1 participant