0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

nixosTests: migrate tests to runTests (#389964)

This commit is contained in:
Martin Weinelt 2025-03-15 20:49:33 +01:00 committed by GitHub
commit 48e041d23c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 1151 additions and 1211 deletions

View file

@ -1300,26 +1300,26 @@ in {
wrappers = handleTest ./wrappers.nix {};
writefreely = handleTest ./web-apps/writefreely.nix {};
wstunnel = runTest ./wstunnel.nix;
xandikos = handleTest ./xandikos.nix {};
xautolock = handleTest ./xautolock.nix {};
xfce = handleTest ./xfce.nix {};
xfce-wayland = handleTest ./xfce-wayland.nix {};
xmonad = handleTest ./xmonad.nix {};
xmonad-xdg-autostart = handleTest ./xmonad-xdg-autostart.nix {};
xpadneo = handleTest ./xpadneo.nix {};
xrdp = handleTest ./xrdp.nix {};
xrdp-with-audio-pulseaudio = handleTest ./xrdp-with-audio-pulseaudio.nix {};
xandikos = runTest ./xandikos.nix;
xautolock = runTest ./xautolock.nix;
xfce = runTest ./xfce.nix;
xfce-wayland = runTest ./xfce-wayland.nix;
xmonad = runTest ./xmonad.nix;
xmonad-xdg-autostart = runTest ./xmonad-xdg-autostart.nix;
xpadneo = runTest ./xpadneo.nix;
xrdp = runTest ./xrdp.nix;
xrdp-with-audio-pulseaudio = runTest ./xrdp-with-audio-pulseaudio.nix;
xscreensaver = handleTest ./xscreensaver.nix {};
xss-lock = handleTest ./xss-lock.nix {};
xterm = handleTest ./xterm.nix {};
xxh = handleTest ./xxh.nix {};
yabar = handleTest ./yabar.nix {};
xss-lock = runTest ./xss-lock.nix;
xterm = runTest ./xterm.nix;
xxh = runTest ./xxh.nix;
yabar = runTest ./yabar.nix;
ydotool = handleTest ./ydotool.nix {};
yggdrasil = handleTest ./yggdrasil.nix {};
your_spotify = handleTest ./your_spotify.nix {};
zammad = handleTest ./zammad.nix {};
zenohd = handleTest ./zenohd.nix {};
zeronet-conservancy = handleTest ./zeronet-conservancy.nix {};
yggdrasil = runTest ./yggdrasil.nix;
your_spotify = runTest ./your_spotify.nix;
zammad = runTest ./zammad.nix;
zenohd = runTest ./zenohd.nix;
zeronet-conservancy = runTest ./zeronet-conservancy.nix;
zfs = handleTest ./zfs.nix {};
zigbee2mqtt_1 = runTest {
imports = [ ./zigbee2mqtt.nix ];
@ -1329,12 +1329,12 @@ in {
imports = [ ./zigbee2mqtt.nix ];
_module.args.package = pkgs.zigbee2mqtt_2;
};
zipline = handleTest ./zipline.nix {};
zoneminder = handleTest ./zoneminder.nix {};
zookeeper = handleTest ./zookeeper.nix {};
zram-generator = handleTest ./zram-generator.nix {};
zrepl = handleTest ./zrepl.nix {};
zsh-history = handleTest ./zsh-history.nix {};
zwave-js = handleTest ./zwave-js.nix {};
zwave-js-ui = handleTest ./zwave-js-ui.nix {};
zipline = runTest ./zipline.nix;
zoneminder = runTest ./zoneminder.nix;
zookeeper = runTest ./zookeeper.nix;
zram-generator = runTest ./zram-generator.nix;
zrepl = runTest ./zrepl.nix;
zsh-history = runTest ./zsh-history.nix;
zwave-js = runTest ./zwave-js.nix;
zwave-js-ui = runTest ./zwave-js-ui.nix;
}

View file

@ -1,7 +1,6 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{ lib, ... }:
{
{
name = "xandikos";
meta.maintainers = with lib.maintainers; [ _0x4A6F ];
@ -69,5 +68,4 @@ import ./make-test-python.nix (
"curl -s --fail -u xandikos:snakeOilPassword -H 'Host: xandikos.local' http://xandikos_proxy/xandikos/user/ | grep -i Xandikos"
)
'';
}
)
}

View file

@ -1,7 +1,4 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
{
name = "xautolock";
meta.maintainers = [ ];
@ -23,5 +20,4 @@ import ./make-test-python.nix (
machine.sleep(120)
machine.succeed("pgrep xlock")
'';
}
)
}

