From bab9aa46a90a6be42fabdec8b22f3294c1ad4949 Mon Sep 17 00:00:00 2001 From: nzbr Date: Fri, 25 Nov 2022 19:17:05 +0100 Subject: Add CI Tests (#161) * use systemd-run instead of machinectl * fix systemd user sessions by launching through runuser * skip mounting binfmt_misc if the kernel lacks support for it * link syschdemd/installer to static location * make check happy * test tests * add a simple installer test * add second test for exit codes * make tests responsible for checking exit code * fix: add which to path * overhaul actions workflow * move checks out of flake.nix * use GUID for image name * Split flake checks into matrix job * Check for side-effects * reformat powershell scripts * extend basic test * use pester for tests * "fix" (purposefully) failing test * rename lib -> init * Add test for systemd --user * Add test for docker-native * move release to separate workflow * change downstream workflow path * switch to a class * Test running with different user shells * Add lib implementation for Windows * Add documentation for the tests * readme: docker permissions * remove empty files --- tests/basic-functionality.Tests.ps1 | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/basic-functionality.Tests.ps1 (limited to 'tests/basic-functionality.Tests.ps1') diff --git a/tests/basic-functionality.Tests.ps1 b/tests/basic-functionality.Tests.ps1 new file mode 100644 index 0000000..d62823b --- /dev/null +++ b/tests/basic-functionality.Tests.ps1 @@ -0,0 +1,44 @@ +BeforeAll { + . $PSScriptRoot/lib/lib.ps1 +} + +Describe "Basic Functionality" { + BeforeAll { + $distro = Install-Distro + } + + It "is possible to run a command through the installer" { + $distro.Launch("nixos-version") + $LASTEXITCODE | Should -Be 0 + } + + It "is possible to run a second command" { + $distro.Launch("true") + $LASTEXITCODE | Should -Be 0 + } + + It "is possible to run a command after restarting the container" { + $distro.Shutdown() + $distro.Launch("true") + $LASTEXITCODE | Should -Be 0 + } + + It "is possible to use nixos-rebuild" { + $distro.Launch("sudo nixos-rebuild switch") + $LASTEXITCODE | Should -Be 0 + } + + It "is possible to run a command through nix-shell" { + $distro.Launch("nix-shell -p neofetch --command neofetch") + $LASTEXITCODE | Should -Be 0 + } + + It "is possible to run a command through nix run" { + $distro.Launch("nix run nixpkgs#neofetch") + $LASTEXITCODE | Should -Be 0 + } + + AfterAll { + $distro.Uninstall() + } +} -- cgit v1.2.3