about summary refs log tree commit diff
path: root/nixos/tests/lldap.nix
blob: d6c3a865aa04a6841f603893c8ea5fc818bdef74 (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
import ./make-test-python.nix ({ ... }: {
  name = "lldap";

  nodes.machine = { pkgs, ... }: {
    services.lldap = {
      enable = true;
      settings = {
        verbose = true;
        ldap_base_dn = "dc=example,dc=com";
      };
    };
    environment.systemPackages = [ pkgs.openldap ];
  };

  testScript = ''
    machine.wait_for_unit("lldap.service")
    machine.wait_for_open_port(3890)
    machine.wait_for_open_port(17170)

    machine.succeed("curl --location --fail http://localhost:17170/")

    print(
      machine.succeed('ldapsearch -H ldap://localhost:3890 -D uid=admin,ou=people,dc=example,dc=com -b "ou=people,dc=example,dc=com" -w password')
    )
  '';
})