about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2024-02-28 23:48:57 +0100
committerRobert Hensing <robert@roberthensing.nl>2024-03-06 22:47:24 +0100
commit114af421c5a708a6dedf0c4f27f8bca0502267a8 (patch)
tree65b9e2e8c4182947b4945551e381661c000cd060
parent5a1285c2163173217d2adc5f56a4b7bd5234b714 (diff)
nixops_unstable_*: Test addAvailablePlugins and withPlugins commute
Actually the lack of instantiation is the main purpose, but it's nice
to test commutativity too. (Even if it's just one example...)
-rw-r--r--pkgs/applications/networking/cluster/nixops/default.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgs/applications/networking/cluster/nixops/default.nix b/pkgs/applications/networking/cluster/nixops/default.nix
index d3efd3ed24480..1e086bb5c571b 100644
--- a/pkgs/applications/networking/cluster/nixops/default.nix
+++ b/pkgs/applications/networking/cluster/nixops/default.nix
@@ -1,4 +1,4 @@
-{ lib, python3 }:
+{ lib, python3, emptyFile }:
 
 let
   inherit (lib) extends;
@@ -64,6 +64,13 @@ let
         nixos = this.rawPackage.tests.nixos.passthru.override {
           nixopsPkg = this.rawPackage;
         };
+        commutative_addAvailablePlugins_withPlugins =
+          assert
+            (this.public.addAvailablePlugins (self: super: { inherit emptyFile; })).withPlugins (ps: [ emptyFile ])
+            ==
+            # Note that this value proves that the package is not instantiated until the end, where it's valid again.
+            (this.public.withPlugins (ps: [ emptyFile ])).addAvailablePlugins (self: super: { inherit emptyFile; });
+          emptyFile;
       }
         # Make sure we also test with a configuration that's been extended with a plugin.
         // lib.optionalAttrs (this.selectedPlugins == [ ]) {