Open mrl5 opened 1 month ago
Uhh, I believe that this is impossible to unit test with pg_test
as it currently is because pg_test
runs tests in transactions, which means it can only test things that work if you run the test against the same backend in two different transactions. It has been a while since I looked at the test code so I may be misremembering slightly.
It seems plausible that pgrx-tests
could be taught how to run tests in connections and thus, if I understand correctly, test this by opening multiple connections, right? But this would require Effort, as it would then have to learn not only the connection management... it might even know that already... but it would also need to be taught how to set the configuration on initial connection for the test.
As for manual testing, I suppose you can simply set it in the configuration file? That's what I usually have done.
with manual test I was able to make it running with:
export PGOPTIONS="-c my.foo=bar"
cargo pgrx run pg16
SHOW my.foo;
my.foo
--------
bar
(1 row)
with unit tests
export PGOPTIONS="-c my.foo=bar"
cargo test
it seems to be missing but I'm still not 100% sure
I don't believe we pass PGOPTIONS on to the postgres process.
Actually it seems it's not on the list of env vars we strip out. Weird. Should work, then.
this is where we start up postgres: https://github.com/pgcentralfoundation/pgrx/blob/c9e218bfc4503f279bd342949ff2fbf65f9f6451/pgrx-tests/src/framework.rs#L552-L571
hello, let's assume that I have this GUC initialization logic:
GucContext::Suset
:but - as expected - I'm getting
cargo pgrx run pg16
?