diff options
author | Erik Arvstedt <erik.arvstedt@gmail.com> | 2022-04-11 17:06:02 +0200 |
---|---|---|
committer | Erik Arvstedt <erik.arvstedt@gmail.com> | 2022-04-11 22:46:43 +0200 |
commit | 308c4bf0f7caaf59a42a9092d0e3a889490c7902 (patch) | |
tree | 1d31eb0b5007c374e32e5848b2132140424f54b2 /nixos | |
parent | 99f40c2c13e48dc9c22221462d4d8b06d0930790 (diff) | |
download | nixpkgs-308c4bf0f7caaf59a42a9092d0e3a889490c7902.tar nixpkgs-308c4bf0f7caaf59a42a9092d0e3a889490c7902.tar.gz nixpkgs-308c4bf0f7caaf59a42a9092d0e3a889490c7902.tar.bz2 nixpkgs-308c4bf0f7caaf59a42a9092d0e3a889490c7902.tar.lz nixpkgs-308c4bf0f7caaf59a42a9092d0e3a889490c7902.tar.xz nixpkgs-308c4bf0f7caaf59a42a9092d0e3a889490c7902.tar.zst nixpkgs-308c4bf0f7caaf59a42a9092d0e3a889490c7902.zip |
nixos/paperless-ng: minor improvments
Service: - Fix misleading comment: We could in fact implement password copying as a preStart script by amending BindReadOnlyPaths, but adding an extra service is simpler. Test: - Add more detailed subtest names - Simplify date check
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/misc/paperless-ng.nix | 4 | ||||
-rw-r--r-- | nixos/tests/paperless-ng.nix | 15 |
2 files changed, 8 insertions, 11 deletions
diff --git a/nixos/modules/services/misc/paperless-ng.nix b/nixos/modules/services/misc/paperless-ng.nix index 881fa93c04e..159aad3504b 100644 --- a/nixos/modules/services/misc/paperless-ng.nix +++ b/nixos/modules/services/misc/paperless-ng.nix @@ -248,9 +248,7 @@ in after = [ "redis-paperless-ng.service" ]; }; - # Password copying can't be implemented as a privileged preStart script - # in 'paperless-ng-server' because 'defaultServiceConfig' limits the filesystem - # paths accessible by the service. + # Reading the user-provided password file requires root access systemd.services.paperless-ng-copy-password = mkIf (cfg.passwordFile != null) { requiredBy = [ "paperless-ng-server.service" ]; before = [ "paperless-ng-server.service" ]; diff --git a/nixos/tests/paperless-ng.nix b/nixos/tests/paperless-ng.nix index 618eeec6b12..8e9e2880191 100644 --- a/nixos/tests/paperless-ng.nix +++ b/nixos/tests/paperless-ng.nix @@ -11,9 +11,11 @@ import ./make-test-python.nix ({ lib, ... }: { }; testScript = '' + import json + machine.wait_for_unit("paperless-ng-consumer.service") - with subtest("Create test doc"): + with subtest("Add a document via the file system"): machine.succeed( "convert -size 400x40 xc:white -font 'DejaVu-Sans' -pointsize 20 -fill black " "-annotate +5+20 'hello world 16-10-2005' /var/lib/paperless/consume/doc.png" @@ -24,7 +26,7 @@ import ./make-test-python.nix ({ lib, ... }: { # Wait until server accepts connections machine.wait_until_succeeds("curl -fs localhost:28981") - with subtest("Create web test doc"): + with subtest("Add a document via the web interface"): machine.succeed( "convert -size 400x40 xc:white -font 'DejaVu-Sans' -pointsize 20 -fill black " "-annotate +5+20 'hello web 16-10-2005' /tmp/webdoc.png" @@ -35,11 +37,8 @@ import ./make-test-python.nix ({ lib, ... }: { machine.wait_until_succeeds( "(($(curl -u admin:admin -fs localhost:28981/api/documents/ | jq .count) == 2))" ) - assert "2005-10-16" in machine.succeed( - "curl -u admin:admin -fs localhost:28981/api/documents/ | jq '.results | .[0] | .created'" - ) - assert "2005-10-16" in machine.succeed( - "curl -u admin:admin -fs localhost:28981/api/documents/ | jq '.results | .[1] | .created'" - ) + docs = json.loads(machine.succeed("curl -u admin:admin -fs localhost:28981/api/documents/"))['results'] + assert "2005-10-16" in docs[0]['created'] + assert "2005-10-16" in docs[1]['created'] ''; }) |