about summary refs log tree commit diff
path: root/nixos/tests/samba-wsdd.nix
blob: 0e3185b0c6849ced8c41fbfc762ebe351727a390 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import ./make-test-python.nix ({ pkgs, ... }:

{
  name = "samba-wsdd";
  meta.maintainers = with pkgs.lib.maintainers; [ izorkin ];

  nodes = {
    client_wsdd = { pkgs, ... }: {
      services.samba-wsdd = {
        enable = true;
        interface = "eth1";
        workgroup = "WORKGROUP";
        hostname = "CLIENT-WSDD";
        discovery = true;
        extraOptions = [ "--no-host" ];
      };
      networking.firewall.allowedTCPPorts = [ 5357 ];
      networking.firewall.allowedUDPPorts = [ 3702 ];
    };

    server_wsdd = { ... }: {
      services.samba-wsdd = {
        enable = true;
        interface = "eth1";
        workgroup = "WORKGROUP";
        hostname = "SERVER-WSDD";
      };
      networking.firewall.allowedTCPPorts = [ 5357 ];
      networking.firewall.allowedUDPPorts = [ 3702 ];
    };
  };

  testScript = ''
    client_wsdd.start()
    client_wsdd.wait_for_unit("samba-wsdd")

    server_wsdd.start()
    server_wsdd.wait_for_unit("samba-wsdd")

    client_wsdd.wait_until_succeeds(
        "echo list | ${pkgs.libressl.nc}/bin/nc -N -U /run/wsdd/wsdd.sock | grep -i SERVER-WSDD"
    )
  '';
})