Skip to content

Commit

Permalink
Merge pull request #755 from emilazy/fix-test-negations
Browse files Browse the repository at this point in the history
tests: fix uses of `!`
  • Loading branch information
Enzime authored Aug 5, 2023
2 parents 8593ffb + 9d53926 commit 829041c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ let

makeTest = test:
let
testName =
builtins.replaceStrings [ ".nix" ] [ "" ]
(builtins.baseNameOf test);

configuration =
{ config, lib, pkgs, ... }:
with lib;
Expand All @@ -36,7 +40,7 @@ let
};

config = {
system.build.run-test = pkgs.runCommand "darwin-test"
system.build.run-test = pkgs.runCommand "darwin-test-${testName}"
{ allowSubstitutes = false; preferLocalBuild = true; }
''
#! ${pkgs.stdenv.shell}
Expand Down
2 changes: 1 addition & 1 deletion tests/checks-nix-gc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ in
echo checking nix-gc service in /Library/LaunchDaemons >&2
grep "<string>org.nixos.nix-gc</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
! grep "<key>UserName</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
(! grep "<key>UserName</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist)
'';
}
2 changes: 1 addition & 1 deletion tests/nixpkgs-overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

test = ''
echo checking /bin/hello >&2
! ${pkgs.hello}/bin/hello
(! ${pkgs.hello}/bin/hello)
'';
}

2 changes: 1 addition & 1 deletion tests/services-nix-daemon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ in
grep "&amp;&amp;" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "exec ${nix}/bin/nix-daemon</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
! grep "<key>Sockets</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
(! grep "<key>Sockets</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist)
echo checking NIX_SSL_CERT_FILE in nix-daemon service >&2
grep "<key>NIX_SSL_CERT_FILE</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
Expand Down
6 changes: 3 additions & 3 deletions tests/services-nix-gc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ in
grep "<string>org.nixos.nix-gc</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
grep "<string>exec ${nix}/bin/nix-collect-garbage --delete-older-than 30d</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
grep "<key>UserName</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
! grep "<string>nixuser</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
grep "<string>nixuser</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
! grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
(! grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist)
echo checking nix-gc validation >&2
! grep "nix.gc.user = " ${config.out}/activate-user
(! grep "nix.gc.user = " ${config.out}/activate-user)
'';
}
2 changes: 1 addition & 1 deletion tests/sockets-nix-daemon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ in
grep "<string>/bin/wait4path" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "&amp;&amp;" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "exec ${nix}/bin/nix-daemon</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
! grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
(! grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist)
grep "<key>Sockets</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "/nix/var/nix/daemon-socket/socket" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
'';
Expand Down

0 comments on commit 829041c

Please sign in to comment.