Use PGPASSWORD env var for postgres test credentials#121
Use PGPASSWORD env var for postgres test credentials#121mcraveiro wants to merge 3 commits intogetml:mainfrom
Conversation
|
Note: I've added this PR because I already have a Postgres instance running on my machine and I rather run the tests against it. |
|
@mcraveiro , I like the initiative, but I think it should be the same for all relevant databases. In other words, if we're going to do this for the postgres tests, we should also do it the the MySQL tests. |
|
Thanks for the review. I'll have a gander to see if everyone supports a PGPASSWORD equivalent, presumably this must be an established pattern. |
|
OK I did some analysis with Qwen and I think maybe this is not the best approach. Here are the results of the analysis in full, I'll then add my thoughts Analysis by QwenAuthentication Environment Variables Comparison
Key Differences Highlighted
My thoughtsSince this is not supported universally, maybe it's best to define a variable for sqlgen? something like:
We could then use this in a uniform manner across databases. |
|
@mcraveiro , that's fine. DuckDB and SQLite are usually not password-protected, but MySQL is. So we should do it for MySQL as well and leave the other two as they are. |
Add test_helpers.hpp with make_credentials() that checks for PGPASSWORD environment variable, falling back to "password" if not set. This allows running tests against an existing postgres instance. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
591e97e to
189a0ce
Compare
Add test_helpers.hpp with make_credentials() that checks for SQLGEN_TEST_PASSWORD environment variable, falling back to "password" if not set. Follows the same pattern as postgres tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add doc comments explaining that SQLGEN_TEST_PASSWORD environment variable can be set to override the default password for tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
OK, updated the PR with the requested changes. Cheers |
Summary
test_helpers.hppwithmake_credentials()utility function for both MySQL and PostgreSQL.SQLGEN_TEST_PASSWORDenv var, falls back to"password"if not setThis allows running tests against an existing instance without requiring password to be
"password".Test plan
test_aggregationspassestest_listen_notifytests pass (file with 5 credential usages)🤖 Generated with Claude Code