Skip to content

Conversation

@jeltz
Copy link
Contributor

@jeltz jeltz commented Jan 15, 2026

The cost of running initdb, especially without fsync, is not very big on modern computers and version of PostgreSQL so the optimization of reusing the same database cluster between test runs is just a potential footgun no longer worth the benefits.

It might still be worth caching the generated TLS certificates but for now let's not do that to keep the code simple.

On top of this I decided to clean up the PostgresServer class in general. I have ideas for how to further clean up the test suite but this was the main things which made the test suite annoying to run for me locally.

The cost of running initdb, especially without fsync, is not very big on
modern computers and version of PostgreSQL so the optimization of
reusing the same database cluster between test runs is just a potential
footgun no longer worth the benefits.

It might still be worth caching the generated TLS certificates but for
now let's not do that to keep the code simple.
@larskanis
Copy link
Collaborator

larskanis commented Jan 15, 2026

Thank you again! I merged this except the last commit. The initdb substantially slows down the execution of single tests. A rake clean removes the cluster, which should be quite common for a ruby dev in case of issues.

May I ask you about the reason doing all the effort on ruby-pg?

@jeltz
Copy link
Contributor Author

jeltz commented Jan 15, 2026

Thanks for merging! But sadly rake clean does not solve my issue because it also removes pg_ext.so. But, hmm, maybe I could add some other rake task for this or something. I will need to think.

As for why my interest? I wrote you an email earlier today (so no wonder you have not seen it yet) but I can tell you here too. I am planning to propose adding support for Oauth to the pg gem since PostgreSQL 18 added support to the server and to libpq. I have a patch that I am working on which exposes the Oauth support. Is that something that you would be interested in? I am planning to submit a draft PR when I have come a bit further on the patch so you can see what the code footprint is.

These improvements to the test suite were just things I ran into when I was working on adding test cases for my patch, plus some things I spotted when reading the code. :)

@jeltz jeltz force-pushed the spec-fresh-clusters branch from 30fa477 to c2377da Compare January 15, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants