diff --git a/nixos/tests/accountsservice.nix b/nixos/tests/accountsservice.nix new file mode 100644 index 000000000000..95da652b0a97 --- /dev/null +++ b/nixos/tests/accountsservice.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + name = "accountsservice"; + + nodes.machine = + { pkgs, ... }: + { + environment.systemPackages = with pkgs; [ jq ]; + + services.accounts-daemon.enable = true; + + users.users.alice = { + isNormalUser = true; + description = "Alice"; + }; + }; + + testScript = '' + machine.start_job("accounts-daemon.service") + machine.wait_for_unit("accounts-daemon.service") + user = machine.succeed("busctl call -j org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts FindUserByName s alice | jq -j '.data[]'") + name = machine.succeed(f"busctl get-property -j org.freedesktop.Accounts {user} org.freedesktop.Accounts.User RealName | jq -j .data") + t.assertEqual(name, "Alice") + ''; +} diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 9d01b75516f7..ee77b071a1da 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -174,6 +174,7 @@ in # keep-sorted start case=no numeric=no block=yes _3proxy = runTest ./3proxy.nix; aaaaxy = runTest ./aaaaxy.nix; + accountsservice = runTest ./accountsservice.nix; acl = pkgs.callPackage ./acl.nix { }; acme = import ./acme/default.nix { inherit runTest; diff --git a/pkgs/by-name/ac/accountsservice/package.nix b/pkgs/by-name/ac/accountsservice/package.nix index b184e5d0299e..c56da88ada7e 100644 --- a/pkgs/by-name/ac/accountsservice/package.nix +++ b/pkgs/by-name/ac/accountsservice/package.nix @@ -19,6 +19,7 @@ vala, gettext, libxcrypt, + nixosTests, }: stdenv.mkDerivation (finalAttrs: { @@ -107,6 +108,8 @@ stdenv.mkDerivation (finalAttrs: { --replace-fail "run_command(['./generate-version.sh'], check: true).stdout().strip()" "'${finalAttrs.version}'" ''; + passthru.tests = { inherit (nixosTests) accountsservice; }; + meta = { changelog = "https://gitlab.freedesktop.org/accountsservice/accountsservice/-/releases/${finalAttrs.src.tag}"; description = "D-Bus interface for user account query and manipulation";