Describe the bug
You cannot depend on postgres being ready during tests.
To reproduce
Here's a minimum repro:
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
{ pkgs, lib, config, ... }:
{
services.postgres = {
enable = true;
port = 5432;
};
tasks."db:check" = {
description = "Verify postgres is reachable";
exec = "psql -c 'SELECT 1' template1";
before = [ "devenv:enterTest" ];
after = [ "devenv:processes:postgres" ];
};
}
The db:check task never runs because postgres is never ready
$ devenv test
✓ Configuring shell 2.8s
└ ✓ Evaluating shell 23 files 962ms
└ ✓ Building devenv-files-cleanup 75ms
└ ✓ Building tasks.json 51ms
└ ✓ Building devenv-shell 1 lines 100ms
└ ✓ Querying devenv-shell-env from cache.nixos.org 147ms
└ ✓ Building devenv-shell-env 219ms
✓ Evaluating Nix 1ms
✓ Loading tasks 1ms
└ ✓ Evaluating devenv.config.task.config 1ms
⠹ Running tasks → 5 tasks, roots: ["devenv:enterTest"] 1m 20s
└ ⠹ devenv:enterTest pending
└ ⠹ db:check pending
└ ⠹ devenv:enterShell pending
└ ⠹ devenv:files:cleanup pending
└ ⠧ postgres running (not ready: exec) :5432 1m 20s
│ server stopped
│ 2026-04-07 23:23:51.549 GMT [45191] LOG: database system was shut down at 2026-04-07 23:23:51 GMT
│ 2026-04-07 23:23:51.551 GMT [45142] LOG: database system is ready to accept connections
Version
$ devenv --version
devenv 2.0.6 (aarch64-darwin)
Describe the bug
You cannot depend on
postgresbeing ready during tests.To reproduce
Here's a minimum repro:
The
db:checktask never runs because postgres is never readyVersion
$ devenv --version
devenv 2.0.6 (aarch64-darwin)