Skip to content

Commit 8016f2a

Browse files
committed
test: rename realistic-CI test, fix env_var note
The previous name oversold the scenario - credentials aren't "absent", they're stringified placeholders. Jinja `env_var('FOO')` with FOO unset renders the literal string "None" into the YAML, which Pydantic accepts for Postgres's `user`/`password` (both typed `str`). The test proves the gate prevents a connection attempt, not that credentials are missing. Renamed to test_format_does_not_open_state_connection and rewrote the docstring to describe what actually happens. Coding-Agent: pi Model: anthropic/claude-opus-4-7 Signed-off-by: Joe Hartshorn <8881940+j-hartshorn@users.noreply.github.com>
1 parent 4c5c80e commit 8016f2a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/cli/test_cli.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,16 +2304,20 @@ def test_plan_still_loads_state(runner: CliRunner, tmp_path: Path, mocker):
23042304
assert mock.called, "state-sync was never accessed during `plan`"
23052305

23062306

2307-
def test_format_runs_without_state_credentials(
2307+
def test_format_does_not_open_state_connection(
23082308
runner: CliRunner, tmp_path: Path, mocker, monkeypatch
23092309
):
23102310
"""Realistic CI scenario: a config.yaml declaring a remote Postgres state
23112311
connection with credentials sourced from unset env vars. Format must still
23122312
succeed without opening the state connection.
23132313
23142314
Distinct from test_format_runs_without_state: that one proves the gate by
2315-
patching get_versions. This one proves the end-to-end CI use case where
2316-
no secrets are provisioned and YAML env_var() resolves to None.
2315+
patching get_versions on a default-DuckDB project. This one proves the
2316+
end-to-end CI use case where the config declares a real remote backend and
2317+
no secrets are provisioned. Jinja `env_var('FOO')` with `FOO` unset
2318+
renders the string `"None"` into the YAML; Pydantic accepts that for
2319+
Postgres's `user`/`password` (both typed `str`), so config validation
2320+
passes with placeholder values. The gate then prevents any connection.
23172321
"""
23182322
pytest.importorskip("psycopg2")
23192323

0 commit comments

Comments
 (0)