Merge pull request #39709 from Ma27/osquery-testcase
nixos/osquery: add test
This commit is contained in:
commit
c505e57771
@ -307,6 +307,7 @@ in rec {
|
||||
tests.influxdb = callTest tests/influxdb.nix {};
|
||||
tests.ipv6 = callTest tests/ipv6.nix {};
|
||||
tests.jenkins = callTest tests/jenkins.nix {};
|
||||
tests.osquery = callTest tests/osquery.nix {};
|
||||
tests.plasma5 = callTest tests/plasma5.nix {};
|
||||
tests.plotinus = callTest tests/plotinus.nix {};
|
||||
tests.keymap = callSubTests tests/keymap.nix {};
|
||||
|
28
nixos/tests/osquery.nix
Normal file
28
nixos/tests/osquery.nix
Normal file
@ -0,0 +1,28 @@
|
||||
import ./make-test.nix ({ pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
name = "osquery";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ ma27 ];
|
||||
};
|
||||
|
||||
machine = {
|
||||
services.osquery.enable = true;
|
||||
services.osquery.loggerPath = "/var/log/osquery/logs";
|
||||
services.osquery.pidfile = "/var/run/osqueryd.pid";
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
$machine->start;
|
||||
$machine->waitForUnit("osqueryd.service");
|
||||
|
||||
$machine->succeed("echo 'SELECT address FROM etc_hosts LIMIT 1;' | osqueryi | grep '127.0.0.1'");
|
||||
$machine->succeed(
|
||||
"echo 'SELECT value FROM osquery_flags WHERE name = \"logger_path\";' | osqueryi | grep /var/log/osquery/logs"
|
||||
);
|
||||
|
||||
$machine->succeed("echo 'SELECT value FROM osquery_flags WHERE name = \"pidfile\";' | osqueryi | grep /var/run/osqueryd.pid");
|
||||
'';
|
||||
})
|
Loading…
Reference in New Issue
Block a user