about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/default.nix3
-rw-r--r--nixos/tests/installer.nix5
-rw-r--r--nixos/tests/mumble.nix54
-rw-r--r--nixos/tests/rabbitmq.nix18
-rw-r--r--nixos/tests/udisks.nix56
5 files changed, 133 insertions, 3 deletions
diff --git a/nixos/tests/default.nix b/nixos/tests/default.nix
index 20deed2a2492..d2eb6a999628 100644
--- a/nixos/tests/default.nix
+++ b/nixos/tests/default.nix
@@ -26,6 +26,7 @@ with import ../lib/testing.nix { inherit system minimal; };
   mysql = makeTest (import ./mysql.nix);
   mysql_replication = makeTest (import ./mysql-replication.nix);
   munin = makeTest (import ./munin.nix);
+  mumble = makeTest (import ./mumble.nix);
   nat = makeTest (import ./nat.nix);
   nfs3 = makeTest (import ./nfs.nix { version = 3; });
   #nfs4 = makeTest (import ./nfs.nix { version = 4; });
@@ -34,9 +35,11 @@ with import ../lib/testing.nix { inherit system minimal; };
   printing = makeTest (import ./printing.nix);
   proxy = makeTest (import ./proxy.nix);
   quake3 = makeTest (import ./quake3.nix);
+  rabbitmq = makeTest (import ./rabbitmq.nix);
   simple = makeTest (import ./simple.nix);
   #subversion = makeTest (import ./subversion.nix);
   tomcat = makeTest (import ./tomcat.nix);
+  udisks = makeTest (import ./udisks.nix);
   #trac = makeTest (import ./trac.nix);
   xfce = makeTest (import ./xfce.nix);
   runInMachine.test = import ./run-in-machine.nix { inherit system; };
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index b32012ea0347..151458fbd5ee 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -39,7 +39,7 @@ let
 
       { imports =
           [ ./hardware-configuration.nix
-            "''${modulesPath}/testing/test-instrumentation.nix"
+            <nixpkgs/nixos/modules/testing/test-instrumentation.nix>
           ];
 
         boot.loader.grub.version = ${toString grubVersion};
@@ -48,7 +48,6 @@ let
         ''}
         boot.loader.grub.device = "${grubDevice}";
         boot.loader.grub.extraConfig = "serial; terminal_output.serial";
-        boot.initrd.kernelModules = [ "virtio_console" ];
 
         environment.systemPackages = [ ${optionalString testChannel "pkgs.rlwrap"} ];
       }
@@ -177,7 +176,7 @@ let
       # Test nixos-option.
       $machine->succeed("nixos-option boot.initrd.kernelModules | grep virtio_console");
       $machine->succeed("nixos-option -d boot.initrd.kernelModules | grep 'List of modules'");
-      $machine->succeed("nixos-option -l boot.initrd.kernelModules | grep /etc/nixos/configuration.nix");
+      $machine->succeed("nixos-option -l boot.initrd.kernelModules | grep qemu-guest.nix");
 
       $machine->shutdown;
 
