I am writing a module for a ruby on rails app which requires various supporting services (postgres, redis, postfix…).
So I wrote a little integration test which seems to work ok, except that it’s about 5-10x slower when running “unattended” vs running it with .driverInteractive.
The build seems to be roughly equally fast, it’s the VM execution itself which differs.
It does not seem to be a networking issue, because when comparing the timestamps on the kernel logs during boot, everything seems to be slower, not just network related lines. For instance, the database migrations run in 2.5s vs 37s. Even before systemd kicks in, I can see a massive difference.
In interactive mode, the VM starts my service in ~40s, in non-interactive, it takes 4-6 minutes to reach the same stage:
testserver # [ 41.566722] systemd[1]: Startup finished in 1.653s (kernel) + 39.910s (userspace) = 41.563s.
vs
testserver # [ 355.145035] systemd[1]: Startup finished in 15.221s (kernel) + 5min 39.905s (userspace) = 5min 55.126s.
I don’t think my actual config is relevant since the VM booting is exhibiting the problem, but some pointers:
- I am using flakes
- lix 2.93.3
- I use
nixpkgs-unstable - I run the following commands (on the same machine, I’ve repeated execution several times alternating between the two modes and consistently found the same results):
nix -L build --extra-experimental-features flake-self-attrs .#serverTests.driverInteractive
./result/bin/nixos-test-driver --interactive
and on the other side
nix -L build --extra-experimental-features flake-self-attrs .#serverTests
and the output is defined as:
serverTests = pkgs.testers.runNixOSTest ./nix/alaveteli-server-test.nix;
where the test file defines a single node with my service. There is no “low-level” config that I’m aware of in my code.
In the end, my non interactive tests fail because of timeouts. In interactive mode, start_all() and test_script() actually succeed.
Is this difference in VM speed expected? How would I go about debugging this problem?