vuls: init at 0.27.0 (#348530)
[NixPkgs.git] / nixos / tests / hddfancontrol.nix
blobb5fa7ccb2c19be164b4d5bf7ccde5d908f236e60
1 import ./make-test-python.nix ({ pkgs, ... }: {
2   name = "hddfancontrol";
3   meta = with pkgs.lib.maintainers; {
4     maintainers = [ benley ];
5   };
7   nodes.machine = { ... }: {
8     imports = [ ../modules/profiles/minimal.nix ];
10     services.hddfancontrol.enable = true;
11     services.hddfancontrol.disks = ["/dev/vda"];
12     services.hddfancontrol.pwmPaths = ["/test/hwmon1/pwm1"];
13     services.hddfancontrol.extraArgs = ["--pwm-start-value=32"
14                                         "--pwm-stop-value=0"];
16     systemd.services.hddfancontrol_fixtures = {
17       description = "Install test fixtures for hddfancontrol";
18       serviceConfig = {
19         Type = "oneshot";
20       };
21       script = ''
22         mkdir -p /test/hwmon1
23         echo 255 > /test/hwmon1/pwm1
24         echo 2 > /test/hwmon1/pwm1_enable
25       '';
26       wantedBy = ["hddfancontrol.service"];
27       before = ["hddfancontrol.service"];
28     };
30     systemd.services.hddfancontrol.serviceConfig.ReadWritePaths = "/test";
31   };
33   # hddfancontrol.service will fail to start because qemu /dev/vda doesn't have
34   # any thermal interfaces, but it should ensure that fans appear to be running
35   # before it aborts.
36   testScript = ''
37     start_all()
38     machine.wait_for_unit("multi-user.target")
39     machine.succeed("journalctl -eu hddfancontrol.service|grep 'Setting fan speed'")
40     machine.shutdown()
42   '';