summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Steinbach <tim@nequissimus.com>2017-09-05 19:05:37 -0400
committerTim Steinbach <tim@nequissimus.com>2017-09-05 19:05:37 -0400
commitb4ccef2163d07e5f35bc802c357d2d2167409a3a (patch)
tree21c8c154be6c1732b41ce4fd460551ed9f98931d
parent3e2975e892527fe45e4f574401cb7d19eb9542a6 (diff)
downloadnixpkgs-b4ccef2163d07e5f35bc802c357d2d2167409a3a.tar
nixpkgs-b4ccef2163d07e5f35bc802c357d2d2167409a3a.tar.gz
nixpkgs-b4ccef2163d07e5f35bc802c357d2d2167409a3a.tar.bz2
nixpkgs-b4ccef2163d07e5f35bc802c357d2d2167409a3a.tar.lz
nixpkgs-b4ccef2163d07e5f35bc802c357d2d2167409a3a.tar.xz
nixpkgs-b4ccef2163d07e5f35bc802c357d2d2167409a3a.tar.zst
nixpkgs-b4ccef2163d07e5f35bc802c357d2d2167409a3a.zip
tests: Add environment
-rw-r--r--nixos/release-combined.nix1
-rw-r--r--nixos/release.nix1
-rw-r--r--nixos/tests/env.nix35
3 files changed, 37 insertions, 0 deletions
diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index f820c040801..4cc140ebb15 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -82,6 +82,7 @@ in rec {
         (all nixos.tests.boot-stage1)
         nixos.tests.hibernate.x86_64-linux # i686 is flaky, see #23107
         (all nixos.tests.ecryptfs)
+        (all nixos.tests.env)
         (all nixos.tests.ipv6)
         (all nixos.tests.i3wm)
         (all nixos.tests.keymap.azerty)
diff --git a/nixos/release.nix b/nixos/release.nix
index 6348c2f15d4..bad9cfe6c7e 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -240,6 +240,7 @@ in rec {
   tests.ec2-nixops = hydraJob (import tests/ec2.nix { system = "x86_64-linux"; }).boot-ec2-nixops;
   tests.ec2-config = hydraJob (import tests/ec2.nix { system = "x86_64-linux"; }).boot-ec2-config;
   tests.elk = callTest tests/elk.nix {};
+  tests.env = callTest tests/env.nix {};
   tests.ferm = callTest tests/ferm.nix {};
   tests.firefox = callTest tests/firefox.nix {};
   tests.firewall = callTest tests/firewall.nix {};
diff --git a/nixos/tests/env.nix b/nixos/tests/env.nix
new file mode 100644
index 00000000000..c6b0424e97b
--- /dev/null
+++ b/nixos/tests/env.nix
@@ -0,0 +1,35 @@
+import ./make-test.nix ({ pkgs, ...} : {
+  name = "environment";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ nequissimus ];
+  };
+
+  machine = { config, lib, pkgs, ... }:
+    {
+      boot.kernelPackages = pkgs.linuxPackages;
+      environment.etc."plainFile".text = ''
+        Hello World
+      '';
+      environment.etc."folder/with/file".text = ''
+        Foo Bar!
+      '';
+
+      environment.sessionVariables = {
+        TERMINFO_DIRS = "/run/current-system/sw/share/terminfo";
+        NIXCON = "awesome";
+      };
+    };
+
+  testScript =
+    ''
+      $machine->succeed('[ -L "/etc/plainFile" ]');
+      $machine->succeed('cat "/etc/plainFile" | grep "Hello World"');
+      $machine->succeed('[ -d "/etc/folder" ]');
+      $machine->succeed('[ -d "/etc/folder/with" ]');
+      $machine->succeed('[ -L "/etc/folder/with/file" ]');
+      $machine->succeed('cat "/etc/plainFile" | grep "Hello World"');
+
+      $machine->succeed('echo ''${TERMINFO_DIRS} | grep "/run/current-system/sw/share/terminfo"');
+      $machine->succeed('echo ''${NIXCON} | grep "awesome"');
+    '';
+})