diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-11 16:05:06 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-11 16:05:06 +0000 |
| commit | 149a6af5ebe7d92f8063734104e444f48b33b012 (patch) | |
| tree | 4ef1669a57b3b0af376ea4a73e6149b233622f1d | |
| parent | 59f429cb18f218993a5052e4c36199fa96a82d2d (diff) | |
fix: only run unit tests during Nix build, skip integration tests
Changed from selectively skipping test modules to running only --lib
tests (unit tests). This is cleaner and more maintainable.
Integration tests (tests/*.rs) require:
- git binary in PATH
- Ability to spawn subprocesses
- Network access for some tests
- TestRelay fixture (spawns ngit-grasp)
These requirements don't work in the Nix sandbox, so we run only
unit tests (--lib) during package build. Full integration test suite
runs in environments where git is available:
- Local dev (nix develop includes git)
- CI/CD (git installed)
- Manual testing (cargo test runs all tests)
| -rw-r--r-- | flake.nix | 16 | ||||
| -rw-r--r-- | nix/module.nix | 15 |
2 files changed, 9 insertions, 22 deletions
| @@ -50,17 +50,11 @@ | |||
| 50 | 50 | ||
| 51 | buildInputs = with pkgs; [ openssl ]; | 51 | buildInputs = with pkgs; [ openssl ]; |
| 52 | 52 | ||
| 53 | # Skip tests that require git in PATH (sandboxing issue) | 53 | # Skip all integration tests during Nix build (require git in PATH) |
| 54 | # These tests run fine in dev environment and CI | 54 | # Integration tests run in dev environment and CI where git is available |
| 55 | checkFlags = [ | 55 | doCheck = true; |
| 56 | # Unit tests that spawn git subprocesses | 56 | cargoTestFlags = |
| 57 | "--skip=git::subprocess::tests::" | 57 | [ "--lib" ]; # Only run unit tests, skip integration tests |
| 58 | "--skip=git::tests::" | ||
| 59 | "--skip=purgatory::helpers::tests::" | ||
| 60 | # Integration tests that create git repos | ||
| 61 | "--skip=common::git_server::" | ||
| 62 | "--skip=common::purgatory_helpers::" | ||
| 63 | ]; | ||
| 64 | }; | 58 | }; |
| 65 | })) // { | 59 | })) // { |
| 66 | # NixOS module for deployment | 60 | # NixOS module for deployment |
diff --git a/nix/module.nix b/nix/module.nix index 23b1561..1cbeb27 100644 --- a/nix/module.nix +++ b/nix/module.nix | |||
| @@ -18,17 +18,10 @@ let | |||
| 18 | nativeBuildInputs = with pkgs; [ pkg-config ]; | 18 | nativeBuildInputs = with pkgs; [ pkg-config ]; |
| 19 | buildInputs = with pkgs; [ openssl ]; | 19 | buildInputs = with pkgs; [ openssl ]; |
| 20 | 20 | ||
| 21 | # Skip tests that require git in PATH (sandboxing issue) | 21 | # Skip all integration tests during Nix build (require git in PATH) |
| 22 | # These tests run fine in dev environment and CI | 22 | # Integration tests run in dev environment and CI where git is available |
| 23 | checkFlags = [ | 23 | doCheck = true; |
| 24 | # Unit tests that spawn git subprocesses | 24 | cargoTestFlags = [ "--lib" ]; # Only run unit tests, skip integration tests |
| 25 | "--skip=git::subprocess::tests::" | ||
| 26 | "--skip=git::tests::" | ||
| 27 | "--skip=purgatory::helpers::tests::" | ||
| 28 | # Integration tests that create git repos | ||
| 29 | "--skip=common::git_server::" | ||
| 30 | "--skip=common::purgatory_helpers::" | ||
| 31 | ]; | ||
| 32 | }; | 25 | }; |
| 33 | 26 | ||
| 34 | # Per-instance options | 27 | # Per-instance options |