Skip to content

Commit

Permalink
small improvements to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nzbr committed Jan 28, 2023
1 parent 654d244 commit 14273c1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
result
result-*
scripts/*/target
nixos-wsl-installer.tar.gz
2 changes: 1 addition & 1 deletion scripts/syschdemd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
, which
, defaultUser
, automountPath
,
, ...
}:
let
mkWrappedScript =
Expand Down
12 changes: 6 additions & 6 deletions tests/shells.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/systemd-services.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 14273c1

Please sign in to comment.