Skip to content

Commit 1a5804b

Browse files
committed
extend basic test
1 parent d75cc32 commit 1a5804b

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

tests/basic-functionality.spec.ps1

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,43 @@
33
$id = WSL-Install
44

55
try {
6+
7+
# Run command through installer
68
WSL-Launch $id "nixos-version"
79
if ($LASTEXITCODE -ne 0) {
8-
throw "Failed to run nixos-version inside the container"
10+
throw "Failed to run a command through the installer"
11+
}
12+
# Run another command after the installer is done
13+
WSL-Launch $id "true"
14+
if ($LASTEXITCODE -ne 0) {
15+
throw "Failed to run a second command"
16+
}
17+
18+
# Restart the container and run a command
19+
WSL-Shutdown $id
20+
WSL-Launch $id "true"
21+
if ($LASTEXITCODE -ne 0) {
22+
throw "Failed to run command after restart"
23+
}
24+
25+
# nixos-rebuild works
26+
WSL-Launch $id "sudo nixos-rebuild switch"
27+
if ($LASTEXITCODE -ne 0) {
28+
throw "Failed to run nixos-rebuild"
29+
}
30+
31+
# nix-shell works
32+
WSL-Launch $id "nix-shell -p neofetch --command neofetch"
33+
if ($LASTEXITCODE -ne 0) {
34+
throw "Failed to run a command through nix-shell"
35+
}
36+
37+
# nix run works
38+
WSL-Launch $id "nix run nixpkgs#neofetch"
39+
if ($LASTEXITCODE -ne 0) {
40+
throw "Failed to run a command through nix run"
941
}
1042

11-
# TODO: WSL-Shutdown
1243
}
1344
finally {
1445
WSL-Uninstall($id)

tests/lib/lib_linux.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function WSL-Launch([string]$id, [string]$command) {
2424
# TODO: WSL-CopyFile
2525

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

0 commit comments

Comments
 (0)