serrislew commented on code in PR #12092:
URL: https://github.com/apache/trafficserver/pull/12092#discussion_r1994261583


##########
tests/gold_tests/pluginTest/slice/slice_ident.test.py:
##########
@@ -0,0 +1,188 @@
+'''
+'''
+#  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.
+
+import os
+
+Test.Summary = '''
+Slice plugin test for sending ident header
+'''
+
+# Test description:
+# Preload the cache with the entire asset to be range requested.
+# Reload remap rule with slice plugin
+# Request content through the slice plugin
+
+Test.SkipUnless(Condition.PluginExists('slice.so'),)
+Test.ContinueOnFail = False
+
+# configure origin server
+server = Test.MakeOriginServer("server")
+
+# default root
+request_header_chk = {
+    "headers": "GET / HTTP/1.1\r\n" + "Host: ats\r\n" + "Range: none\r\n" + 
"\r\n",
+    "timestamp": "1469733493.993",
+    "body": "",
+}
+
+response_header_chk = {
+    "headers": "HTTP/1.1 200 OK\r\n" + "Connection: close\r\n" + "\r\n",
+    "timestamp": "1469733493.993",
+    "body": "",
+}
+
+server.addResponse("sessionlog.json", request_header_chk, response_header_chk)
+
+block_bytes = 11
+body = "lets go surfin now"
+
+etag = '"foo"'
+last_modified = "Fri, 07 Mar 2025 18:06:58 GMT"
+
+request_etag = {
+    "headers": "GET /etag HTTP/1.1\r\n" + "Host: origin\r\n" + "\r\n",
+    "timestamp": "1469733493.993",
+    "body": "",
+}
+
+response_etag = {
+    "headers":
+        "HTTP/1.1 200 OK\r\n" + "Connection: close\r\n" + f'Etag: {etag}\r\n' 
+ f'Last-Modified: {last_modified}\r\n' +
+        "Cache-Control: max-age=500\r\n" + "\r\n",
+    "timestamp": "1469733493.993",
+    "body": body,
+}
+
+server.addResponse("sessionlog.json", request_etag, response_etag)
+
+request_lm = {
+    "headers": "GET /lm HTTP/1.1\r\n" + "Host: origin\r\n" + "\r\n",
+    "timestamp": "1469733493.993",
+    "body": "",
+}
+
+response_lm = {
+    "headers":
+        "HTTP/1.1 200 OK\r\n" + "Connection: close\r\n" + f'Last-Modified: 
{last_modified}\r\n' + "Cache-Control: max-age=500\r\n" +
+        "\r\n",
+    "timestamp": "1469733493.993",
+    "body": body,
+}
+
+server.addResponse("sessionlog.json", request_lm, response_lm)
+
+# use this second ats instance to serve up the slices
+
+# Define ATS and configure
+ts = Test.MakeATSProcess("ts")
+ts.Disk.records_config.update({
+    'proxy.config.diags.debug.enabled': 1,
+    'proxy.config.diags.debug.tags': 'slice',
+})
+
+ts.Disk.remap_config.AddLines(
+    [
+        f"map http://preload/ http://127.0.0.1:{server.Variables.Port}";,
+        f'map http://slice/ http://127.0.0.1:{server.Variables.Port}' +
+        f' @plugin=slice.so @pparam=--blockbytes-test={block_bytes}',
+        f'map http://slicecustom/ http://127.0.0.1:{server.Variables.Port}' +
+        f' @plugin=slice.so @pparam=--blockbytes-test={block_bytes}' + ' 
@pparam=--crr-ident-header=CrrIdent',

Review Comment:
   I think separate autests is good to isolate the different functionalities. 
Do you think it would be helpful to also have an autest that uses both CRR and 
slice plugin for end to end testing?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to