summary refs log tree commit diff
path: root/nixos/tests/nextcloud
diff options
context:
space:
mode:
authorBenjamin Koch <bbbsnowball@gmail.com>2021-03-11 02:56:11 +0100
committerBenjamin Koch <bbbsnowball@gmail.com>2021-03-11 02:56:11 +0100
commit1bd7941a6b19a410ed4b38eaff8bf88592f21457 (patch)
tree9ba127703ceb8c5ab1d42f40fa9c3a5e06568144 /nixos/tests/nextcloud
parentd83a43a396c7ec5ac2cd633262648306e25c6789 (diff)
downloadnixpkgs-1bd7941a6b19a410ed4b38eaff8bf88592f21457.tar
nixpkgs-1bd7941a6b19a410ed4b38eaff8bf88592f21457.tar.gz
nixpkgs-1bd7941a6b19a410ed4b38eaff8bf88592f21457.tar.bz2
nixpkgs-1bd7941a6b19a410ed4b38eaff8bf88592f21457.tar.lz
nixpkgs-1bd7941a6b19a410ed4b38eaff8bf88592f21457.tar.xz
nixpkgs-1bd7941a6b19a410ed4b38eaff8bf88592f21457.tar.zst
nixpkgs-1bd7941a6b19a410ed4b38eaff8bf88592f21457.zip
nixos/nextcloud: Use exportReferencesGraph for imagick test
Diffstat (limited to 'nixos/tests/nextcloud')
-rw-r--r--nixos/tests/nextcloud/basic.nix20
1 files changed, 11 insertions, 9 deletions
diff --git a/nixos/tests/nextcloud/basic.nix b/nixos/tests/nextcloud/basic.nix
index 5d31165208c..5074b6cdafe 100644
--- a/nixos/tests/nextcloud/basic.nix
+++ b/nixos/tests/nextcloud/basic.nix
@@ -54,7 +54,7 @@ in {
         { services.nextcloud.disableImagemagick = true; } ];
   };
 
-  testScript = let
+  testScript = { nodes, ... }: let
     withRcloneEnv = pkgs.writeScript "with-rclone-env" ''
       #!${pkgs.runtimeShell}
       export RCLONE_CONFIG_NEXTCLOUD_TYPE=webdav
@@ -73,7 +73,17 @@ in {
       #!${pkgs.runtimeShell}
       diff <(echo 'hi') <(${pkgs.rclone}/bin/rclone cat nextcloud:test-shared-file)
     '';
+
+    findInClosure = what: drv: pkgs.runCommand "find-in-closure" { exportReferencesGraph = [ "graph" drv ]; inherit what; } ''
+      test -e graph
+      grep "$what" graph >$out || true
+    '';
+    nextcloudUsesImagick = findInClosure "imagick" nodes.nextcloud.config.system.build.vm;
+    nextcloudWithoutDoesntUseIt = findInClosure "imagick" nodes.nextcloudWithoutMagick.config.system.build.vm;
   in ''
+    assert open("${nextcloudUsesImagick}").read() != ""
+    assert open("${nextcloudWithoutDoesntUseIt}").read() == ""
+
     nextcloud.start()
     client.start()
     nextcloud.wait_for_unit("multi-user.target")
@@ -88,13 +98,5 @@ in {
         "${withRcloneEnv} ${diffSharedFile}"
     )
     assert "hi" in client.succeed("cat /mnt/dav/test-shared-file")
-
-    #client.succeed("nix path-info -r " + nextcloud.script + " | grep imagick")
-    #client.fail("nix path-info -r " + nextcloudWithoutMagick.script + " | grep imagick")
-    assert os.system("nix path-info -r " + nextcloud.script + " | grep imagick") == 0
-    assert (
-        os.system("nix path-info -r " + nextcloudWithoutMagick.script + " | grep imagick")
-        != 0
-    )
   '';
 })