about summary refs log tree commit diff
path: root/modules/profiles
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-12-11 10:04:59 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-12-11 10:04:59 +0100
commit3aa30bc04846bd09095db2c043f8cd5e5c15876f (patch)
tree5b3b1287ec0f2e8aa0050f658f589f2d5bee5e97 /modules/profiles
parent6208b248894c070109d777652141eb1795170067 (diff)
profiles/tests: Add most of the NixOS tests.
I've added all tests that are not related to packages in
environment.systemPackages or are otherwise tricky to include or to
distinguish (for example NFSv3 vs. NFSv4).

So we now should have a pretty good test coverage for all of our
machines.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules/profiles')
-rw-r--r--modules/profiles/tests.nix223
1 files changed, 217 insertions, 6 deletions
diff --git a/modules/profiles/tests.nix b/modules/profiles/tests.nix
index c1d39d40..6a7acc88 100644
--- a/modules/profiles/tests.nix
+++ b/modules/profiles/tests.nix
@@ -3,9 +3,222 @@
 with lib;
 
 let
-  which = if config.networking.useNetworkd then "networkd" else "scripted";
-  networkTests = map (name: ["nixos" "networking" which name]) [
-    "static" "dhcpSimple" "dhcpOneIf" "bond" "bridge" "macvlan" "sit" "vlan"
+  whichNet = if config.networking.useNetworkd then "networkd" else "scripted";
+
+  mkTest = attrs: if attrs.check then attrs.paths or [ attrs.path ] else [];
+
+  upstreamTests = concatMap mkTest [
+    { check = config.services.avahi.enable;
+      path  = ["nixos" "avahi"];
+    }
+    { check = config.vuizvui.createISO;
+      paths = [
+        ["nixos" "bootBiosCdrom"]
+        ["nixos" "bootBiosUsb"]
+        ["nixos" "bootUefiCdrom"]
+        ["nixos" "bootUefiUsb"]
+      ];
+    }
+    { check = config.services.cadvisor.enable;
+      path  = ["nixos" "cadvisor"];
+    }
+    { check = config.services.cjdns.enable;
+      path  = ["nixos" "cjdns"];
+    }
+    { check = config.containers != {};
+      path  = ["nixos" "containers"];
+    }
+    { check = config.virtualisation.docker.enable;
+      path  = ["nixos" "docker"];
+    }
+    { check = config.services.dockerRegistry.enable;
+      path  = ["nixos" "dockerRegistry"];
+    }
+    { check = config.services.etcd.enable;
+      path  = ["nixos" "etcd"];
+    }
+    { check = config.networking.firewall.enable;
+      path  = ["nixos" "firewall"];
+    }
+    { check = config.services.fleet.enable;
+      path  = ["nixos" "fleet"];
+    }
+    { check = config.services.xserver.desktopManager.gnome3.enable;
+      path  = ["nixos" "gnome3"];
+    }
+    { check = config.services.xserver.displayManager.gdm.enable;
+      path  = ["nixos" "gnome3-gdm"];
+    }
+    { check = config.services.xserver.windowManager.i3.enable;
+      path  = ["nixos" "i3wm"];
+    }
+    { check = elem "btrfs" config.boot.supportedFilesystems;
+      paths = [
+        ["nixos" "installer" "btrfsSimple"]
+        ["nixos" "installer" "btrfsSubvols"]
+        ["nixos" "installer" "btrfsSubvolDefault"]
+      ];
+    }
+    { check = config.boot.loader.grub.version == 1;
+      path  = ["nixos" "installer" "grub1"];
+    }
+    { check = config.boot.initrd.luks.devices != [];
+      path  = ["nixos" "installer" "luksroot"];
+    }
+    { check = true;
+      path  = ["nixos" "installer" "lvm"];
+    }
+    { check = config.fileSystems ? "/boot";
+      path  = ["nixos" "installer" "separateBoot"];
+    }
+    { check = config.fileSystems ? "/boot"
+           && config.fileSystems."/boot".fsType == "vfat";
+      path  = ["nixos" "installer" "separateBootFat"];
+    }
+    { check = elem "ext3" config.boot.supportedFilesystems;
+      path  = ["nixos" "installer" "simple"];
+    }
+    { check = config.boot.loader.grub.fsIdentifier == "label";
+      path  = ["nixos" "installer" "simpleLabels"];
+    }
+    { check = config.boot.loader.grub.fsIdentifier == "provided";
+      path  = ["nixos" "installer" "simpleProvided"];
+    }
+    { check = config.boot.initrd.mdadmConf != "";
+      path  = ["nixos" "installer" "swraid"];
+    }
+    { check = config.services.influxdb.enable;
+      path  = ["nixos" "influxdb"];
+    }
+    { check = config.networking.enableIPv6;
+      path  = ["nixos" "ipv6"];
+    }
+    { check = config.services.jenkins.enable;
+      path  = ["nixos" "jenkins"];
+    }
+    { check = config.services.xserver.desktopManager.kde4.enable;
+      path  = ["nixos" "kde4"];
+    }
+    { check = with config.services.kubernetes; apiserver.enable
+           || scheduler.enable || controllerManager.enable || kubelet.enable
+           || proxy.enable;
+      path  = ["nixos" "kubernetes"];
+    }
+    { check = config.boot.kernelPackages == pkgs.linuxPackages_latest;
+      path  = ["nixos" "latestKernel" "login"];
+    }
+    { check = true;
+      path  = ["nixos" "login"];
+    }
+    { check = true;
+      path  = ["nixos" "misc"];
+    }
+    { check = config.services.murmur.enable;
+      path  = ["nixos" "mumble"];
+    }
+    { check = config.services.munin-node.enable
+           || config.services.munin-cron.enable;
+      path  = ["nixos" "munin"];
+    }
+    { check = config.services.mysql.enable;
+      path  = ["nixos" "mysql"];
+    }
+    { check = config.services.mysql.enable
+           && config.services.mysql.replication.role != "none";
+      path  = ["nixos" "mysqlReplication"];
+    }
+    { check = config.networking.nat.enable
+           && config.networking.firewall.enable;
+      path  = ["nixos" "nat" "firewall"];
+    }
+    { check = config.networking.nat.enable
+           && !config.networking.firewall.enable;
+      path  = ["nixos" "nat" "standalone"];
+    }
+    { check = config.networking.bonds != {};
+      path  = ["nixos" "networking" whichNet "bond"];
+    }
+    { check = config.networking.bridges != {};
+      path  = ["nixos" "networking" whichNet "bridge"];
+    }
+    { check = any (iface: iface.useDHCP) config.networking.interfaces;
+      path  = ["nixos" "networking" whichNet "dhcpOneIf"];
+    }
+    { check = config.networking.useDHCP;
+      path  = ["nixos" "networking" whichNet "dhcpSimple"];
+    }
+    { check = config.networking.macvlans != {};
+      path  = ["nixos" "networking" whichNet "macvlan"];
+    }
+    { check = config.networking.sits != {};
+      path  = ["nixos" "networking" whichNet "sit"];
+    }
+    { check = any (iface: iface.ip4 != []) config.networking.interfaces;
+      path  = ["nixos" "networking" whichNet "static"];
+    }
+    { check = config.networking.vlans != {};
+      path  = ["nixos" "networking" whichNet "vlan"];
+    }
+    { check = with config.networking.proxy; any (val: val != null)
+            [ default ftpProxy httpProxy httpsProxy noProxy rsyncProxy ];
+      path  = ["nixos" "networkingProxy"];
+    }
+    { check = elem "nfs" config.boot.supportedFilesystems;
+      paths = [
+        ["nixos" "nfs3"]
+        ["nixos" "nfs4"]
+      ];
+    }
+    { check = true;
+      path  = ["nixos" "nixosPinVersion"];
+    }
+    { check = config.services.nsd.enable;
+      path  = ["nixos" "nsd"];
+    }
+    { check = config.services.openssh.enable;
+      path  = ["nixos" "openssh"];
+    }
+    { check = config.services.panamax.enable;
+      path  = ["nixos" "panamax"];
+    }
+    { check = config.services.peerflix.enable;
+      path  = ["nixos" "peerflix"];
+    }
+    { check = config.services.printing.enable;
+      path  = ["nixos" "printing"];
+    }
+    { check = config.services.httpd.enable
+           && elem "proxy_balancer" config.services.httpd.extraModules;
+      path  = ["nixos" "proxy"];
+    }
+    { check = config.services.pumpio.enable;
+      path  = ["nixos" "pumpio"];
+    }
+    { check = config.hardware.opengl.driSupport
+           && services.xserver.enable;
+      path  = ["nixos" "quake3"];
+    }
+    { check = true;
+      path  = ["nixos" "runInMachine"];
+    }
+    { check = config.services.xserver.displayManager.sddm.enable;
+      path  = ["nixos" "sddm"];
+    }
+    { check = true;
+      path  = ["nixos" "simple"];
+    }
+    { check = config.services.tomcat.enable;
+      path  = ["nixos" "tomcat"];
+    }
+    { check = config.services.udisks2.enable;
+      path  = ["nixos" "udisks2"];
+    }
+    { check = config.virtualisation.virtualbox.host.enable;
+      path  = ["nixos" "virtualbox"];
+    }
+    { check = config.services.xserver.desktopManager.xfce.enable;
+      path  = ["nixos" "xfce"];
+    }
   ];
 
 in {
@@ -24,7 +237,5 @@ in {
     };
   };
 
-  config = {
-    vuizvui.requiresTests = networkTests;
-  };
+  config.vuizvui.requiresTests = upstreamTests;
 }