Merge pull request #143808 from iAmMrinal0/move/lsdTest

lsd: move nixos test to installCheckPhase
This commit is contained in:
Mario Rodas 2021-10-30 22:31:41 -05:00 committed by GitHub
commit 984c59161a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 15 deletions

View File

@ -237,7 +237,6 @@ in
locate = handleTest ./locate.nix {};
login = handleTest ./login.nix {};
loki = handleTest ./loki.nix {};
lsd = handleTest ./lsd.nix {};
lxd = handleTest ./lxd.nix {};
lxd-nftables = handleTest ./lxd-nftables.nix {};
#logstash = handleTest ./logstash.nix {};

View File

@ -1,12 +0,0 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "lsd";
meta = with pkgs.lib.maintainers; { maintainers = [ nequissimus ]; };
nodes.lsd = { pkgs, ... }: { environment.systemPackages = [ pkgs.lsd ]; };
testScript = ''
lsd.succeed('echo "abc" > /tmp/foo')
assert "4 B /tmp/foo" in lsd.succeed('lsd --classic --blocks "size,name" -l /tmp/foo')
assert "lsd ${pkgs.lsd.version}" in lsd.succeed("lsd --version")
'';
})

View File

@ -1,5 +1,4 @@
{ lib
, nixosTests
, fetchFromGitHub
, rustPlatform
, installShellFiles
@ -26,7 +25,18 @@ rustPlatform.buildRustPackage rec {
# Found argument '--test-threads' which wasn't expected, or isn't valid in this context
doCheck = false;
passthru.tests = { inherit (nixosTests) lsd; };
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
testFile=$(mktemp /tmp/lsd-test.XXXX)
echo 'abc' > $testFile
$out/bin/lsd --classic --blocks "size,name" -l $testFile | grep "4 B $testFile"
$out/bin/lsd --version | grep "${version}"
rm $testFile
runHook postInstallCheck
'';
meta = with lib; {
homepage = "https://github.com/Peltoche/lsd";