diff --git a/nixos/tests/mumble.nix b/nixos/tests/mumble.nix
new file mode 100644
index 000000000000..509742f2899b
--- /dev/null
+++ b/nixos/tests/mumble.nix
@@ -0,0 +1,54 @@
+{ pkgs, ... }:
+
+let
+  client = { config, pkgs, ... }: {
+    imports = [ ./common/x11.nix ];
+    environment.systemPackages = [ pkgs.mumble ];
+  };
+in
+{
+  nodes = {
+    server = { config, pkgs, ... }: {
+      services.murmur.enable       = true;
+      services.murmur.registerName = "NixOS tests";
+    };
+
+    client1 = client;
+    client2 = client;
+  };
+
+  testScript = ''
+    startAll;
+
+    $server->waitForUnit("murmur.service");
+    $client1->waitForX;
+    $client2->waitForX;
+
+    $client1->execute("mumble mumble://client1\@server/test &");
+    $client2->execute("mumble mumble://client2\@server/test &");
+
+    $server->sleep(10); # Wait for Mumble UI to pop up
+
+    # cancel client audio configuration
+    $client1->sendKeys("esc");
+    $client2->sendKeys("esc");
+    $server->sleep(1);
+
+    # cancel client cert configuration
+    $client1->sendKeys("esc");
+    $client2->sendKeys("esc");
+    $server->sleep(1);
+
+    # accept server certificate
+    $client1->sendChars("y");
+    $client2->sendChars("y");
+
+    # Find clients in logs
+    $server->waitUntilSucceeds("grep -q 'client1' /var/log/murmur/murmurd.log");
+    $server->waitUntilSucceeds("grep -q 'client2' /var/log/murmur/murmurd.log");
+
+    $server->sleep(5); # wait to get screenshot
+    $client1->screenshot("screen1");
+    $client2->screenshot("screen2");
+  '';
+}
diff --git a/nixos/tests/rabbitmq.nix b/nixos/tests/rabbitmq.nix
new file mode 100644
index 000000000000..271661f06820
--- /dev/null
+++ b/nixos/tests/rabbitmq.nix
@@ -0,0 +1,18 @@
+{ pkgs, ... }:
+
+# This test runs rabbitmq and checks if rabbitmq is up and running
+
+{
+  nodes = {
+    one = { config, pkgs, ... }: {
+      services.rabbitmq.enable = true;
+    };
+  };
+
+  testScript = ''
+    startAll;
+  
+    $one->waitForUnit("rabbitmq.service");
+    $one->waitUntilSucceeds("su -s ${pkgs.stdenv.shell} rabbitmq -c \"rabbitmqctl status\"");
+  '';
+}
diff --git a/nixos/tests/udisks.nix b/nixos/tests/udisks.nix
new file mode 100644
index 000000000000..e3e3f740d07b
--- /dev/null
+++ b/nixos/tests/udisks.nix
@@ -0,0 +1,56 @@
+{ pkgs, ... }:
+
+let
+
+  stick = pkgs.fetchurl {
+    url = http://nixos.org/~eelco/nix/udisks-test.img.xz;
+    sha256 = "0was1xgjkjad91nipzclaz5biv3m4b2nk029ga6nk7iklwi19l8b";
+  };
+
+in
+
+{
+
+  machine =
+    { config, pkgs, ... }:
+    { services.udisks.enable = true;
+      imports = [ ./common/user-account.nix ];
+
+      security.polkit.extraConfig =
+        ''
+          polkit.addRule(function(action, subject) {
+            if (subject.user == "alice") return "yes";
+          });
+        '';
+    };
+
+  testScript =
+    ''
+      my $stick = $machine->stateDir . "/usbstick.img";
+      system("xz -d < ${stick} > $stick") == 0 or die;
+
+      $machine->succeed("udisks --enumerate | grep /org/freedesktop/UDisks/devices/vda");
+      $machine->fail("udisks --enumerate | grep /org/freedesktop/UDisks/devices/sda1");
+
+      # Attach a USB stick and wait for it to show up.
+      $machine->sendMonitorCommand("usb_add disk:$stick");
+      $machine->waitUntilSucceeds("udisks --enumerate | grep /org/freedesktop/UDisks/devices/sda1");
+      $machine->succeed("udisks --show-info /dev/sda1 | grep 'label:.*USBSTICK'");
+
+      # Mount the stick as a non-root user and do some stuff with it.
+      $machine->succeed("su - alice -c 'udisks --enumerate | grep /org/freedesktop/UDisks/devices/sda1'");
+      $machine->succeed("su - alice -c 'udisks --mount /dev/sda1'");
+      $machine->succeed("su - alice -c 'cat /media/USBSTICK/test.txt'") =~ /Hello World/;
+      $machine->succeed("su - alice -c 'echo foo > /media/USBSTICK/bar.txt'");
+
+      # Unmounting the stick should make the mountpoint disappear.
+      $machine->succeed("su - alice -c 'udisks --unmount /dev/sda1'");
+      $machine->fail("[ -d /media/USBSTICK ]");
+
+      # Remove the USB stick.
+      $machine->sendMonitorCommand("usb_del 0.3"); # FIXME
+      $machine->waitUntilFails("udisks --enumerate | grep /org/freedesktop/UDisks/devices/sda1");
+      $machine->fail("[ -e /dev/sda ]");
+    '';
+
+}
\ No newline at end of file