From 610021f4b6cb098fbe12c374a2ef5f1c779a5e13 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski <2151333+piotrkwiecinski@users.noreply.github.com> Date: Fri, 18 Apr 2025 21:28:41 +0200 Subject: [PATCH] nixosTests.fancontrol: migrate to runTest Part of #386873 --- nixos/tests/all-tests.nix | 2 +- nixos/tests/fancontrol.nix | 72 ++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 2f650f36bb0e..0633c06be44b 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -460,7 +460,7 @@ in evcc = runTest ./evcc.nix; fail2ban = runTest ./fail2ban.nix; fakeroute = handleTest ./fakeroute.nix { }; - fancontrol = handleTest ./fancontrol.nix { }; + fancontrol = runTest ./fancontrol.nix; fanout = handleTest ./fanout.nix { }; fcitx5 = handleTest ./fcitx5 { }; fedimintd = runTest ./fedimintd.nix; diff --git a/nixos/tests/fancontrol.nix b/nixos/tests/fancontrol.nix index da2d5fbd8405..5bfd4b2bd37e 100644 --- a/nixos/tests/fancontrol.nix +++ b/nixos/tests/fancontrol.nix @@ -1,39 +1,37 @@ -import ./make-test-python.nix ( - { pkgs, ... }: - { - name = "fancontrol"; - meta = with pkgs.lib.maintainers; { - maintainers = [ evils ]; +{ pkgs, ... }: +{ + name = "fancontrol"; + meta = with pkgs.lib.maintainers; { + maintainers = [ evils ]; + }; + + nodes.machine = + { ... }: + { + imports = [ ../modules/profiles/minimal.nix ]; + hardware.fancontrol.enable = true; + hardware.fancontrol.config = '' + INTERVAL=42 + DEVPATH=hwmon1=devices/platform/dummy + DEVNAME=hwmon1=dummy + FCTEMPS=hwmon1/device/pwm1=hwmon1/device/temp1_input + FCFANS=hwmon1/device/pwm1=hwmon1/device/fan1_input + MINTEMP=hwmon1/device/pwm1=25 + MAXTEMP=hwmon1/device/pwm1=65 + MINSTART=hwmon1/device/pwm1=150 + MINSTOP=hwmon1/device/pwm1=0 + ''; }; - nodes.machine = - { ... }: - { - imports = [ ../modules/profiles/minimal.nix ]; - hardware.fancontrol.enable = true; - hardware.fancontrol.config = '' - INTERVAL=42 - DEVPATH=hwmon1=devices/platform/dummy - DEVNAME=hwmon1=dummy - FCTEMPS=hwmon1/device/pwm1=hwmon1/device/temp1_input - FCFANS=hwmon1/device/pwm1=hwmon1/device/fan1_input - MINTEMP=hwmon1/device/pwm1=25 - MAXTEMP=hwmon1/device/pwm1=65 - MINSTART=hwmon1/device/pwm1=150 - MINSTOP=hwmon1/device/pwm1=0 - ''; - }; - - # This configuration cannot be valid for the test VM, so it's expected to get an 'outdated' error. - testScript = '' - start_all() - # can't wait for unit fancontrol.service because it doesn't become active due to invalid config - # fancontrol.service is WantedBy multi-user.target - machine.wait_for_unit("multi-user.target") - machine.succeed( - "journalctl -eu fancontrol | tee /dev/stderr | grep 'Configuration appears to be outdated'" - ) - machine.shutdown() - ''; - } -) + # This configuration cannot be valid for the test VM, so it's expected to get an 'outdated' error. + testScript = '' + start_all() + # can't wait for unit fancontrol.service because it doesn't become active due to invalid config + # fancontrol.service is WantedBy multi-user.target + machine.wait_for_unit("multi-user.target") + machine.succeed( + "journalctl -eu fancontrol | tee /dev/stderr | grep 'Configuration appears to be outdated'" + ) + machine.shutdown() + ''; +}