nixos/preload: init
[NixPkgs.git] / nixos / tests / opensearch.nix
blob2887ac9677656284953871d045bd5bad9380cfaf
1 let
2   opensearchTest =
3     import ./make-test-python.nix (
4       { pkgs, lib, extraSettings ? {} }: {
5         name = "opensearch";
6         meta.maintainers = with pkgs.lib.maintainers; [ shyim ];
8         nodes.machine = lib.mkMerge [
9           {
10             virtualisation.memorySize = 2048;
11             services.opensearch.enable = true;
12           }
13           extraSettings
14         ];
16         testScript = ''
17           machine.start()
18           machine.wait_for_unit("opensearch.service")
19           machine.wait_for_open_port(9200)
21           machine.succeed(
22               "curl --fail localhost:9200"
23           )
24         '';
25       });
28   opensearch = opensearchTest {};
29   opensearchCustomPathAndUser = opensearchTest {
30     extraSettings = {
31       services.opensearch.dataDir = "/var/opensearch_test";
32       services.opensearch.user = "open_search";
33       services.opensearch.group = "open_search";
34       systemd.tmpfiles.rules = [
35         "d /var/opensearch_test 0700 open_search open_search -"
36       ];
37       users = {
38         groups.open_search = {};
39         users.open_search = {
40           description = "OpenSearch daemon user";
41           group = "open_search";
42           isSystemUser = true;
43         };
44       };
45     };
46   };