You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/03/23 01:44:56 UTC

[GitHub] [trafficserver] masaori335 commented on a change in pull request #7613: Add AuTest for Background Fill

masaori335 commented on a change in pull request #7613:
URL: https://github.com/apache/trafficserver/pull/7613#discussion_r599187537



##########
File path: tests/gold_tests/cache/background_fill.test.py
##########
@@ -0,0 +1,125 @@
+'''
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+Test.Summary = 'Exercise Background Fill'
+Test.SkipUnless(
+    Condition.HasCurlFeature('http2'),
+)
+Test.ContinueOnFail = True
+
+class BackgroundFillTest:
+    """
+    https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html#proxy-config-http-background-fill-completed-threshold
+    """
+
+    def __init__(self):
+        self.__setupOriginServer()
+        self.__setupTS()
+        
+    def __setupOriginServer(self):
+        self.httpbin = Test.MakeHttpBinServer("httpbin")
+
+    def __setupTS(self):
+        self.ts = Test.MakeATSProcess(
+            "ts", select_ports=True, enable_tls=True, enable_cache=True)
+
+        self.ts.addDefaultSSLFiles()
+        self.ts.Disk.ssl_multicert_config.AddLine(
+            "dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key")
+
+        self.ts.Disk.records_config.update({
+            "proxy.config.http.server_ports": f"{self.ts.Variables.port} {self.ts.Variables.ssl_port}:ssl",
+            'proxy.config.ssl.server.cert.path': f"{self.ts.Variables.SSLDir}",
+            'proxy.config.ssl.server.private_key.path': f"{self.ts.Variables.SSLDir}",
+            "proxy.config.diags.debug.enabled": 1,
+            "proxy.config.diags.debug.tags": "http",
+            "proxy.config.http.background_fill_active_timeout": "0",
+            "proxy.config.http.background_fill_completed_threshold": "0.0",
+            "proxy.config.http.cache.required_headers": 0, # Force cache
+            "proxy.config.http.insert_response_via_str": 2,
+        })
+
+        self.ts.Disk.remap_config.AddLines([
+            f"map / http://127.0.0.1:{self.httpbin.Variables.Port}/",
+        ])
+
+    def __startProcess(self, tr):
+        tr.Processes.Default.StartBefore(self.httpbin, ready=When.PortOpen(self.httpbin.Variables.Port))
+        tr.Processes.Default.StartBefore(self.ts)
+
+    def __checkProcessBefore(self, tr):
+        tr.StillRunningBefore = self.httpbin
+        tr.StillRunningBefore = self.ts
+
+    def __checkProcessAfter(self, tr):
+        tr.StillRunningAfter = self.httpbin
+        tr.StillRunningAfter = self.ts
+
+    def __testCase0(self):
+        """
+        HTTP/1.1 over TCP
+        """
+        tr = Test.AddTestRun()
+        self.__startProcess(tr)

Review comment:
       Good suggestion. I combined them. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org