aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/tests/osquery.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/tests/osquery.nix')
-rw-r--r--nixpkgs/nixos/tests/osquery.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/nixpkgs/nixos/tests/osquery.nix b/nixpkgs/nixos/tests/osquery.nix
new file mode 100644
index 00000000000..d95871ffafc
--- /dev/null
+++ b/nixpkgs/nixos/tests/osquery.nix
@@ -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 = "/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 /run/osqueryd.pid");
+ '';
+})