nixosTests.ocsinventory-agent: init
This commit is contained in:
parent
efdbdab8b5
commit
c72a44718c
@ -615,6 +615,7 @@ in {
|
|||||||
openstack-image-userdata = (handleTestOn ["x86_64-linux"] ./openstack-image.nix {}).userdata or {};
|
openstack-image-userdata = (handleTestOn ["x86_64-linux"] ./openstack-image.nix {}).userdata or {};
|
||||||
opentabletdriver = handleTest ./opentabletdriver.nix {};
|
opentabletdriver = handleTest ./opentabletdriver.nix {};
|
||||||
opentelemetry-collector = handleTest ./opentelemetry-collector.nix {};
|
opentelemetry-collector = handleTest ./opentelemetry-collector.nix {};
|
||||||
|
ocsinventory-agent = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./ocsinventory-agent.nix {};
|
||||||
owncast = handleTest ./owncast.nix {};
|
owncast = handleTest ./owncast.nix {};
|
||||||
outline = handleTest ./outline.nix {};
|
outline = handleTest ./outline.nix {};
|
||||||
image-contents = handleTest ./image-contents.nix {};
|
image-contents = handleTest ./image-contents.nix {};
|
||||||
|
33
nixos/tests/ocsinventory-agent.nix
Normal file
33
nixos/tests/ocsinventory-agent.nix
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
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}'"
|
||||||
|
'';
|
||||||
|
})
|
@ -15,6 +15,7 @@
|
|||||||
, pciutils
|
, pciutils
|
||||||
, usbutils
|
, usbutils
|
||||||
, util-linux
|
, util-linux
|
||||||
|
, nixosTests
|
||||||
, testers
|
, testers
|
||||||
, ocsinventory-agent
|
, ocsinventory-agent
|
||||||
, nix-update-script
|
, nix-update-script
|
||||||
@ -75,11 +76,14 @@ perlPackages.buildPerlPackage rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests.version = testers.testVersion {
|
tests = {
|
||||||
package = ocsinventory-agent;
|
inherit (nixosTests) ocsinventory-agent;
|
||||||
command = "ocsinventory-agent --version";
|
version = testers.testVersion {
|
||||||
# upstream has not updated version in lib/Ocsinventory/Agent/Config.pm
|
package = ocsinventory-agent;
|
||||||
version = "2.10.0";
|
command = "ocsinventory-agent --version";
|
||||||
|
# upstream has not updated version in lib/Ocsinventory/Agent/Config.pm
|
||||||
|
version = "2.10.0";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
updateScript = nix-update-script { };
|
updateScript = nix-update-script { };
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user