mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
nixosTests.autosuspend: init
This commit is contained in:
@@ -257,6 +257,7 @@ in
|
||||
authelia = runTest ./authelia.nix;
|
||||
auto-cpufreq = runTest ./auto-cpufreq.nix;
|
||||
autobrr = runTest ./autobrr.nix;
|
||||
autosuspend = runTest ./autosuspend.nix;
|
||||
avahi = runTest {
|
||||
imports = [ ./avahi.nix ];
|
||||
_module.args.networkd = false;
|
||||
|
||||
30
nixos/tests/autosuspend.nix
Normal file
30
nixos/tests/autosuspend.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
name = "autosuspend";
|
||||
meta.maintainers = [ lib.maintainers.anthonyroussel ];
|
||||
|
||||
nodes = {
|
||||
machine = {
|
||||
services.autosuspend = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
interval = 5;
|
||||
idle_time = 5;
|
||||
suspend_cmd = "${pkgs.coreutils}/bin/touch /tmp/suspended";
|
||||
};
|
||||
|
||||
# Return exit code 1 to trigger suspend
|
||||
checks.ExternalCommand.command = "exit 1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
machine.wait_for_unit("autosuspend.service")
|
||||
machine.wait_for_file("/tmp/suspended")
|
||||
'';
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
dbus,
|
||||
fetchFromGitHub,
|
||||
nixosTests,
|
||||
python3,
|
||||
sphinxHook,
|
||||
withDocs ? true,
|
||||
@@ -87,6 +88,10 @@ python3.pkgs.buildPythonApplication (finalAttrs: {
|
||||
"test_multiple_sessions"
|
||||
];
|
||||
|
||||
passthru.tests = {
|
||||
inherit (nixosTests) autosuspend;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Daemon to automatically suspend and wake up a system";
|
||||
homepage = "https://autosuspend.readthedocs.io";
|
||||
|
||||
Reference in New Issue
Block a user