1import ./make-test.nix ({ pkgs, lib, ... }:
2
3with lib;
4
5{
6 name = "osquery";
7 meta = with pkgs.stdenv.lib.maintainers; {
8 maintainers = [ ma27 ];
9 };
10
11 machine = {
12 services.osquery.enable = true;
13 services.osquery.loggerPath = "/var/log/osquery/logs";
14 services.osquery.pidfile = "/var/run/osqueryd.pid";
15 };
16
17 testScript = ''
18 $machine->start;
19 $machine->waitForUnit("osqueryd.service");
20
21 $machine->succeed("echo 'SELECT address FROM etc_hosts LIMIT 1;' | osqueryi | grep '127.0.0.1'");
22 $machine->succeed(
23 "echo 'SELECT value FROM osquery_flags WHERE name = \"logger_path\";' | osqueryi | grep /var/log/osquery/logs"
24 );
25
26 $machine->succeed("echo 'SELECT value FROM osquery_flags WHERE name = \"pidfile\";' | osqueryi | grep /var/run/osqueryd.pid");
27 '';
28})