summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-18 12:56:58 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-18 13:04:08 +0100
commit281a2401b269b4c080813143732409d1bac365f2 (patch)
treea46e93408e5c06d41c62a79911e1c63f64c3a62a
parent6b1057b452c55bb3b463f0d7055bc4ec3fd1f381 (diff)
downloadnixpkgs-281a2401b269b4c080813143732409d1bac365f2.tar
nixpkgs-281a2401b269b4c080813143732409d1bac365f2.tar.gz
nixpkgs-281a2401b269b4c080813143732409d1bac365f2.tar.bz2
nixpkgs-281a2401b269b4c080813143732409d1bac365f2.tar.lz
nixpkgs-281a2401b269b4c080813143732409d1bac365f2.tar.xz
nixpkgs-281a2401b269b4c080813143732409d1bac365f2.tar.zst
nixpkgs-281a2401b269b4c080813143732409d1bac365f2.zip
nixos/tests/openldap: make openldap test auto-callable
The NixOS manual documents that you can invoke every tests using

    nix-build path/to/nixos/tests/test.nix

which was not the case for openldap since it is not autocallable, but
requires pkgs and system as arguments. Usually, make-test-pythons.nix
takes care of this if it is imported at the top-level, but since
openldap.nix contains multiple tests, this was not the case.

This is however easily fixed by:

* Adding default values for the pkgs and system arguments based on the
  definition in make-test-python.nix
* Passing pkgs and system explicitly to make-test-python.nix to ensure
  the pkgs and system values passed from all-tests.nix are used.
-rw-r--r--nixos/tests/openldap.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/nixos/tests/openldap.nix b/nixos/tests/openldap.nix
index 392fae24346..f1a39ad7dde 100644
--- a/nixos/tests/openldap.nix
+++ b/nixos/tests/openldap.nix
@@ -1,4 +1,9 @@
-{ pkgs, system ? builtins.currentSystem, ... }: let
+{ pkgs ? (import ../.. { inherit system; config = { }; })
+, system ? builtins.currentSystem
+, ...
+}:
+
+let
   dbContents = ''
     dn: dc=example
     objectClass: domain
@@ -16,7 +21,7 @@
   '';
 in {
   # New-style configuration
-  current = import ./make-test-python.nix {
+  current = import ./make-test-python.nix ({ pkgs, ... }: {
     inherit testScript;
     name = "openldap";
 
@@ -53,10 +58,10 @@ in {
         declarativeContents."dc=example" = dbContents;
       };
     };
-  };
+  }) { inherit pkgs system; };
 
   # Old-style configuration
-  oldOptions = import ./make-test-python.nix {
+  oldOptions = import ./make-test-python.nix ({ pkgs, ... }: {
     inherit testScript;
     name = "openldap";
 
@@ -72,10 +77,10 @@ in {
         declarativeContents."dc=example" = dbContents;
       };
     };
-  };
+  }) { inherit system pkgs; };
 
   # Manually managed configDir, for example if dynamic config is essential
-  manualConfigDir = import ./make-test-python.nix {
+  manualConfigDir = import ./make-test-python.nix ({ pkgs, ... }: {
     name = "openldap";
 
     machine = { pkgs, ... }: {
@@ -121,5 +126,5 @@ in {
           "systemctl restart openldap",
       )
     '' + testScript;
-  };
+  }) { inherit system pkgs; };
 }