|
36 | 36 |
|
37 | 37 | nodes = { |
38 | 38 | server = |
39 | | - { pkgs, config, ... }: |
| 39 | + { config, ... }: |
40 | 40 | { |
41 | | - environment.systemPackages = [ |
42 | | - pkgs.curl |
43 | | - ]; |
44 | | - |
45 | 41 | services.h2o = { |
46 | 42 | enable = true; |
47 | 43 | defaultHTTPListenPort = 8080; |
|
111 | 107 | ]; |
112 | 108 | }; |
113 | 109 | extraHosts = '' |
114 | | - 127.0.0.1 ${domain.HTTP} |
115 | | - 127.0.0.1 ${domain.TLS} |
| 110 | + ${config.networking.primaryIPAddress} ${domain.HTTP} |
| 111 | + ${config.networking.primaryIPAddress} ${domain.TLS} |
116 | 112 | ''; |
117 | 113 | }; |
118 | 114 | }; |
| 115 | + |
| 116 | + client = |
| 117 | + { nodes, pkgs, ... }: |
| 118 | + { |
| 119 | + environment.systemPackages = [ |
| 120 | + pkgs.curl |
| 121 | + ]; |
| 122 | + |
| 123 | + security.pki.certificates = [ |
| 124 | + (builtins.readFile ../../common/acme/server/ca.cert.pem) |
| 125 | + ]; |
| 126 | + |
| 127 | + networking.extraHosts = '' |
| 128 | + ${nodes.server.networking.primaryIPAddress} ${domain.HTTP} |
| 129 | + ${nodes.server.networking.primaryIPAddress} ${domain.TLS} |
| 130 | + ''; |
| 131 | + }; |
119 | 132 | }; |
| 133 | + |
120 | 134 | testScript = |
121 | 135 | { nodes, ... }: |
122 | 136 | let |
|
126 | 140 | in |
127 | 141 | # python |
128 | 142 | '' |
| 143 | + start_all() |
| 144 | +
|
129 | 145 | server.wait_for_unit("h2o.service") |
130 | 146 | server.wait_for_open_port(${portStrHTTP}) |
131 | 147 | server.wait_for_open_port(${portStrTLS}) |
132 | 148 |
|
133 | | - assert "${sawatdi_chao_lok}" in server.succeed("curl --fail-with-body 'http://${domain.HTTP}:${portStrHTTP}/hello_world.txt'") |
| 149 | + assert "${sawatdi_chao_lok}" in client.succeed("curl --fail-with-body 'http://${domain.HTTP}:${portStrHTTP}/hello_world.txt'") |
134 | 150 |
|
135 | | - tls_hello_world_head = server.succeed("curl -v --head --compressed --http2 --tlsv1.3 --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'").lower() |
| 151 | + tls_hello_world_head = client.succeed("curl -v --head --compressed --http2 --tlsv1.3 --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'").lower() |
136 | 152 | assert "http/2 200" in tls_hello_world_head |
137 | 153 | assert "server: h2o" in tls_hello_world_head |
138 | 154 | assert "content-type: text/x-rst" in tls_hello_world_head |
139 | 155 |
|
140 | | - assert "${sawatdi_chao_lok}" in server.succeed("curl -v --http2 --tlsv1.3 --compressed --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'") |
| 156 | + assert "${sawatdi_chao_lok}" in client.succeed("curl -v --http2 --tlsv1.3 --compressed --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'") |
141 | 157 |
|
142 | | - quic_hello_world_head = server.succeed("curl -v --head --compressed --http3-only --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'").lower() |
| 158 | + quic_hello_world_head = client.succeed("curl -v --head --compressed --http3-only --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'").lower() |
143 | 159 | assert "http/3 200" in quic_hello_world_head |
144 | 160 | assert "server: h2o" in quic_hello_world_head |
145 | 161 | assert "content-type: text/x-rst" in quic_hello_world_head |
146 | 162 |
|
147 | | - assert "${sawatdi_chao_lok}" in server.succeed("curl -v --http3-only --compressed --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'") |
| 163 | + assert "${sawatdi_chao_lok}" in client.succeed("curl -v --http3-only --compressed --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'") |
148 | 164 |
|
149 | | - assert "redirected" in server.succeed("curl -v --head --fail-with-body 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'").lower() |
| 165 | + assert "redirected" in client.succeed("curl -v --head --fail-with-body 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'").lower() |
150 | 166 |
|
151 | | - server.fail("curl --location --max-redirs 0 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'") |
| 167 | + client.fail("curl --location --max-redirs 0 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'") |
152 | 168 |
|
153 | | - assert "${sawatdi_chao_lok}" in server.succeed("curl -v --location --fail-with-body 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'") |
| 169 | + assert "${sawatdi_chao_lok}" in client.succeed("curl -v --location --fail-with-body 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'") |
154 | 170 | ''; |
155 | 171 | } |
0 commit comments