Re: Binding Postgres to port 0 for testing

2023-03-27 Thread Markus Pilman
Thanks Michael and Erik for the help, I really appreciate it! Thanks for explaining the context why PostgreSQL doesn't allow binding against port 0. I somehow didn't consider looking at the postgres tests, though it makes sense that they need to solve this problem. If I read the perl code correct

Re: Binding Postgres to port 0 for testing

2023-03-27 Thread Markus Pilman
Thanks for the suggestions. I didn't know about pg_virtualenv, that's interesting. Though it seems to achieve something similar as to containerize the test (potentially in a more platform independent way). Though it seems pg_virtualenv is mostly doing what my test driver is currently doing. Trying

Re: Binding Postgres to port 0 for testing

2023-03-26 Thread Michael Paquier
On Sun, Mar 26, 2023 at 10:49:33PM -0600, Markus Pilman wrote: > I somehow didn't consider looking at the postgres tests, though it makes > sense that they need to solve this problem. If I read the perl code > correctly though it seems that this could, in theory, cause a race? The > script checks f

Re: Binding Postgres to port 0 for testing

2023-03-26 Thread Michael Paquier
On Sat, Mar 25, 2023 at 11:01:33AM -0600, Markus Pilman wrote: > Now the problem is that I need to find a TCP port for each running postgres > instance. There's multiple ways to do this, but by far the easiest one I > know is to bind to port 0. So my plan was to start postgres with "-p 0" and > the

Re: Binding Postgres to port 0 for testing

2023-03-25 Thread Erik Wienhold
> On 25/03/2023 20:10 CET Markus Pilman wrote: > > Thanks for the suggestions. I didn't know about pg_virtualenv, that's > interesting. Though it seems to achieve something similar as to containerize > the test (potentially in a more platform independent way). Though it seems > pg_virtualenv is mo

Re: Binding Postgres to port 0 for testing

2023-03-25 Thread Erik Wienhold
> On 25/03/2023 18:01 CET Markus Pilman wrote: > > I am building a simple integration test framework for an application that I > am building. For this project I am planning to use PostgreSQL. > > For testing purposes I'd like to always start with an empty database, > populate data, and, if the tes

Re: Binding Postgres to port 0 for testing

2023-03-25 Thread Thorsten Glaser
Hi Markus, >I am building a simple integration test framework for an application that I >am building. For this project I am planning to use PostgreSQL. check pg_virtualenv(1), which apparently is a Debian thing. It auto-creates and auto-deletes at the end, if desired, a cluster and runs your prog

Binding Postgres to port 0 for testing

2023-03-25 Thread Markus Pilman
Hi all, I am building a simple integration test framework for an application that I am building. For this project I am planning to use PostgreSQL. For testing purposes I'd like to always start with an empty database, populate data, and, if the test was successful, delete everything. These tests a