Skip to content

SNOW-2912540: mock _connect on v5 so local testing skips UD connection_init - #4326

Draft
sfc-gh-fpawlowski wants to merge 3 commits into
SNOW-2912540-log-batch-mock-patchfrom
SNOW-2912540-mock-ud-connect-hook
Draft

SNOW-2912540: mock _connect on v5 so local testing skips UD connection_init#4326
sfc-gh-fpawlowski wants to merge 3 commits into
SNOW-2912540-log-batch-mock-patchfrom
SNOW-2912540-mock-ud-connect-hook

Conversation

@sfc-gh-fpawlowski

@sfc-gh-fpawlowski sfc-gh-fpawlowski commented Aug 21, 2026

Copy link
Copy Markdown

Summary

MockedSnowflakeConnection (Local Testing's mock connection class) subclasses the real SnowflakeConnection and overrides connect() to a no-op, avoiding a real network connection attempt during local testing sessions.

On v5 (UD), Connection.__init__ calls the private _connect() internally instead of the public connect() the legacy v4 connector called. Since the mock override was only named connect, UD's real _connect() ran unmocked on IS_V5_DRIVER=True, attempting a genuine connection attempt requiring real account credentials — surfacing as an account/credentials error in local-testing sessions that should never touch the network at all.

Fix: on v5, alias _connect = connect so the existing mock override is actually invoked by UD's __init__ path.

Known gap: no dedicated test exercises this specific IS_V5_DRIVER=True code path (unverifiable without a UD wheel installed, same caveat as the rest of this stack). Flagging for reviewer awareness rather than holding up this draft.

Stacked on #4321.

Test plan

  • flake8/black clean
  • Full tests/unit/+tests/mock/ suite passes for v4 (2916 passed) — this branch doesn't change v4 behavior at all
  • No test coverage for the IS_V5_DRIVER=True path itself

🤖 Generated with Claude Code

…n_init

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant