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