notes: 2.3.0 -> 2.3.1 (#352950)
[NixPkgs.git] / nixos / tests / samba.nix
blob2501fea2d37688f78c11093b5ba9cfb4b3117e61
1 import ./make-test-python.nix ({ pkgs, lib, ... }: {
2   name = "samba";
4   meta.maintainers = [ lib.maintainers.anthonyroussel ];
6   nodes = {
7     client =
8       { ... }:
9       {
10         virtualisation.fileSystems = {
11           "/public" = {
12             fsType = "cifs";
13             device = "//server/public";
14             options = [ "guest" ];
15           };
16         };
17       };
19     server =
20       { ... }:
21       {
22         services.samba = {
23           enable = true;
24           openFirewall = true;
25           settings = {
26             "public" = {
27               "path" = "/public";
28               "read only" = true;
29               "browseable" = "yes";
30               "guest ok" = "yes";
31               "comment" = "Public samba share.";
32             };
33           };
34         };
35       };
36   };
38   testScript = ''
39     server.start()
40     server.wait_for_unit("samba.target")
41     server.succeed("mkdir -p /public; echo bar > /public/foo")
43     client.start()
44     client.wait_for_unit("remote-fs.target")
45     client.succeed("[[ $(cat /public/foo) = bar ]]")
46   '';