1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00
nixpkgs/nixos/tests/opensearch.nix
talyz 9e9007e45f
nixos/opensearch: Use DynamicUser and StateDirectory by default
...but still allow for setting `dataDir` to a custom path. This gets
rid of the use of the deprecated option PermissionsStartOnly. Also, add
the ability to customize user and group, since that could be useful
with a custom `dataDir`.
2023-02-15 16:38:24 +00:00

53 lines
1.4 KiB
Nix

let
opensearchTest =
import ./make-test-python.nix (
{ pkgs, lib, extraSettings ? {} }: {
name = "opensearch";
meta.maintainers = with pkgs.lib.maintainers; [ shyim ];
nodes.machine = lib.mkMerge [
{
virtualisation.memorySize = 2048;
services.opensearch.enable = true;
}
extraSettings
];
testScript = ''
machine.start()
machine.wait_for_unit("opensearch.service")
machine.wait_for_open_port(9200)
machine.succeed(
"curl --fail localhost:9200"
)
'';
});
in
{
opensearch = opensearchTest {};
opensearchCustomPathAndUser = opensearchTest {
extraSettings = {
services.opensearch.dataDir = "/var/opensearch_test";
services.opensearch.user = "open_search";
services.opensearch.group = "open_search";
system.activationScripts.createDirectory = {
text = ''
mkdir -p "/var/opensearch_test"
chown open_search:open_search /var/opensearch_test
chmod 0700 /var/opensearch_test
'';
deps = [ "users" "groups" ];
};
users = {
groups.open_search = {};
users.open_search = {
description = "OpenSearch daemon user";
group = "open_search";
isSystemUser = true;
};
};
};
};
}