diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2018-12-16 22:55:06 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2018-12-16 22:55:06 +0100 |
commit | aead6e12f96a76a2c1c6b64ba81b18d647e6e3d0 (patch) | |
tree | aff35e8cfa837fd92319e23951493431b3d2dacc /nixos/tests | |
parent | 4027966602c1d3bfac7091e390c2cf678115d59f (diff) | |
parent | eceb2b06a1bd012a938697718c5f3b7b6fd9249a (diff) | |
download | nixlib-aead6e12f96a76a2c1c6b64ba81b18d647e6e3d0.tar nixlib-aead6e12f96a76a2c1c6b64ba81b18d647e6e3d0.tar.gz nixlib-aead6e12f96a76a2c1c6b64ba81b18d647e6e3d0.tar.bz2 nixlib-aead6e12f96a76a2c1c6b64ba81b18d647e6e3d0.tar.lz nixlib-aead6e12f96a76a2c1c6b64ba81b18d647e6e3d0.tar.xz nixlib-aead6e12f96a76a2c1c6b64ba81b18d647e6e3d0.tar.zst nixlib-aead6e12f96a76a2c1c6b64ba81b18d647e6e3d0.zip |
Merge remote-tracking branch 'upstream/master' into staging
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/all-tests.nix | 4 | ||||
-rw-r--r-- | nixos/tests/borgbackup.nix | 3 | ||||
-rw-r--r-- | nixos/tests/clamav.nix | 37 | ||||
-rw-r--r-- | nixos/tests/gitlab.nix | 2 | ||||
-rw-r--r-- | nixos/tests/gnome3-gdm.nix | 32 | ||||
-rw-r--r-- | nixos/tests/gnome3.nix | 4 | ||||
-rw-r--r-- | nixos/tests/i3wm.nix | 2 | ||||
-rw-r--r-- | nixos/tests/kubernetes/base.nix | 2 | ||||
-rw-r--r-- | nixos/tests/kubernetes/kubernetes-common.nix | 1 | ||||
-rw-r--r-- | nixos/tests/owncloud.nix | 39 | ||||
-rw-r--r-- | nixos/tests/slurm.nix | 7 | ||||
-rw-r--r-- | nixos/tests/systemd.nix | 5 | ||||
-rw-r--r-- | nixos/tests/xmonad.nix | 2 |
13 files changed, 84 insertions, 56 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index eddd6496bf47..0c8520d15dac 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -39,6 +39,7 @@ in cfssl = handleTestOn ["x86_64-linux"] ./cfssl.nix {}; chromium = (handleTestOn ["x86_64-linux"] ./chromium.nix {}).stable or {}; cjdns = handleTest ./cjdns.nix {}; + clamav = handleTest ./clamav.nix {}; cloud-init = handleTest ./cloud-init.nix {}; codimd = handleTest ./codimd.nix {}; containers-bridge = handleTest ./containers-bridge.nix {}; @@ -106,7 +107,7 @@ in installer = handleTest ./installer.nix {}; ipv6 = handleTest ./ipv6.nix {}; jenkins = handleTest ./jenkins.nix {}; - kafka = handleTest ./kafka.nix {}; + #kafka = handleTest ./kafka.nix {}; # broken since openjdk: 8u181 -> 8u192 kerberos = handleTest tests/kerberos/default.nix {}; kernel-latest = handleTest ./kernel-latest.nix {}; kernel-lts = handleTest ./kernel-lts.nix {}; @@ -157,7 +158,6 @@ in openssh = handleTest ./openssh.nix {}; osquery = handleTest ./osquery.nix {}; ostree = handleTest ./ostree.nix {}; - owncloud = handleTest ./owncloud.nix {}; pam-oath-login = handleTest ./pam-oath-login.nix {}; peerflix = handleTest ./peerflix.nix {}; pgjwt = handleTest ./pgjwt.nix {}; diff --git a/nixos/tests/borgbackup.nix b/nixos/tests/borgbackup.nix index 9b39abdfa8ed..fdb87dbea438 100644 --- a/nixos/tests/borgbackup.nix +++ b/nixos/tests/borgbackup.nix @@ -130,6 +130,9 @@ in { # Make sure keepFile has the correct content $client->succeed("$borg extract '${localRepo}::${archiveName}'"); $client->succeed('c=$(cat ${dataDir}/${keepFile}) && [[ "$c" == "${keepFileData}" ]]'); + # Make sure the same is true when using `borg mount` + $client->succeed("mkdir -p /mnt/borg && $borg mount '${localRepo}::${archiveName}' /mnt/borg"); + $client->succeed('c=$(cat /mnt/borg/${dataDir}/${keepFile}) && [[ "$c" == "${keepFileData}" ]]'); }; subtest "remote", sub { diff --git a/nixos/tests/clamav.nix b/nixos/tests/clamav.nix new file mode 100644 index 000000000000..84a08bcc49f3 --- /dev/null +++ b/nixos/tests/clamav.nix @@ -0,0 +1,37 @@ +import ./make-test.nix ({ pkgs, ... }: let + + eicarTestFile = pkgs.fetchurl { + url = "http://2016.eicar.org/download/eicar.com.txt"; + sha256 = "03zxa7vap2jkqjif4bzcjp33yrnip5yrz2bisia9wj5npwdh4ni7"; + }; + + clamavMain = builtins.fetchurl "http://database.clamav.net/main.cvd"; + clamavDaily = builtins.fetchurl "http://database.clamav.net/daily.cvd"; + clamavBytecode = builtins.fetchurl "http://database.clamav.net/bytecode.cvd"; + +in { + name = "clamav"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ fpletz ]; + }; + + nodes.machine = { ... }: { + virtualisation.memorySize = 1024; + + services.clamav.daemon.enable = true; + systemd.services.clamav-daemon.preStart = '' + mkdir -p /var/lib/clamav + ln -sf ${clamavMain} /var/lib/clamav/main.cvd + ln -sf ${clamavDaily} /var/lib/clamav/daily.cvd + ln -sf ${clamavBytecode} /var/lib/clamav/bytecode.cvd + ''; + }; + + testScript = '' + startAll; + $machine->waitForUnit("multi-user.target"); + $machine->waitForUnit("clamav-daemon.service"); + $machine->waitForFile("/run/clamav/clamd.ctl"); + $machine->fail("clamdscan ${eicarTestFile}"); + ''; +}) diff --git a/nixos/tests/gitlab.nix b/nixos/tests/gitlab.nix index f401fe098dcc..16e0dd723ecf 100644 --- a/nixos/tests/gitlab.nix +++ b/nixos/tests/gitlab.nix @@ -8,7 +8,7 @@ import ./make-test.nix ({ pkgs, lib, ...} : with lib; { nodes = { gitlab = { ... }: { - virtualisation.memorySize = 2047; + virtualisation.memorySize = if pkgs.stdenv.is64bit then 4096 else 2047; systemd.services.gitlab.serviceConfig.Restart = mkForce "no"; systemd.services.gitlab-workhorse.serviceConfig.Restart = mkForce "no"; systemd.services.gitaly.serviceConfig.Restart = mkForce "no"; diff --git a/nixos/tests/gnome3-gdm.nix b/nixos/tests/gnome3-gdm.nix index 959030d59880..c2808d87d99d 100644 --- a/nixos/tests/gnome3-gdm.nix +++ b/nixos/tests/gnome3-gdm.nix @@ -23,11 +23,21 @@ import ./make-test.nix ({ pkgs, ...} : { virtualisation.memorySize = 1024; }; - testScript = - '' - # wait for gdm to start and bring up X + testScript = let + # Keep line widths somewhat managable + bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"; + gdbus = "${bus} gdbus"; + # Call javascript in gnome shell, returns a tuple (success, output), where + # `success` is true if the dbus call was successful and output is what the + # javascript evaluates to. + eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval"; + # False when startup is done + startingUp = "${gdbus} ${eval} Main.layoutManager._startingUp"; + # Hopefully gnome-terminal's wm class + wmClass = "${gdbus} ${eval} global.display.focus_window.wm_class"; + in '' + # wait for gdm to start $machine->waitForUnit("display-manager.service"); - $machine->waitForX; # wait for alice to be logged in $machine->waitForUnit("default.target","alice"); @@ -35,10 +45,16 @@ import ./make-test.nix ({ pkgs, ...} : { # Check that logging in has given the user ownership of devices. $machine->succeed("getfacl /dev/snd/timer | grep -q alice"); - # open a terminal and check it's there - $machine->succeed("su - alice -c 'DISPLAY=:0.0 XAUTHORITY=/run/user/\$UID/gdm/Xauthority gnome-terminal'"); - $machine->succeed("xauth merge /run/user/1000/gdm/Xauthority"); - $machine->waitForWindow(qr/Terminal/); + # Wait for the wayland server + $machine->waitForFile("/run/user/1000/wayland-0"); + + # Wait for gnome shell, correct output should be "(true, 'false')" + $machine->waitUntilSucceeds("su - alice -c '${startingUp} | grep -q true,..false'"); + + # open a terminal + $machine->succeed("su - alice -c '${bus} gnome-terminal'"); + # and check it's there + $machine->waitUntilSucceeds("su - alice -c '${wmClass} | grep -q gnome-terminal-server'"); # wait to get a nice screenshot $machine->sleep(20); diff --git a/nixos/tests/gnome3.nix b/nixos/tests/gnome3.nix index 3f0368592b8d..95694ea4828d 100644 --- a/nixos/tests/gnome3.nix +++ b/nixos/tests/gnome3.nix @@ -16,7 +16,7 @@ import ./make-test.nix ({ pkgs, ...} : { services.xserver.displayManager.lightdm.autoLogin.enable = true; services.xserver.displayManager.lightdm.autoLogin.user = "alice"; services.xserver.desktopManager.gnome3.enable = true; - services.xserver.desktopManager.default = "gnome"; + services.xserver.desktopManager.default = "gnome-xorg"; virtualisation.memorySize = 1024; }; @@ -33,7 +33,7 @@ import ./make-test.nix ({ pkgs, ...} : { $machine->succeed("su - alice -c 'DISPLAY=:0.0 gnome-terminal &'"); $machine->succeed("xauth merge ~alice/.Xauthority"); - $machine->waitForWindow(qr/Terminal/); + $machine->waitForWindow(qr/alice.*machine/); $machine->succeed("timeout 900 bash -c 'while read msg; do if [[ \$msg =~ \"GNOME Shell started\" ]]; then break; fi; done < <(journalctl -f)'"); $machine->sleep(10); $machine->screenshot("screen"); diff --git a/nixos/tests/i3wm.nix b/nixos/tests/i3wm.nix index e51aee30fdb0..d309f19a0b4a 100644 --- a/nixos/tests/i3wm.nix +++ b/nixos/tests/i3wm.nix @@ -28,7 +28,7 @@ import ./make-test.nix ({ pkgs, ...} : { $machine->waitForFile("/home/alice/.config/i3/config"); $machine->sleep(2); $machine->sendKeys("alt-ret"); - $machine->waitForWindow(qr/machine.*alice/); + $machine->waitForWindow(qr/alice.*machine/); $machine->sleep(2); $machine->screenshot("terminal"); ''; diff --git a/nixos/tests/kubernetes/base.nix b/nixos/tests/kubernetes/base.nix index b77da3414b34..9d77be131751 100644 --- a/nixos/tests/kubernetes/base.nix +++ b/nixos/tests/kubernetes/base.nix @@ -1,6 +1,6 @@ { system ? builtins.currentSystem, config ? {}, - pkgs ? import ../.. { inherit system config; } + pkgs ? import ../../.. { inherit system config; } }: with import ../../lib/testing.nix { inherit system pkgs; }; diff --git a/nixos/tests/kubernetes/kubernetes-common.nix b/nixos/tests/kubernetes/kubernetes-common.nix index 125c176f1132..87c65b883659 100644 --- a/nixos/tests/kubernetes/kubernetes-common.nix +++ b/nixos/tests/kubernetes/kubernetes-common.nix @@ -3,7 +3,6 @@ with pkgs.lib; let base = { inherit roles; - featureGates = ["AllAlpha"]; flannel.enable = true; addons.dashboard.enable = true; diff --git a/nixos/tests/owncloud.nix b/nixos/tests/owncloud.nix deleted file mode 100644 index c968569f2008..000000000000 --- a/nixos/tests/owncloud.nix +++ /dev/null @@ -1,39 +0,0 @@ -import ./make-test.nix ({ ... }: - -{ - name = "owncloud"; - nodes = - { web = - { ... }: - { - services.postgresql.enable = true; - services.httpd = { - enable = true; - logPerVirtualHost = true; - adminAddr = "example@example.com"; - virtualHosts = [ - { - hostName = "owncloud"; - extraSubservices = - [ - { - serviceType = "owncloud"; - adminPassword = "secret"; - dbPassword = "secret"; - } - ]; - } - ]; - }; - }; - }; - - testScript = '' - startAll; - - $web->waitForUnit("postgresql"); - $web->waitForUnit("httpd"); - - $web->succeed("curl -L 127.0.0.1:80"); - ''; -}) diff --git a/nixos/tests/slurm.nix b/nixos/tests/slurm.nix index 7f9c266cbff6..b4458d8d0954 100644 --- a/nixos/tests/slurm.nix +++ b/nixos/tests/slurm.nix @@ -63,6 +63,12 @@ in { ensurePermissions = { "slurm_acct_db.*" = "ALL PRIVILEGES"; }; name = "slurm"; }]; + extraOptions = '' + # recommendations from: https://slurm.schedmd.com/accounting.html#mysql-configuration + innodb_buffer_pool_size=1024M + innodb_log_file_size=64M + innodb_lock_wait_timeout=900 + ''; }; }; @@ -95,6 +101,7 @@ in { subtest "can_start_slurmdbd", sub { $dbd->succeed("systemctl restart slurmdbd"); $dbd->waitForUnit("slurmdbd.service"); + $dbd->waitForOpenPort(6819); }; # there needs to be an entry for the current diff --git a/nixos/tests/systemd.nix b/nixos/tests/systemd.nix index 65aa553b3148..4d470126abee 100644 --- a/nixos/tests/systemd.nix +++ b/nixos/tests/systemd.nix @@ -56,6 +56,11 @@ import ./make-test.nix { $machine->succeed('test -z $(ls -1 /var/log/journal)'); }; + # Regression test for https://github.com/NixOS/nixpkgs/issues/50273 + subtest "DynamicUser actually allocates a user", sub { + $machine->succeed('systemd-run --pty --property=Type=oneshot --property=DynamicUser=yes --property=User=iamatest whoami | grep iamatest'); + }; + # Regression test for https://github.com/NixOS/nixpkgs/issues/35268 subtest "file system with x-initrd.mount is not unmounted", sub { $machine->shutdown; diff --git a/nixos/tests/xmonad.nix b/nixos/tests/xmonad.nix index 61fa7c1a67d3..6d6db6b0ea97 100644 --- a/nixos/tests/xmonad.nix +++ b/nixos/tests/xmonad.nix @@ -22,7 +22,7 @@ import ./make-test.nix ({ pkgs, ...} : { $machine->waitUntilSucceeds("xmonad --restart"); $machine->sleep(3); $machine->sendKeys("alt-shift-ret"); - $machine->waitForWindow(qr/machine.*alice/); + $machine->waitForWindow(qr/alice.*machine/); $machine->sleep(1); $machine->screenshot("terminal"); ''; |