From 5eb2e64d80c621e4f7bb6ee00518ca1cb3170128 Mon Sep 17 00:00:00 2001 From: IndeedNotJames Date: Thu, 27 Apr 2023 15:26:57 +0200 Subject: [PATCH] nixosTests.lldap: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/lldap.nix | 26 ++++++++++++++++++++++++++ pkgs/servers/ldap/lldap/default.nix | 5 +++++ 3 files changed, 32 insertions(+) create mode 100644 nixos/tests/lldap.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 715fe7e51e0f2..29f1b76b3d26c 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -379,6 +379,7 @@ in { limesurvey = handleTest ./limesurvey.nix {}; listmonk = handleTest ./listmonk.nix {}; litestream = handleTest ./litestream.nix {}; + lldap = handleTest ./lldap.nix {}; locate = handleTest ./locate.nix {}; login = handleTest ./login.nix {}; logrotate = handleTest ./logrotate.nix {}; diff --git a/nixos/tests/lldap.nix b/nixos/tests/lldap.nix new file mode 100644 index 0000000000000..d6c3a865aa04a --- /dev/null +++ b/nixos/tests/lldap.nix @@ -0,0 +1,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') + ) + ''; +}) diff --git a/pkgs/servers/ldap/lldap/default.nix b/pkgs/servers/ldap/lldap/default.nix index c843378bdf5bb..50249e9dbe45a 100644 --- a/pkgs/servers/ldap/lldap/default.nix +++ b/pkgs/servers/ldap/lldap/default.nix @@ -2,6 +2,7 @@ , fetchzip , lib , lldap +, nixosTests , rustPlatform }: @@ -52,6 +53,10 @@ rustPlatform.buildRustPackage rec { substituteInPlace server/src/infra/tcp_server.rs --subst-var-by frontend '${frontend}' ''; + passthru.tests = { + inherit (nixosTests) lldap; + }; + meta = with lib; { description = "A lightweight authentication server that provides an opinionated, simplified LDAP interface for authentication"; homepage = "https://github.com/lldap/lldap";