Skip to content

Commit 619a286

Browse files
committed
SNOW-2306184: config refactor - allow empty connections test fix
1 parent 653b571 commit 619a286

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

tests/config_ng/test_connection_replacement.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,11 @@ def test_multiple_connections_independent_replacement(config_ng_setup):
320320
def test_empty_connection_replacement(config_ng_setup):
321321
"""
322322
Test that an empty connection in a later FILE source still replaces
323-
the entire connection from earlier sources, resulting in no configured connection.
323+
the entire connection from earlier sources.
324+
325+
The empty connection is considered valid (it exists in config), but has
326+
no parameters. Validation of required fields happens when actually using
327+
the connection to connect to Snowflake.
324328
"""
325329
cli_config = """
326330
[connections.test]
@@ -335,15 +339,16 @@ def test_empty_connection_replacement(config_ng_setup):
335339
"""
336340

337341
with config_ng_setup(cli_config=cli_config, connections_toml=connections_toml):
338-
import pytest
339342
from snowflake.cli.api.config import get_connection_dict
340-
from snowflake.cli.api.exceptions import MissingConfigurationError
341343

342-
# Empty connection replacement means no parameters, which raises an error
343-
with pytest.raises(
344-
MissingConfigurationError, match="Connection test is not configured"
345-
):
346-
get_connection_dict("test")
344+
# Empty connection replacement: connection exists but has no parameters
345+
conn = get_connection_dict("test")
346+
assert conn == {} # Connection exists but is empty
347+
348+
# No parameters from cli_config are inherited (connection was replaced)
349+
assert "account" not in conn
350+
assert "user" not in conn
351+
assert "warehouse" not in conn
347352

348353

349354
def test_overlay_precedence_connection_specific_over_global(config_ng_setup):

0 commit comments

Comments
 (0)