1 import ./make-test-python.nix ({ lib, pkgs, ... }: {
4 meta = with lib.maintainers; {
5 maintainers = [ _1000101 ];
10 systemd.services.postgresql = {
12 ${pkgs.postgresql}/bin/psql -U postgres -c "ALTER ROLE testuser WITH LOGIN PASSWORD 'testpass'";
13 ${pkgs.postgresql}/bin/psql -U postgres -c "ALTER DATABASE testdb OWNER TO testuser;";
20 ensureDatabases = [ "testdb" ];
21 ensureUsers = [{ name = "testuser"; }];
23 local testdb testuser scram-sha-256
32 listen_addr = "localhost";
33 auth_type = "scram-sha-256";
34 auth_file = builtins.toFile "pgbouncer-users.txt" ''
39 test = "host=/run/postgresql port=5432 auth_user=testuser dbname=testdb";
49 one.wait_for_unit("default.target")
50 one.require_unit_state("pgbouncer.service", "active")
52 # Test if we can make a query through PgBouncer
53 one.wait_until_succeeds(
54 "psql 'postgres://testuser:testpass@localhost:6432/test' -c 'SELECT 1;'"