Skip to content

Commit

Permalink
extend basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
nzbr committed Nov 10, 2022
1 parent d75cc32 commit b68267e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 21 additions & 2 deletions tests/basic-functionality.spec.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,31 @@
$id = WSL-Install

try {

# Run command through installer
WSL-Launch $id "nixos-version"
if ($LASTEXITCODE -ne 0) {
throw "Failed to run nixos-version inside the container"
throw "Failed to run a command through the installer"
}
# Run another command after the installer is done
WSL-Launch $id "true"
if ($LASTEXITCODE -ne 0) {
throw "Failed to run a second command"
}

# Restart the container and run a command
WSL-Shutdown $id
WSL-Launch $id "true"
if ($LASTEXITCODE -ne 0) {
throw "Failed to run command after restart"
}

# nixos-rebuild works at all
WSL-Launch $id "sudo nixos-rebuild switch"
if ($LASTEXITCODE -ne 0) {
throw "Failed to run nixos-rebuild"
}

# TODO: WSL-Shutdown
}
finally {
WSL-Uninstall($id)
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/lib_linux.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function WSL-Launch([string]$id, [string]$command) {
# TODO: WSL-CopyFile

function WSL-Shutdown([string]$id) {
docker stop $id
docker restart $id # Restart instead of stop so that exec can still be used
if ($LASTEXITCODE -ne 0) {
throw "Failed to stop container"
}
Expand Down

0 comments on commit b68267e

Please sign in to comment.