From 328c2f00819d01933e6cb0aad1c5052d2fab86ea Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 30 Sep 2016 21:24:18 +0200 Subject: Add a simple test for Samba --- nixos/release.nix | 1 + nixos/tests/samba.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 nixos/tests/samba.nix diff --git a/nixos/release.nix b/nixos/release.nix index 7fcff78f6b9..bff17da607f 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -284,6 +284,7 @@ in rec { tests.quagga = callTest tests/quagga.nix {}; tests.quake3 = callTest tests/quake3.nix {}; tests.runInMachine = callTest tests/run-in-machine.nix {}; + tests.samba = callTest tests/samba.nix {}; tests.sddm = callTest tests/sddm.nix {}; tests.simple = callTest tests/simple.nix {}; tests.smokeping = callTest tests/smokeping.nix {}; diff --git a/nixos/tests/samba.nix b/nixos/tests/samba.nix new file mode 100644 index 00000000000..d6658ef0400 --- /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 ]]"); + ''; +}) -- cgit 1.4.1