From c258e18f67a5d39d4d2902f84201af4b6dac40b8 Mon Sep 17 00:00:00 2001 From: Robert James Hernandez Date: Mon, 21 Oct 2024 19:00:20 +0000 Subject: [PATCH] nixos/auto-cpufreq: init vm test Even though cpufreq cannot be adjusted within qemu this test is still useful to ensure that the service is running and the auto-cpufreq cli is able to interact with the auto-cpufreq service. --- nixos/tests/all-tests.nix | 1 + nixos/tests/auto-cpufreq.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 nixos/tests/auto-cpufreq.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 8b674bfb7342..c9cab8bb41af 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -141,6 +141,7 @@ in { audiobookshelf = handleTest ./audiobookshelf.nix {}; auth-mysql = handleTest ./auth-mysql.nix {}; authelia = handleTest ./authelia.nix {}; + auto-cpufreq = handleTest ./auto-cpufreq.nix {}; avahi = handleTest ./avahi.nix {}; avahi-with-resolved = handleTest ./avahi.nix { networkd = true; }; ayatana-indicators = runTest ./ayatana-indicators.nix; diff --git a/nixos/tests/auto-cpufreq.nix b/nixos/tests/auto-cpufreq.nix new file mode 100644 index 000000000000..79129cf1ffaf --- /dev/null +++ b/nixos/tests/auto-cpufreq.nix @@ -0,0 +1,33 @@ +import ./make-test-python.nix ( + { pkgs, ... }: + + { + name = "auto-cpufreq-server"; + + nodes = { + machine = + { pkgs, ... }: + { + # service will still start but since vm inside qemu cpufreq adjustments + # cannot be made. This will resource in the following error but the service + # remains up: + # ERROR: + # Couldn't find any of the necessary scaling governors. + services.auto-cpufreq = { + enable = true; + settings = { + charger = { + turbo = "auto"; + }; + }; + }; + }; + }; + + testScript = '' + machine.start() + machine.wait_for_unit("auto-cpufreq.service") + machine.succeed("auto-cpufreq --force reset") + ''; + } +)