Unverified Commit 775ad894 authored by Jörg Thalheim's avatar Jörg Thalheim Committed by GitHub
Browse files

Merge pull request #230988 from delroth/nginx-test-flakiness

nixos/tests/nginx: fix etag test flakiness
parents 8b7f71fb ac4abaa9
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -87,15 +87,23 @@ import ./make-test-python.nix ({ pkgs, ... }: {
        return etag


    def wait_for_nginx_on_port(port):
        webserver.wait_for_unit("nginx")
    webserver.wait_for_open_port(80)
        webserver.wait_for_open_port(port)


    # nginx can be ready before multi-user.target, in which case switching to
    # a different configuration might not realize it needs to restart nginx.
    webserver.wait_for_unit("multi-user.target")

    wait_for_nginx_on_port(80)

    with subtest("check ETag if serving Nix store paths"):
        old_etag = check_etag()
        webserver.succeed(
            "${etagSystem}/bin/switch-to-configuration test >&2"
        )
        webserver.sleep(1)
        wait_for_nginx_on_port(80)
        new_etag = check_etag()
        assert old_etag != new_etag

@@ -103,7 +111,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
        webserver.succeed(
            "${justReloadSystem}/bin/switch-to-configuration test >&2"
        )
        webserver.wait_for_open_port(8080)
        wait_for_nginx_on_port(8080)
        webserver.fail("journalctl -u nginx | grep -q -i stopped")
        webserver.succeed("journalctl -u nginx | grep -q -i reloaded")

@@ -111,7 +119,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
        webserver.succeed(
            "${reloadRestartSystem}/bin/switch-to-configuration test >&2"
        )
        webserver.wait_for_unit("nginx")
        wait_for_nginx_on_port(80)
        webserver.succeed("journalctl -u nginx | grep -q -i stopped")

    with subtest("nixos-rebuild --switch should fail when there are configuration errors"):