SNOW-2912540: mock _connect on v5 so local testing skips UD connection_init - #4326
Draft
sfc-gh-fpawlowski wants to merge 3 commits into
Draft
SNOW-2912540: mock _connect on v5 so local testing skips UD connection_init#4326sfc-gh-fpawlowski wants to merge 3 commits into
sfc-gh-fpawlowski wants to merge 3 commits into
Conversation
…n_init Co-authored-by: Cursor <cursoragent@cursor.com>
Author
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
MockedSnowflakeConnection(Local Testing's mock connection class) subclasses the realSnowflakeConnectionand overridesconnect()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 publicconnect()the legacy v4 connector called. Since the mock override was only namedconnect, UD's real_connect()ran unmocked onIS_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 = connectso the existing mock override is actually invoked by UD's__init__path.Known gap: no dedicated test exercises this specific
IS_V5_DRIVER=Truecode 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/blackcleantests/unit/+tests/mock/suite passes for v4 (2916 passed) — this branch doesn't change v4 behavior at allIS_V5_DRIVER=Truepath itself🤖 Generated with Claude Code