2021-08-28 03:28:27 +01:00
|
|
|
import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
|
|
|
name = "envoy";
|
|
|
|
meta = with pkgs.lib.maintainers; {
|
|
|
|
maintainers = [ cameronnemo ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes.machine = { pkgs, ... }: {
|
|
|
|
services.envoy.enable = true;
|
|
|
|
services.envoy.settings = {
|
|
|
|
admin = {
|
|
|
|
access_log_path = "/dev/null";
|
|
|
|
address = {
|
|
|
|
socket_address = {
|
|
|
|
protocol = "TCP";
|
|
|
|
address = "127.0.0.1";
|
2023-02-09 10:22:06 +00:00
|
|
|
port_value = 80;
|
2021-08-28 03:28:27 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
static_resources = {
|
|
|
|
listeners = [];
|
|
|
|
clusters = [];
|
|
|
|
};
|
|
|
|
};
|
2023-02-09 11:19:58 +00:00
|
|
|
specialisation = {
|
|
|
|
withoutConfigValidation.configuration = { ... }: {
|
|
|
|
services.envoy = {
|
|
|
|
requireValidConfig = false;
|
|
|
|
settings.admin.access_log_path = lib.mkForce "/var/log/envoy/access.log";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2021-08-28 03:28:27 +01:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:19:58 +00:00
|
|
|
testScript = { nodes, ... }:
|
|
|
|
let
|
|
|
|
specialisations = "${nodes.machine.system.build.toplevel}/specialisation";
|
|
|
|
in
|
|
|
|
''
|
|
|
|
machine.start()
|
|
|
|
|
|
|
|
with subtest("envoy.service starts and responds with ready"):
|
|
|
|
machine.wait_for_unit("envoy.service")
|
|
|
|
machine.wait_for_open_port(80)
|
|
|
|
machine.wait_until_succeeds("curl -fsS localhost:80/ready")
|
|
|
|
|
|
|
|
with subtest("envoy.service works with config path not available at eval time"):
|
|
|
|
machine.succeed('${specialisations}/withoutConfigValidation/bin/switch-to-configuration test')
|
|
|
|
machine.wait_for_unit("envoy.service")
|
|
|
|
machine.wait_for_open_port(80)
|
|
|
|
machine.wait_until_succeeds("curl -fsS localhost:80/ready")
|
|
|
|
machine.succeed('test -f /var/log/envoy/access.log')
|
|
|
|
'';
|
2021-08-28 03:28:27 +01:00
|
|
|
})
|