From 14273c185311868e8525a0af3b5c93503e0f53e8 Mon Sep 17 00:00:00 2001 From: nzbr Date: Sat, 28 Jan 2023 07:04:21 +0100 Subject: [PATCH] small improvements to tests --- .gitignore | 1 + scripts/syschdemd.nix | 2 +- tests/shells.Tests.ps1 | 12 ++++++------ tests/systemd-services.Tests.ps1 | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 0792b54e..110fa764 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ result result-* scripts/*/target +nixos-wsl-installer.tar.gz diff --git a/scripts/syschdemd.nix b/scripts/syschdemd.nix index ab3d9fe5..88b84e65 100644 --- a/scripts/syschdemd.nix +++ b/scripts/syschdemd.nix @@ -10,7 +10,7 @@ , which , defaultUser , automountPath -, +, ... }: let mkWrappedScript = diff --git a/tests/shells.Tests.ps1 b/tests/shells.Tests.ps1 index d606d67c..f9ae5ca4 100644 --- a/tests/shells.Tests.ps1 +++ b/tests/shells.Tests.ps1 @@ -9,13 +9,13 @@ Describe "Shells" { function Add-ShellTest([string]$package, [string]$executable) { $temp = New-TemporaryFile @" -{ pkgs, config, ... }: -{ -imports = [ ./base.nix ]; + { pkgs, config, ... }: + { + imports = [ ./base.nix ]; -users.users.`${config.wsl.defaultUser}.shell = pkgs.$package; -} -"@ > $temp + users.users.`${config.wsl.defaultUser}.shell = pkgs.$package; + } +"@ > $temp $distro.InstallConfig($temp) Remove-Item $temp $distro.Launch("echo `$SHELL") | Select-Object -Last 1 | Should -BeExactly "/run/current-system/sw/bin/$executable" diff --git a/tests/systemd-services.Tests.ps1 b/tests/systemd-services.Tests.ps1 index 428bf651..2ba9eda0 100644 --- a/tests/systemd-services.Tests.ps1 +++ b/tests/systemd-services.Tests.ps1 @@ -8,12 +8,12 @@ Describe "Systemd Services" { } It "should boot" { - $distro.Launch(@("true")) + $distro.Launch("true") $LASTEXITCODE | Should -Be 0 } It "should not have any failed unit" { - $output = $distro.Launch(@("sudo", "systemctl", "list-units", "--failed")) | Remove-Escapes + $output = $distro.Launch("sudo systemctl list-units --failed") | Remove-Escapes $output | Where-Object { $_.trim() -ne "" } | Select-Object -Last 1 | Should -BeExactly "0 loaded units listed." $LASTEXITCODE | Should -Be 0 }