about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2016-10-02 10:36:47 +0300
committerTuomas Tynkkynen <tuomas@tuxera.com>2016-10-02 10:36:47 +0300
commit19225bf5cc546b1608eea3f1770f1ee1110c14c8 (patch)
treee95881d505d9cf1f309f8e6b2fbee40496f550cd /nixos/tests
parent97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7 (diff)
parenta387a5d870c306220d6dfd06160bddde8532422d (diff)
downloadnixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.gz
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.bz2
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.lz
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.xz
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.tar.zst
nixlib-19225bf5cc546b1608eea3f1770f1ee1110c14c8.zip
Merge remote-tracking branch 'upstream/master' into staging
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/flannel.nix55
-rw-r--r--nixos/tests/logstash.nix2
-rw-r--r--nixos/tests/samba.nix48
3 files changed, 103 insertions, 2 deletions
diff --git a/nixos/tests/flannel.nix b/nixos/tests/flannel.nix
new file mode 100644
index 000000000000..7f27903a3026
--- /dev/null
+++ b/nixos/tests/flannel.nix
@@ -0,0 +1,55 @@
+import ./make-test.nix ({ pkgs, ...} : rec {
+  name = "flannel";
+
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ offline ];
+  };
+
+  nodes = let
+    flannelConfig = {
+      services.flannel = {
+        enable = true;
+        network = "10.1.0.0/16";
+        iface = "eth1";
+        etcd.endpoints = ["http://etcd:2379"];
+      };
+
+      networking.firewall.allowedUDPPorts = [ 8472 ];
+    };
+  in {
+    etcd = { config, pkgs, ... }: {
+      services = {
+        etcd = {
+          enable = true;
+          listenClientUrls = ["http://etcd:2379"];
+          listenPeerUrls = ["http://etcd:2380"];
+          initialAdvertisePeerUrls = ["http://etcd:2379"];
+          initialCluster = ["etcd=http://etcd:2379"];
+        };
+      };
+
+      networking.firewall.allowedTCPPorts = [ 2379 ];
+    };
+
+    node1 = { config, ... }: {
+      require = [flannelConfig];
+    };
+
+    node2 = { config, ... }: {
+      require = [flannelConfig];
+    };
+  };
+
+  testScript = ''
+    startAll;
+
+    $node1->waitForUnit("flannel.service");
+    $node2->waitForUnit("flannel.service");
+
+    my $ip1 = $node1->succeed("ip -4 addr show flannel.1 | grep -oP '(?<=inet).*(?=/)'");
+    my $ip2 = $node2->succeed("ip -4 addr show flannel.1 | grep -oP '(?<=inet).*(?=/)'");
+
+    $node1->waitUntilSucceeds("ping -c 1 $ip2");
+    $node2->waitUntilSucceeds("ping -c 1 $ip1");
+  '';
+})
diff --git a/nixos/tests/logstash.nix b/nixos/tests/logstash.nix
index edece352cafe..01f6a0358b2e 100644
--- a/nixos/tests/logstash.nix
+++ b/nixos/tests/logstash.nix
@@ -25,7 +25,6 @@ import ./make-test.nix ({ pkgs, ...} : {
               '';
               outputConfig = ''
                 stdout { codec => rubydebug }
-                elasticsearch { embedded => true }
               '';
             };
           };
@@ -38,6 +37,5 @@ import ./make-test.nix ({ pkgs, ...} : {
     $one->waitForUnit("logstash.service");
     $one->waitUntilSucceeds("journalctl -n 20 _SYSTEMD_UNIT=logstash.service | grep flowers");
     $one->fail("journalctl -n 20 _SYSTEMD_UNIT=logstash.service | grep dragons");
-    $one->waitUntilSucceeds("curl -s http://127.0.0.1:9200/_status?pretty=true | grep logstash");
   '';
 })
diff --git a/nixos/tests/samba.nix b/nixos/tests/samba.nix
new file mode 100644
index 000000000000..d6658ef0400b
--- /dev/null
+++ b/nixos/tests/samba.nix
@@ -0,0 +1,48 @@
+import ./make-test.nix ({ pkgs, ... }:
+
+{
+  name = "samba";
+
+  meta.maintainers = [ pkgs.lib.maintainers.eelco ];
+
+  nodes =
+    { client =
+        { config, pkgs, ... }:
+        { fileSystems = pkgs.lib.mkVMOverride
+            { "/public" = {
+                fsType = "cifs";
+                device = "//server/public";
+                options = [ "guest" ];
+              };
+            };
+        };
+
+      server =
+        { config, pkgs, ... }:
+        { services.samba.enable = true;
+          services.samba.shares.public =
+            { path = "/public";
+              "read only" = true;
+              browseable = "yes";
+              "guest ok" = "yes";
+              comment = "Public samba share.";
+            };
+          networking.firewall.allowedTCPPorts = [ 139 445 ];
+          networking.firewall.allowedUDPPorts = [ 137 138 ];
+        };
+    };
+
+  # client# [    4.542997] mount[777]: sh: systemd-ask-password: command not found
+
+  testScript =
+    ''
+      $server->start;
+      $server->waitForUnit("samba-smbd");
+      $server->waitForUnit("samba-nmbd");
+      $server->succeed("mkdir -p /public; echo bar > /public/foo");
+
+      $client->start;
+      $client->waitForUnit("network.target");
+      $client->succeed("[[ \$(cat /public/foo) = bar ]]");
+    '';
+})