File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1974,13 +1974,18 @@ def _connection_config_validator(
19741974) -> ConnectionConfig | None :
19751975 if v is None or isinstance (v , ConnectionConfig ):
19761976 return v
1977+
1978+ check_config_and_vars_msg = "\n \n Verify your config.yaml and environment variables."
1979+
19771980 try :
19781981 return parse_connection_config (v )
19791982 except pydantic .ValidationError as e :
19801983 raise ConfigError (
19811984 validation_error_message (e , f"Invalid '{ v ['type' ]} ' connection config:" )
1982- + " \n \n Verify your config.yaml and environment variables."
1985+ + check_config_and_vars_msg
19831986 )
1987+ except ConfigError as e :
1988+ raise ConfigError (str (e ) + check_config_and_vars_msg )
19841989
19851990
19861991connection_config_validator : t .Callable = field_validator (
Original file line number Diff line number Diff line change @@ -301,6 +301,15 @@ def test_load_config_from_env():
301301 )
302302
303303
304+ def test_load_config_from_env_fails ():
305+ with mock .patch .dict (os .environ , {"SQLMESH__GATEWAYS__ABCDEF__CONNECTION__PASSWORD" : "..." }):
306+ with pytest .raises (
307+ ConfigError ,
308+ match = "Missing connection type.\n \n Verify your config.yaml and environment variables." ,
309+ ):
310+ Config .parse_obj (load_config_from_env ())
311+
312+
304313def test_load_config_from_env_no_config_vars ():
305314 with mock .patch .dict (
306315 os .environ ,
You can’t perform that action at this time.
0 commit comments