summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2019-11-25 00:29:44 +0100
committerMaximilian Bosch <maximilian@mbosch.me>2019-12-26 17:59:25 +0100
commitabbce768dc2aceb21d234a018115bbf96a924b31 (patch)
tree8410db82ae436beae60e76d42a03a168fd0f197f /nixos/tests
parent1c2781d39c9b1dbac1e574795b83436891617b7e (diff)
downloadnixpkgs-abbce768dc2aceb21d234a018115bbf96a924b31.tar
nixpkgs-abbce768dc2aceb21d234a018115bbf96a924b31.tar.gz
nixpkgs-abbce768dc2aceb21d234a018115bbf96a924b31.tar.bz2
nixpkgs-abbce768dc2aceb21d234a018115bbf96a924b31.tar.lz
nixpkgs-abbce768dc2aceb21d234a018115bbf96a924b31.tar.xz
nixpkgs-abbce768dc2aceb21d234a018115bbf96a924b31.tar.zst
nixpkgs-abbce768dc2aceb21d234a018115bbf96a924b31.zip
nixosTests.nginx*: review fixes
Co-Authored-By: Florian Klink <flokli@flokli.de>
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/nginx.nix21
1 files changed, 9 insertions, 12 deletions
diff --git a/nixos/tests/nginx.nix b/nixos/tests/nginx.nix
index 8402015f8cc..24e85d77c88 100644
--- a/nixos/tests/nginx.nix
+++ b/nixos/tests/nginx.nix
@@ -72,35 +72,32 @@ import ./make-test-python.nix ({ pkgs, ... }: {
     url = "http://localhost/index.html"
 
 
-    def checkEtag():
-        etag = webserver.succeed(
-            f'curl -v {url} 2>&1 | sed -n -e "s/^< [Ee][Tt][Aa][Gg]: *//p"'
-        )
-        httpCode = webserver.succeed(
+    def check_etag():
+        etag = webserver.succeed(f'curl -v {url} 2>&1 | sed -n -e "s/^< etag: *//ip"')
+        http_code = webserver.succeed(
             f"curl -w '%{http_code}' -X HEAD -H 'If-None-Match: {etag}' {url}"
         )
-        assert httpCode == "304"
+        assert http_code == "304"
 
         return etag
 
 
     webserver.wait_for_unit("nginx")
-    webserver.wait_for_open_port("80")
+    webserver.wait_for_open_port(80)
 
     with subtest("check ETag if serving Nix store paths"):
-        oldEtag = checkEtag
+        old_etag = check_etag()
         webserver.succeed(
             "${etagSystem}/bin/switch-to-configuration test >&2"
         )
-        webserver.sleep(1)  # race condition
-        newEtag = checkEtag
-        assert oldEtag != newEtag
+        new_etag = check_etag()
+        assert old_etag != new_etag
 
     with subtest("config is reloaded on nixos-rebuild switch"):
         webserver.succeed(
             "${justReloadSystem}/bin/switch-to-configuration test >&2"
         )
-        webserver.wait_for_open_port("8080")
+        webserver.wait_for_open_port(8080)
         webserver.fail("journalctl -u nginx | grep -q -i stopped")
         webserver.succeed("journalctl -u nginx | grep -q -i reloaded")