View file

@ -1,6 +1,4 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{
{
name = "xfce-wayland";
nodes.machine =
@ -67,5 +65,4 @@ import ./make-test-python.nix (
machine.sleep(10)
machine.screenshot("screen")
'';
}
)
}

View file

@ -1,6 +1,4 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{
{
name = "xfce";
nodes.machine =
@ -72,5 +70,4 @@ import ./make-test-python.nix (
machine.sleep(10)
machine.screenshot("screen")
'';
}
)
}

View file

@ -1,6 +1,5 @@
import ./make-test-python.nix (
{ lib, ... }:
{
{ lib, ... }:
{
name = "xmonad-xdg-autostart";
meta.maintainers = with lib.maintainers; [ oxalica ];
@ -34,11 +33,10 @@ import ./make-test-python.nix (
testScript =
{ nodes, ... }:
let
user = nodes.machine.config.users.users.alice;
user = nodes.machine.users.users.alice;
in
''
machine.wait_for_x()
machine.wait_for_file("${user.home}/xdg-autostart-executed")
'';
}
)
}

View file

@ -1,7 +1,6 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{ pkgs, ... }:
let
let
mkConfig = name: keys: ''
import XMonad
import XMonad.Operations (restart)
@ -53,8 +52,8 @@ import ./make-test-python.nix (
];
newConfig = pkgs.writeText "xmonad.hs" (mkConfig "newXMonad" newKeys);
in
{
in
{
name = "xmonad";
meta = with pkgs.lib.maintainers; {
maintainers = [
@ -84,7 +83,7 @@ import ./make-test-python.nix (
testScript =
{ nodes, ... }:
let
user = nodes.machine.config.users.users.alice;
user = nodes.machine.users.users.alice;
in
''
machine.wait_for_x()
@ -127,5 +126,4 @@ import ./make-test-python.nix (
machine.send_key("alt-ctrl-t")
machine.wait_for_file("/tmp/somefile")
'';
}
)
}

View file

@ -1,6 +1,5 @@
import ./make-test-python.nix (
{ lib, pkgs, ... }:
{
{ lib, pkgs, ... }:
{
name = "xpadneo";
meta.maintainers = with lib.maintainers; [ kira-bruneau ];
@ -17,5 +16,4 @@ import ./make-test-python.nix (
machine.start();
machine.succeed("modinfo hid_xpadneo | grep 'version:\s\+${pkgs.linuxPackages.xpadneo.version}'")
'';
}
)
}

View file

@ -1,6 +1,5 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{
{ pkgs, ... }:
{
# How to interactively test this module if the audio actually works
# - nix run .#pulseaudio-module-xrdp.tests.xrdp-with-audio-pulseaudio.driverInteractive
@ -106,5 +105,4 @@ import ./make-test-python.nix (
server.succeed('[ "$(cat /tmp/pulseaudio-sink)" == "xrdp-sink" ]')
client.screenshot("remoterdp")
'';
}
)
}

View file

@ -1,6 +1,5 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{
{ pkgs, ... }:
{
name = "xrdp";
meta = with pkgs.lib.maintainers; {
maintainers = [ ];
@ -33,7 +32,7 @@ import ./make-test-python.nix (
testScript =
{ nodes, ... }:
let
user = nodes.client.config.users.users.alice;
user = nodes.client.users.users.alice;
in
''
start_all()
@ -56,5 +55,4 @@ import ./make-test-python.nix (
client.sleep(5)
client.screenshot("remoterdp")
'';
}
)
}

View file

@ -1,6 +1,4 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
{
name = "xss-lock";
meta.maintainers = [ ];
@ -50,5 +48,4 @@ import ./make-test-python.nix (
with subtest("custom_cmd"):
perform_xsslock_test(custom_lockcmd, "xlock")
'';
}
)
}

View file

@ -1,14 +1,11 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{
{ pkgs, ... }:
{
name = "xterm";
meta = with pkgs.lib.maintainers; {
maintainers = [ nequissimus ];
};
nodes.machine =
{ pkgs, ... }:
{
nodes.machine = {
imports = [ ./common/x11.nix ];
services.xserver.desktopManager.xterm.enable = false;
};
@ -22,5 +19,4 @@ import ./make-test-python.nix (
assert "${pkgs.xterm.version}" in machine.succeed("cat /tmp/xterm_version")
machine.screenshot("window")
'';
}
)
}

View file

@ -1,7 +1,6 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{ pkgs, lib, ... }:
let
let
inherit (import ./ssh-keys.nix pkgs) snakeOilPrivateKey snakeOilPublicKey;
xxh-shell-zsh = pkgs.stdenv.mkDerivation {
pname = "xxh-shell-zsh";
@ -31,8 +30,8 @@ import ./make-test-python.nix (
url = "https://github.com/romkatv/zsh-bin/releases/download/v3.0.1/zsh-5.8-linux-x86_64.tar.gz";
sha256 = "sha256-i8flMd2Isc0uLoeYQNDnOGb/kK3oTFVqQgIx7aOAIIo=";
};
in
{
in
{
name = "xxh";
meta = with lib.maintainers; {
maintainers = [ lom ];
@ -72,5 +71,4 @@ import ./make-test-python.nix (
client.succeed("xxh server -i /root/.ssh/id_ecdsa +hc \'echo $0\' +i +s zsh +I xxh-shell-zsh+path+${xxh-shell-zsh} | grep -Fq '/root/.xxh/.xxh/shells/xxh-shell-zsh/build/zsh-bin/bin/zsh'")
'';
}
)
}

View file

@ -1,6 +1,4 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
{
name = "yabar";
meta.maintainers = [ ];
@ -29,5 +27,4 @@ import ./make-test-python.nix (
machine.screenshot("top_bar")
'';
}
)
}

View file

@ -25,15 +25,14 @@ let
danIp6 = bobPrefix + "::2";
in
import ./make-test-python.nix (
{ pkgs, ... }:
{
{ pkgs, ... }:
{
name = "yggdrasil";
meta = with pkgs.lib.maintainers; {
maintainers = [ gazally ];
};
nodes = rec {
nodes = {
# Alice is listening for peerings on a specified port,
# but has multicast peering disabled. Alice has part of her
# yggdrasil config in Nix and part of it in a file.
@ -106,9 +105,7 @@ import ./make-test-python.nix (
autoStart = true;
privateNetwork = true;
hostBridge = "br0";
config =
{ config, pkgs, ... }:
{
config = {
networking.interfaces.eth0.ipv6 = {
addresses = [
{
@ -193,5 +190,4 @@ import ./make-test-python.nix (
carol.succeed("curl --fail -g http://[${aliceIp6}]")
carol.succeed("curl --fail -g http://[${danIp6}]")
'';
}
)
}

View file

@ -1,6 +1,5 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{
{ pkgs, ... }:
{
name = "your_spotify";
meta = with pkgs.lib.maintainers; {
maintainers = [ patrickdag ];
@ -32,5 +31,4 @@ import ./make-test-python.nix (
out = machine.succeed("curl --fail -X GET 'http://localhost:80/'")
assert "<title>Your Spotify</title>" in out
'';
}
)
}

View file

@ -1,7 +1,6 @@
import ./make-test-python.nix (
{ lib, pkgs, ... }:
{ lib, pkgs, ... }:
{
{
name = "zammad";
meta.maintainers = with lib.maintainers; [
@ -9,9 +8,7 @@ import ./make-test-python.nix (
netali
];
nodes.machine =
{ config, ... }:
{
nodes.machine = {
virtualisation = {
memorySize = 2048;
};
@ -38,5 +35,4 @@ import ./make-test-python.nix (
"curl -sSfL http://localhost:3000/ | grep '<title>Zammad Helpdesk</title>'"
)
'';
}
)
}

View file

@ -1,7 +1,6 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{ pkgs, lib, ... }:
{
{
name = "zenohd";
meta.maintainers = [ lib.maintainers.markuskowa ];
@ -9,7 +8,6 @@ import ./make-test-python.nix (
router =
{
pkgs,
lib,
config,
...
}:
@ -89,5 +87,4 @@ import ./make-test-python.nix (
client.succeed(f"mosquitto_pub -h router -t {be}/test -m hello")
client.succeed(f"curl router:8000/{be}/test | grep hello")
'';
}
)
}

View file

@ -1,16 +1,18 @@
{
lib,
...
}:
let
port = 43110;
in
import ./make-test-python.nix (
{ pkgs, ... }:
{
{
name = "zeronet-conservancy";
meta = with pkgs.lib.maintainers; {
meta = with lib.maintainers; {
maintainers = [ fgaz ];
};
nodes.machine =
{ config, pkgs, ... }:
{ pkgs, ... }:
{
services.zeronet = {
enable = true;
@ -26,5 +28,4 @@ import ./make-test-python.nix (
machine.succeed("curl --fail -H 'Accept: text/html, application/xml, */*' localhost:${toString port}/Stats")
'';
}
)
}

View file

@ -1,6 +1,5 @@
import ./make-test-python.nix (
{ lib, ... }:
{
{ lib, ... }:
{
name = "zipline";
meta.maintainers = with lib.maintainers; [ defelo ];
@ -40,5 +39,4 @@ import ./make-test-python.nix (
resp = machine.succeed(f"curl zipline.local:8000/api/user -H 'Cookie: {cookie[1]}'")
assert json.loads(resp)["user"]["id"] == data["user"]["id"]
'';
}
)
}

View file

@ -1,7 +1,6 @@
import ./make-test-python.nix (
{ lib, ... }:
{ lib, ... }:
{
{
name = "zoneminder";
meta.maintainers = with lib.maintainers; [ danielfullmer ];
@ -22,5 +21,4 @@ import ./make-test-python.nix (
machine.wait_for_open_port(8095)
machine.succeed("curl --fail http://localhost:8095/")
'';
}
)
}

View file

@ -1,11 +1,10 @@
import ./make-test-python.nix (
{ pkgs, ... }:
let
{ pkgs, ... }:
let
perlEnv = pkgs.perl.withPackages (p: [ p.NetZooKeeper ]);
in
{
in
{
name = "zookeeper";
meta = with pkgs.lib.maintainers; {
maintainers = [
@ -50,5 +49,4 @@ import ./make-test-python.nix (
"${perlEnv}/bin/perl -E 'use Net::ZooKeeper qw(:acls); $z=Net::ZooKeeper->new(q(localhost:2181)); $z->get(qw(/perl)) eq qw(foo) || die $z->get_error()'"
)
'';
}
)
}

View file

@ -1,4 +1,4 @@
import ./make-test-python.nix {
{
name = "zram-generator";
nodes = {

View file

@ -1,8 +1,8 @@
import ./make-test-python.nix ({
{
name = "zrepl";
nodes.host =
{ config, pkgs, ... }:
{ pkgs, ... }:
{
config = {
# Prerequisites for ZFS and tests.
@ -73,4 +73,4 @@ import ./make-test-python.nix ({
"zrepl_zfs_snapshot_duration_count{filesystem=\"test\"}" in out
), "zrepl snapshot counter for test was not found in Prometheus output"
'';
})
}

View file

@ -1,6 +1,5 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{
{ pkgs, ... }:
{
name = "zsh-history";
meta = with pkgs.lib.maintainers; {
maintainers = [ ];
@ -36,5 +35,4 @@ import ./make-test-python.nix (
# Ensure that command was recorded in history
default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
'';
}
)
}

View file

@ -1,6 +1,5 @@
import ./make-test-python.nix (
{ lib, ... }:
{
{ lib, ... }:
{
name = "zwave-js-ui";
meta.maintainers = with lib.maintainers; [ cdombroski ];
@ -27,5 +26,4 @@ import ./make-test-python.nix (
machine.wait_until_succeeds("journalctl --since -1m --unit zwave-js-ui --grep 'Listening on port 9999host :: protocol HTTP'")
machine.wait_for_file("/var/lib/zwave-js-ui/users.json")
'';
}
)
}

View file

@ -1,7 +1,6 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{ pkgs, lib, ... }:
let
let
secretsConfigFile = pkgs.writeText "secrets.json" (
builtins.toJSON {
securityKeys = {
@ -9,15 +8,13 @@ import ./make-test-python.nix (
};
}
);
in
{
in
{
name = "zwave-js";
meta.maintainers = with lib.maintainers; [ graham33 ];
nodes = {
machine =
{ config, ... }:
{
machine = {
services.zwave-js = {
enable = true;
serialPort = "/dev/null";
@ -34,5 +31,4 @@ import ./make-test-python.nix (
machine.wait_for_open_port(3000)
machine.wait_until_succeeds("journalctl --since -1m --unit zwave-js --grep 'ZwaveJS server listening'")
'';
}
)
}