Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
39 lines
1.2 KiB
Nix
39 lines
1.2 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
{
|
|
name = "ocsinventory-agent";
|
|
|
|
nodes.machine =
|
|
{ pkgs, ... }:
|
|
{
|
|
services.ocsinventory-agent = {
|
|
enable = true;
|
|
settings = {
|
|
debug = true;
|
|
local = "/var/lib/ocsinventory-agent/reports";
|
|
tag = "MY_INVENTORY_TAG";
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
path = "/var/lib/ocsinventory-agent/reports"
|
|
|
|
# Run the agent to generate the inventory file in offline mode
|
|
start_all()
|
|
machine.succeed("mkdir -p {}".format(path))
|
|
machine.wait_for_unit("ocsinventory-agent.service")
|
|
machine.wait_until_succeeds("journalctl -u ocsinventory-agent.service | grep 'Inventory saved in'")
|
|
|
|
# Fetch the path to the generated inventory file
|
|
report_file = machine.succeed("find {}/*.ocs -type f | head -n1".format(path))
|
|
|
|
with subtest("Check the tag value"):
|
|
tag = machine.succeed(
|
|
"${pkgs.libxml2}/bin/xmllint --xpath 'string(/REQUEST/CONTENT/ACCOUNTINFO/KEYVALUE)' {}".format(report_file)
|
|
).rstrip()
|
|
assert tag == "MY_INVENTORY_TAG", f"tag is not valid, was '{tag}'"
|
|
'';
|
|
}
|
|
)
|