summary refs log tree commit diff
path: root/nixos/tests/misc.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-29 15:29:52 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-29 15:34:55 +0200
commit501d532188bcabe5c1684880779ee62c31520f15 (patch)
treeb8a7c6123607ed5f18df4512788d91e24d725b0f /nixos/tests/misc.nix
parent7fb22dd5a0c11066c77e5309f0fe413659759641 (diff)
downloadnixpkgs-501d532188bcabe5c1684880779ee62c31520f15.tar
nixpkgs-501d532188bcabe5c1684880779ee62c31520f15.tar.gz
nixpkgs-501d532188bcabe5c1684880779ee62c31520f15.tar.bz2
nixpkgs-501d532188bcabe5c1684880779ee62c31520f15.tar.lz
nixpkgs-501d532188bcabe5c1684880779ee62c31520f15.tar.xz
nixpkgs-501d532188bcabe5c1684880779ee62c31520f15.tar.zst
nixpkgs-501d532188bcabe5c1684880779ee62c31520f15.zip
Add a test for automounting
Diffstat (limited to 'nixos/tests/misc.nix')
-rw-r--r--nixos/tests/misc.nix26
1 files changed, 22 insertions, 4 deletions
diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix
index 705ea0d0b86..e33581b4d2d 100644
--- a/nixos/tests/misc.nix
+++ b/nixos/tests/misc.nix
@@ -3,12 +3,23 @@
 import ./make-test.nix {
 
   machine =
-    { config, pkgs, ... }:
-    { swapDevices = pkgs.lib.mkOverride 0
+    { config, lib, pkgs, ... }:
+    with lib;
+    { swapDevices = mkOverride 0
         [ { device = "/root/swapfile"; size = 128; } ];
-      environment.variables.EDITOR = pkgs.lib.mkOverride 0 "emacs";
-      services.nixosManual.enable = pkgs.lib.mkOverride 0 true;
+      environment.variables.EDITOR = mkOverride 0 "emacs";
+      services.nixosManual.enable = mkOverride 0 true;
       systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ];
+      fileSystems = mkVMOverride { "/tmp2" =
+        { device = "none";
+          fsType = "tmpfs";
+          options = "mode=1777,noauto";
+        };
+      };
+      systemd.automounts = singleton
+        { wantedBy = [ "multi-user.target" ];
+          where = "/tmp2";
+        };
     };
 
   testScript =
@@ -80,6 +91,13 @@ import ./make-test.nix {
           $machine->succeed('systemctl start systemd-tmpfiles-clean');
           $machine->fail('[ -e /tmp/foo ]');
       };
+
+      # Test whether automounting works.
+      subtest "automount", sub {
+          $machine->fail("grep '/tmp2 tmpfs' /proc/mounts");
+          $machine->succeed("touch /tmp2/x");
+          $machine->succeed("grep '/tmp2 tmpfs' /proc/mounts");
+      };
     '';
 
 }