1import ./make-test-python.nix ({ ... }: {
2 name = "consul-template";
3
4 nodes.machine = { ... }: {
5 services.consul-template.instances.example.settings = {
6 template = [{
7 contents = ''
8 {{ key "example" }}
9 '';
10 perms = "0600";
11 destination = "/example";
12 }];
13 };
14
15 services.consul = {
16 enable = true;
17 extraConfig = {
18 server = true;
19 bootstrap_expect = 1;
20 bind_addr = "127.0.0.1";
21 };
22 };
23 };
24
25 testScript = ''
26 machine.wait_for_unit("consul.service")
27 machine.wait_for_open_port(8500)
28
29 machine.wait_for_unit("consul-template-example.service")
30
31 machine.wait_until_succeeds('consul kv put example example')
32
33 machine.wait_for_file("/example")
34 machine.succeed('grep "example" /example')
35 '';
36})