diff --git a/tests/profiles/generate_profiles.py b/tests/profiles/generate_profiles.py index c24901865..1ea3115c5 100644 --- a/tests/profiles/generate_profiles.py +++ b/tests/profiles/generate_profiles.py @@ -32,13 +32,18 @@ def _yaml_inline(value: Any) -> str: """Render *value* for inline YAML. * Dicts (e.g. bigquery keyfile) → compact ``{key: val, …}`` + * Multi-line strings (e.g. PEM private keys) → double-quoted scalar with + escaped newlines so the rendered profiles.yml stays parseable inline. * Undefined (docker-only, no secrets) → empty string ``''`` - * Everything else → pass through as-is + * Everything else (incl. single-line strings) → pass through as-is so + adapter-side type coercion still works (e.g. ``port: 5439`` stays an int). """ if isinstance(value, Undefined): return "''" if isinstance(value, dict): return yaml.dump(value, default_flow_style=True).strip() + if isinstance(value, str) and "\n" in value: + return yaml.dump(value, default_flow_style=True, default_style='"').strip() return value diff --git a/tests/profiles/profiles.yml.j2 b/tests/profiles/profiles.yml.j2 index 32167402f..4bb0b4609 100644 --- a/tests/profiles/profiles.yml.j2 +++ b/tests/profiles/profiles.yml.j2 @@ -104,7 +104,10 @@ elementary_tests: type: snowflake account: {{ snowflake_account | toyaml }} user: {{ snowflake_user | toyaml }} - password: {{ snowflake_password | toyaml }} + private_key: {{ snowflake_private_key | toyaml }} + {%- if snowflake_private_key_passphrase is defined and snowflake_private_key_passphrase %} + private_key_passphrase: {{ snowflake_private_key_passphrase | toyaml }} + {%- endif %} role: {{ snowflake_role | toyaml }} database: {{ snowflake_database | toyaml }} warehouse: {{ snowflake_warehouse | toyaml }}