summary refs log tree commit diff
path: root/nixos/tests/openldap.nix
blob: 3ef90e18347965f0e6c714998c2468fc39b5c42e (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
import ./make-test.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->waitForUnit('openldap.service');
    $machine->succeed('systemctl status openldap.service');
    $machine->succeed('ldapsearch -LLL -D "cn=root,dc=example" -w notapassword -b "dc=example"');
  '';
}