How to run the NixOS VM tests from nixpkgs?

I’m looking at https://nixcademy.com/2023/10/24/nixos-integration-tests/ and want to run some of the tests (just for playing around). That article mentions that I can nix-build -A nixosTests.bittorrent, but then I get

this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/v0y1prljam02d73anilynp36gadqd8rc-vm-test-run-bittorrent
copying path '/nix/store/v0y1prljam02d73anilynp36gadqd8rc-vm-test-run-bittorrent' from 'https://cache.nixos.org'...
/nix/store/v0y1prljam02d73anilynp36gadqd8rc-vm-test-run-bittorrent

and a result symlink to that folder. The folder is empty, and the log output and the duration of the command execution suggest that the tests haven’t run yet.

That means the test result is cached. Try nix-build -A nixosTests.bittorrent --check to return them.

2 Likes

Thanks! With --check it looks good.