From 8dade1f713c7f64f0514ba4c00fa6e2bb1be8d79 Mon Sep 17 00:00:00 2001 From: Andreas Stührk Date: Thu, 9 Feb 2023 12:19:58 +0100 Subject: nixos/envoy: add option `requireValidConfig` to make config validation errors non-fatal Co-authored-by: Vincent Haupert --- nixos/tests/envoy.nix | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'nixos/tests') diff --git a/nixos/tests/envoy.nix b/nixos/tests/envoy.nix index a14c1fca3bb5f..1e4bfe626398e 100644 --- a/nixos/tests/envoy.nix +++ b/nixos/tests/envoy.nix @@ -22,12 +22,33 @@ import ./make-test-python.nix ({ pkgs, lib, ...} : { clusters = []; }; }; + specialisation = { + withoutConfigValidation.configuration = { ... }: { + services.envoy = { + requireValidConfig = false; + settings.admin.access_log_path = lib.mkForce "/var/log/envoy/access.log"; + }; + }; + }; }; - testScript = '' - machine.start() - machine.wait_for_unit("envoy.service") - machine.wait_for_open_port(80) - machine.wait_until_succeeds("curl -fsS localhost:80/ready") - ''; + 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') + ''; }) -- cgit 1.4.1