You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This directory contains tests that are executed against a built NixOS-WSL "legacy" tarball.
3
+
This directory contains tests that are executed against a built NixOS-WSL tarball.
4
4
The tests are written using the [Pester](https://pester.dev/) testing framework.
5
5
6
6
## Execute Tests
7
7
8
-
The tests can be executed on both Windows or Linux.
9
-
10
-
### Windows
8
+
The tests can only be executed on Windows. Support for running the tests in an emulated WSL environment through docker has been removed.
11
9
12
10
Make sure that you are able to run a distro in WSL2 before trying to run the tests.
13
11
Please note that the tests are not compatible with Windows PowerShell, but require the new [PowerShell Core](https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D?hl=en-us&gl=us).
14
12
15
-
### Linux
16
-
17
-
Running the tests requires Docker and PowerShell to be installed on your system. Make sure that the user you are running the tests as has permissions to run docker containers and that it is possible to access the internet from inside docker containers.
18
-
19
13
### Running the Tests
20
14
21
15
If you haven't already, [install Pester](https://pester.dev/docs/introduction/installation/).
22
-
The tests require a "legacy" `nixos-wsl.tar.gz` to be present in the current working directory, which can be built with
23
-
`sudo nix run .#nixosConfigurations.legacy.config.system.build.tarballBuilder -- nixos-wsl.tar.gz`.
16
+
The tests require a "modern" `nixos-wsl.tar.gz` to be present in the current working directory, which can be built with
17
+
`sudo nix run .#nixosConfigurations.modern.config.system.build.tarballBuilder -- nixos-wsl.tar.gz`.
24
18
25
19
Once everything is in place, run the test by running the following in PowerShell at the root of this repo:
26
20
27
21
```powershell
28
22
Invoke-Pester -Output Detailed ./tests
29
23
```
30
24
31
-
32
25
## Writing Test
33
26
34
27
Please refer to [the Pester documentation](https://pester.dev/docs/quick-start) on how to write new tests.
@@ -42,10 +35,10 @@ BeforeAll {
42
35
}
43
36
```
44
37
45
-
-`Install-Distro`: Creates a new NixOS-WSL instance, automatically selecting the appropriate runtime (WSL or Docker) for the host OS. Returns a new `Distro` object
38
+
-`[Distro]::new()`: Creates a new NixOS-WSL instance.
46
39
- A Distro object has the following methods:
47
-
-`Launch($command)`: Runs the specified command inside the container. Returns the command output
48
-
-`GetPath($path)`: Returns the path inside the container, that points to the specified file on the host.
40
+
-`Launch($command)`: Runs the specified command inside the distro. Returns the command output
41
+
-`GetPath($path)`: Returns the path inside the distro, that points to the specified file on the host.
49
42
-`InstallConfig($path)`: Installs a nix-file as the systems `configuration.nix`.
50
-
-`Shutdown()`: End all processes running in the container
51
-
-`Uninstall()`: Stop and then delete the container from the system. This should be called in an AfterEach or AfterAll block, so that the test does not leave it on the system.
43
+
-`Shutdown()`: End all processes running in the distro
44
+
-`Uninstall()`: Stop and then delete the distro from the system. This should be called in an AfterEach or AfterAll block, so that the test does not leave it on the system.
0 commit comments