1 import ./make-test-python.nix (
5 default_server = { pkgs, lib, ... }: {
7 interfaces.eth1.ipv4.addresses = lib.mkOverride 0 [{
8 address = "192.168.1.1";
13 environment.etc."nomad.custom.json".source =
14 (pkgs.formats.json { }).generate "nomad.custom.json" {
29 extraSettingsPaths = [ "/etc/nomad.custom.json" ];
34 custom_state_dir_server = { pkgs, lib, ... }: {
36 interfaces.eth1.ipv4.addresses = lib.mkOverride 0 [{
37 address = "192.168.1.1";
42 environment.etc."nomad.custom.json".source =
43 (pkgs.formats.json { }).generate "nomad.custom.json" {
50 dropPrivileges = false;
53 data_dir = "/nomad/data/dir";
60 extraSettingsPaths = [ "/etc/nomad.custom.json" ];
64 systemd.services.nomad.serviceConfig.ExecStartPre = "${pkgs.writeShellScript "mk_data_dir" ''
67 ${pkgs.coreutils}/bin/mkdir -p /nomad/data/dir
73 def test_nomad_server(server):
74 server.wait_for_unit("nomad.service")
76 # wait for healthy server
77 server.wait_until_succeeds(
78 "[ $(nomad operator raft list-peers | grep true | wc -l) == 1 ]"
81 # wait for server liveness
82 server.succeed("[ $(nomad server members | grep -o alive | wc -l) == 1 ]")
85 server.succeed("nomad server members | grep -o universe")
87 # check the datacenter
88 server.succeed("[ $(nomad server members | grep -o earth | wc -l) == 1 ]")
91 servers = [default_server, custom_state_dir_server]
93 for server in servers:
94 test_nomad_server(server)