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

  machine = { pkgs, ... }: {
    services.openldap = {
      enable = true;
      suffix = "dc=example";
      rootdn = "cn=root,dc=example";
      rootpw = "notapassword";
      database = "bdb";
      extraDatabaseConfig = ''
        directory /var/db/openldap
      '';
      declarativeContents = ''
        dn: dc=example
        objectClass: domain
        dc: example

        dn: ou=users,dc=example
        objectClass: organizationalUnit
        ou: users
      '';
    };
  };

  testScript = ''
    machine.wait_for_unit("openldap.service")
    machine.succeed(
        "systemctl status openldap.service",
        'ldapsearch -LLL -D "cn=root,dc=example" -w notapassword -b "dc=example"',
    )
  '';
}