boustrophedon / pgtemp Goto Github PK
View Code? Open in Web Editor NEWRust library and daemon for easily starting postgres databases per-test without Docker
License: MIT License
Rust library and daemon for easily starting postgres databases per-test without Docker
License: MIT License
When I try to use this in Github Actions I get these errors:
initdb failed! stdout:
stderr: sudo: initdb: command not found
), location: Location { file: "/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgtemp-0.3.0/src/run_db.rs", line: 72, col: 9 }
from what I see, this happens because sudo
can't find initdb
in its secure path - adding the path to postgres to $PATH
doesn't solve the issue.
I mitigated the issue by copying the whole postgresql
bin &lib folders into /usr/bin
& /usr/lib
respectively, but it would be nice if the library could handle this.
I can't repro this locally, so I don't know what the source of the issue is. The temporary DB, created with PgTempDB::async_new().await
(so persist
isn't set), hangs for minutes after a call to shutdown
. Maybe there are some existing connections to the DB, but according to the documentation, this shouldn't block shutdown
when persist
isn't set.
This happens on a runner running Ubuntu noble, with postgresql-16 installed.
Hi, thanks for writing this, I was thinking of such a thing months ago and it's always nice to see someone else wrote what I wanted :D.
The only problem I'm having is that occasionally the tests fail to start up. This is much more reproducible when my backup software is running in the background, putting a load on the system (and disk?).
The output I get most often is as follows:
createdb failed! stdout:
stderr: createdb: error: connection to server at "localhost" (127.0.0.1), port 41499 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
thread 'tests::test_oidc_auth_flow::test_userinfo_bad_auth' panicked at /home/rei/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgtemp-0.3.0/src/lib.rs:378:14:
failed to start pgtemp server: JoinError::Panic(Id(2), ...)
Occasionally I get the following instead
stderr: createdb: error: connection to server at "localhost" (127.0.0.1), port 35153 failed: FATAL: the database system is starting up
I think these errors mean that Postgres hasn't started up yet, but pgtemp is already trying to run createdb
.
I'm not sure if there's a perfect way of waiting for startup to happen (I guess you can possibly parse the logs?), so perhaps just trying createdb
a few times in a loop with a small delay is the way to go.
I'm using pgtemp v0.3.0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.