瀏覽代碼

tests: keepalive auto setting

Nicolas Duchon 1 年之前
父節點
當前提交
2aa35aa637
共有 2 個文件被更改,包括 21 次插入0 次删除
  1. 8 0
      test/test_keepalive.py
  2. 13 0
      test/test_keepalive.yml

+ 8 - 0
test/test_keepalive.py

@@ -27,6 +27,14 @@ def test_keepalive_enabled(docker_compose, nginxproxy):
     assert r.status_code == 200
     assert not re.search(fr'(?m)^(?i:Connection):', r.text)
 
+def test_keepalive_auto_enabled(docker_compose, nginxproxy):
+    conf = nginxproxy.get_conf().decode('ASCII')
+    assert re.search(r"keepalive 8\;", conf)
+
+    r = nginxproxy.get("http://keepalive-auto.nginx-proxy.test/headers")
+    assert r.status_code == 200
+    assert not re.search(fr'(?m)^(?i:Connection):', r.text)
+
 def test_keepalive_enabled_other_headers_ok(docker_compose, nginxproxy):
     """See the docstring for the disabled case above."""
     r = nginxproxy.get("http://keepalive-enabled.nginx-proxy.test/headers")

+ 13 - 0
test/test_keepalive.yml

@@ -18,6 +18,19 @@ services:
       VIRTUAL_HOST: keepalive-enabled.nginx-proxy.test
     labels:
       com.github.nginx-proxy.nginx-proxy.keepalive: "64"
+  
+  keepalive-auto:
+    image: web
+    deploy:
+      mode: replicated
+      replicas: 4
+    expose:
+      - "80"
+    environment:
+      WEB_PORTS: 80
+      VIRTUAL_HOST: keepalive-auto.nginx-proxy.test
+    labels:
+      com.github.nginx-proxy.nginx-proxy.keepalive: "auto"
 
   sut:
     image: nginxproxy/nginx-proxy:test