diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2016-09-30 21:24:18 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2016-09-30 21:24:18 +0200 |
commit | 328c2f00819d01933e6cb0aad1c5052d2fab86ea (patch) | |
tree | c1e9b49c715867f346ffcff18a03458ed9da3035 /nixos/tests/samba.nix | |
parent | e993506d4c3d580495087c85c901d54908e445a0 (diff) |
Add a simple test for Samba
Diffstat (limited to 'nixos/tests/samba.nix')
-rw-r--r-- | nixos/tests/samba.nix | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/nixos/tests/samba.nix b/nixos/tests/samba.nix new file mode 100644 index 0000000000000..d6658ef0400b4 --- /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 ]]"); + ''; +}) |