Skip to content

test(e2e): retry the dbconnect pip fallback through transient Windows file locks - #2120

Merged
rugpanov merged 2 commits into
mainfrom
fix/e2e-dbconnect-pip-retry
Aug 14, 2026
Merged

test(e2e): retry the dbconnect pip fallback through transient Windows file locks#2120
rugpanov merged 2 commits into
mainfrom
fix/e2e-dbconnect-pip-retry

Conversation

@rugpanov

Copy link
Copy Markdown
Contributor

Why

The run_dbconnect e2e test's should setup virtual environment step flakes on the Windows shard. When the extension's install path leaves databricks-connect missing, the test's own ensureVenvHasDbConnect fallback runs pip install databricks-connect. While pip overwrites the venv's existing numpy it can hit:

ERROR: Could not install packages due to an OSError: [WinError 32]
The process cannot access the file because it is being used by another process:
'...\.venv\Lib\site-packages\numpy\_core\_add_newdocs_scalars.py'

— a transient lock (a scanner or a still-running install holding the file open). The fallback swallowed that error and moved on, so databricks-connect stayed missing and the downstream "Databricks Connect:" tree-item check timed out with Setup confirmation failed. ensureVenvHasKernelDeps had the same single-shot-then-swallow shape.

What

  • src/test/retry.ts — a pure retryOnTransientError helper plus an isTransientFileLockError predicate (matches WinError 32 "used by another process" and WinError 5 "Access is denied", searching .message / .stderr / .stdout since Node's execFile hides the OSError in stderr). It lives under src/test/ rather than src/test/e2e/tsconfig.json excludes the e2e folder from the unit build, so a colocated unit test only runs when the module sits outside it; the e2e spec imports it via an explicit .ts extension (as e2e specs already do for src/ modules).
  • src/test/retry.test.ts — unit coverage: success without sleeping, retry-then-succeed, linear backoff, give-up-after-N, non-transient-rethrow, onRetry reporting, and the predicate's positive/negative cases.
  • run_dbconnect.ucws.e2e.ts — both fallback pip installs now run through the helper (3 attempts, 5s linear backoff), logging each retry so a real Windows UX regression stays visible in nightly logs. The final swallow+log and the ground-truth tree-item assertion are unchanged.

Test-only: no production code, settings, persisted state, telemetry, or when-clause flags — zero user-facing impact and nothing changes for shards that never hit the lock.

Verification

  • retry.test.ts: 9 passing (written red-first, then green).
  • Full unit suite (test:unit): 818 passing, 0 failing (10 pre-existing pending).
  • e2e file type-checks under src/test/e2e/tsconfig.json (the only error is a pre-existing assert {type: "json"} in wdio.conf.ts, untouched here).
  • eslint + prettier -c clean on all touched files.

This pull request and its description were written by Isaac.

@rugpanov
rugpanov deployed to test-trigger-is August 14, 2026 13:52 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 14, 2026 13:52 — with GitHub Actions Active
@rugpanov
rugpanov force-pushed the fix/e2e-dbconnect-pip-retry branch from 0a47701 to 3d6176c Compare August 14, 2026 13:57
@rugpanov
rugpanov deployed to test-trigger-is August 14, 2026 13:57 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 14, 2026 13:57 — with GitHub Actions Active
@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for 3d6176cd — ⏳ running.
View run

… file locks

*Why*

The `run_dbconnect` e2e test's `should setup virtual environment` step flakes
on the Windows shard. When the extension's install path leaves
databricks-connect missing, the test's own `ensureVenvHasDbConnect` fallback
runs `pip install databricks-connect`. While pip overwrites the venv's existing
numpy it can hit `[WinError 32] The process cannot access the file because it is
being used by another process` on a numpy file — a transient lock (a scanner or
a still-running install holding it open). The fallback swallowed that error and
moved on, so databricks-connect stayed missing and the downstream
"Databricks Connect:" tree-item check timed out with "Setup confirmation
failed". `ensureVenvHasKernelDeps` had the same single-shot-then-swallow shape.

*What*

- Add `src/test/retry.ts` — a pure `retryOnTransientError` helper plus an
  `isTransientFileLockError` predicate (matches WinError 32 "used by another
  process" and WinError 5 "Access is denied", searching `.message`/`.stderr`/
  `.stdout` since Node's execFile hides the OSError in stderr). Lives under
  `src/test/` (not `src/test/e2e/`, which tsconfig excludes from the unit
  build) so it can carry a colocated unit test; e2e imports it via `.ts`.
- Add `src/test/retry.test.ts` — unit coverage for success, retry-then-succeed,
  linear backoff, give-up-after-N, non-transient-rethrow, and the predicate.
- Wrap both fallback pip installs in `run_dbconnect.ucws.e2e.ts` with the
  helper (3 attempts, 5s linear backoff), logging each retry so a real Windows
  UX regression stays visible in nightly logs. The final swallow+log and the
  ground-truth tree-item assertion are unchanged.

Test-only: no production code, settings, persisted state, telemetry, or
when-clause flags — zero user-facing impact.

*Verification*

- `retry.test.ts`: 9 passing (ts-mocha, written red-first then green).
- e2e file type-checks under `src/test/e2e/tsconfig.json` (the sole error is a
  pre-existing `assert {type: "json"}` in `wdio.conf.ts`, untouched here).
- `yarn build` compiles both new files into `out/` so the unit-suite glob
  picks up the test; eslint + `prettier -c` clean on all touched files.

Co-authored-by: Isaac
@rugpanov
rugpanov force-pushed the fix/e2e-dbconnect-pip-retry branch from 3d6176c to 68a6a75 Compare August 14, 2026 14:04
@rugpanov
rugpanov deployed to test-trigger-is August 14, 2026 14:04 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 14, 2026 14:05 — with GitHub Actions Active
@rugpanov

rugpanov commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ❌ 1 of 35 test jobs failed for 68a6a757 (34 passed).
View run

@rugpanov
rugpanov enabled auto-merge (squash) August 14, 2026 16:34
@rugpanov
rugpanov deployed to test-trigger-is August 14, 2026 16:34 — with GitHub Actions Active
@rugpanov
rugpanov merged commit 593e81c into main Aug 14, 2026
6 checks passed
@rugpanov
rugpanov deployed to test-trigger-is August 14, 2026 16:34 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/vscode

Inputs:

  • PR number: 2120
  • Commit SHA: 50f9fd97eab5c55571fa6ea5bc833ee6f26dfe49

Checks will be approved automatically on success.

@rugpanov
rugpanov deleted the fix/e2e-dbconnect-pip-retry branch August 14, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants