mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
parent
931d6c6af4
commit
884c15c72f
2 changed files with 37 additions and 39 deletions
|
@ -169,7 +169,7 @@ in {
|
||||||
angie-api = runTest ./angie-api.nix;
|
angie-api = runTest ./angie-api.nix;
|
||||||
anki-sync-server = runTest ./anki-sync-server.nix;
|
anki-sync-server = runTest ./anki-sync-server.nix;
|
||||||
anuko-time-tracker = runTest ./anuko-time-tracker.nix;
|
anuko-time-tracker = runTest ./anuko-time-tracker.nix;
|
||||||
apcupsd = handleTest ./apcupsd.nix {};
|
apcupsd = runTest ./apcupsd.nix;
|
||||||
apfs = runTest ./apfs.nix;
|
apfs = runTest ./apfs.nix;
|
||||||
appliance-repart-image = runTest ./appliance-repart-image.nix;
|
appliance-repart-image = runTest ./appliance-repart-image.nix;
|
||||||
appliance-repart-image-verity-store = runTest ./appliance-repart-image-verity-store.nix;
|
appliance-repart-image-verity-store = runTest ./appliance-repart-image-verity-store.nix;
|
||||||
|
|
|
@ -2,45 +2,43 @@ let
|
||||||
# arbitrary address
|
# arbitrary address
|
||||||
ipAddr = "192.168.42.42";
|
ipAddr = "192.168.42.42";
|
||||||
in
|
in
|
||||||
import ./make-test-python.nix (
|
{ lib, ... }:
|
||||||
{ lib, pkgs, ... }:
|
{
|
||||||
{
|
name = "apcupsd";
|
||||||
name = "apcupsd";
|
meta.maintainers = with lib.maintainers; [ bjornfor ];
|
||||||
meta.maintainers = with lib.maintainers; [ bjornfor ];
|
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
machine = {
|
machine = {
|
||||||
services.apcupsd = {
|
services.apcupsd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
configText = ''
|
configText = ''
|
||||||
UPSTYPE usb
|
UPSTYPE usb
|
||||||
BATTERYLEVEL 42
|
BATTERYLEVEL 42
|
||||||
# Configure NISIP so that the only way apcaccess can work is to read
|
# Configure NISIP so that the only way apcaccess can work is to read
|
||||||
# this config.
|
# this config.
|
||||||
NISIP ${ipAddr}
|
NISIP ${ipAddr}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
networking.interfaces.eth1 = {
|
networking.interfaces.eth1 = {
|
||||||
ipv4.addresses = [
|
ipv4.addresses = [
|
||||||
{
|
{
|
||||||
address = ipAddr;
|
address = ipAddr;
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Check that the service starts, that the CLI (apcaccess) works and that it
|
# Check that the service starts, that the CLI (apcaccess) works and that it
|
||||||
# uses the config (ipAddr) defined in the service config.
|
# uses the config (ipAddr) defined in the service config.
|
||||||
testScript = ''
|
testScript = ''
|
||||||
start_all()
|
start_all()
|
||||||
machine.wait_for_unit("apcupsd.service")
|
machine.wait_for_unit("apcupsd.service")
|
||||||
machine.wait_for_open_port(3551, "${ipAddr}")
|
machine.wait_for_open_port(3551, "${ipAddr}")
|
||||||
res = machine.succeed("apcaccess")
|
res = machine.succeed("apcaccess")
|
||||||
expect_line="MBATTCHG : 42 Percent"
|
expect_line="MBATTCHG : 42 Percent"
|
||||||
assert "MBATTCHG : 42 Percent" in res, f"expected apcaccess output to contain '{expect_line}' but got '{res}'"
|
assert "MBATTCHG : 42 Percent" in res, f"expected apcaccess output to contain '{expect_line}' but got '{res}'"
|
||||||
machine.shutdown()
|
machine.shutdown()
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue