mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
nixos/qui: init tests
This commit is contained in:
@@ -1314,6 +1314,7 @@ in
|
||||
qtile = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./qtile/default.nix;
|
||||
qtile-extras = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./qtile-extras/default.nix;
|
||||
quake3 = runTest ./quake3.nix;
|
||||
qui = runTest ./qui.nix;
|
||||
quicktun = runTest ./quicktun.nix;
|
||||
quickwit = runTest ./quickwit.nix;
|
||||
rabbitmq = runTest ./rabbitmq.nix;
|
||||
|
||||
47
nixos/tests/qui.nix
Normal file
47
nixos/tests/qui.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
name = "qui";
|
||||
meta.maintainers = with lib.maintainers; [ undefined-landmark ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
# We create this secret in the Nix store (making it readable by everyone).
|
||||
# DO NOT DO THIS OUTSIDE OF TESTS!!
|
||||
testSecretFile = pkgs.writeText "session_secret" "not-secret";
|
||||
in
|
||||
{
|
||||
services.qui = {
|
||||
enable = true;
|
||||
secretFile = testSecretFile;
|
||||
};
|
||||
|
||||
# Use port other than default to test if settings options work.
|
||||
specialisation.settingsPort.configuration = {
|
||||
services.qui = {
|
||||
enable = true;
|
||||
secretFile = testSecretFile;
|
||||
settings.port = 7777;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript =
|
||||
{ nodes, ... }:
|
||||
let
|
||||
settingsPort = "${nodes.machine.system.build.toplevel}/specialisation/settingsPort";
|
||||
in
|
||||
# python
|
||||
''
|
||||
def test_webui(port):
|
||||
machine.wait_for_unit("qui.service")
|
||||
machine.wait_for_open_port(port)
|
||||
machine.wait_until_succeeds(f"curl --fail http://localhost:{port}")
|
||||
|
||||
test_webui(7476)
|
||||
|
||||
machine.succeed("${settingsPort}/bin/switch-to-configuration test")
|
||||
test_webui(7777)
|
||||
'';
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
stdenvNoCC,
|
||||
nixosTests,
|
||||
nix-update-script,
|
||||
nodejs,
|
||||
pnpm_9,
|
||||
@@ -72,11 +73,14 @@ buildGoModule (finalAttrs: {
|
||||
versionCheckProgramArg = "version";
|
||||
doInstallCheck = true;
|
||||
|
||||
passthru.updateScript = nix-update-script {
|
||||
extraArgs = [
|
||||
"--subpackage"
|
||||
"qui-web"
|
||||
];
|
||||
passthru = {
|
||||
updateScript = nix-update-script {
|
||||
extraArgs = [
|
||||
"--subpackage"
|
||||
"qui-web"
|
||||
];
|
||||
};
|
||||
tests.testService = nixosTests.qui;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
||||
Reference in New Issue
Block a user