summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/python-sql
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2017-12-19 15:19:38 +0100
committerMaximilian Bosch <maximilian@mbosch.me>2018-01-02 20:14:27 +0100
commite538e00404a7a79bde1465924a3f60f05648794e (patch)
tree64b0b39259c11ac74fa85a871c6166bcf063aa00 /pkgs/development/python-modules/python-sql
parentb256afac58b80adde2605eac434a04b9a23bbe95 (diff)
test-driver: support testing user units
It is quite complicated to test services using the test-driver when declaring user services with `systemd.user.services` such as many X11-based services like `xautolock.service`. This change adds an optional `$user` parameter to each systemd-related function in the test-driver and runs `systemctl --user` commands using `su -l $user -c ...` and sets the `XDG_RUNTIME_DIR` variable accordingly and a new function named `systemctl` which is able to run a systemd command with or without a specified user. The change can be confirmed with a simple VM declaration like this: ``` import ./nixos/tests/make-test.nix ({ pkgs, lib }: with lib; { name = "systemd-user-test"; nodes.machine = { imports = [ ./nixos/tests/common/user-account.nix ]; services.xserver.enable = true; services.xserver.displayManager.auto.enable = true; services.xserver.displayManager.auto.user = "bob"; services.xserver.xautolock.enable = true; }; testScript = '' $machine->start; $machine->waitForX; $machine->waitForUnit("xautolock.service", "bob"); $machine->stopJob("xautolock.service", "bob"); $machine->startJob("xautolock.service", "bob"); $machine->systemctl("list-jobs --no-pager", "bob"); $machine->systemctl("show 'xautolock.service' --no-pager", "bob"); ''; }) ```
Diffstat (limited to 'pkgs/development/python-modules/python-sql')
0 files changed, 0 insertions, 0 deletions