bneradt commented on code in PR #12310:
URL: https://github.com/apache/trafficserver/pull/12310#discussion_r2193620221


##########
tests/gold_tests/pluginTest/conf_remap/replay/conf_remap.replay.yaml:
##########
@@ -0,0 +1,153 @@
+#  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.
+
+#
+# This replay file assumes a negative caching configuration in which 400
+# responses, and only 400 responses, are cached. This is done via
+# `proxy.config.http.negative_caching_list`.
+#
+
+meta:
+  version: "1.0"
+
+  blocks:
+  - 200_response: &200_response
+      server-response:
+        status: 200
+        reason: OK
+        headers:
+          fields:
+          - [ Content-Length, 16 ]
+          - [ Cache-Control, max-age=10 ]
+
+  - 404_response: &404_response
+      server-response:
+        status: 404
+        reason: "Not Found"
+        headers:
+          fields:
+          - [ Content-Length, 0 ]
+
+  - 503_response: &503_response
+      server-response:
+        status: 503
+        reason: "Service Unavailable"
+        headers:
+          fields:
+          - [ Content-Length, 0 ]
+
+sessions:
+- transactions:
+
+  #
+  # Test 1: Verify that a 503 response is cached with default 
`negative_caching_list` config
+  #
+  - all: { headers: { fields: [[ uuid, 1 ]]}}
+    client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url: /default_negative_caching_list/
+      headers:
+        fields:
+        - [ Host, example.com ]
+
+    <<: *503_response
+
+    proxy-response:
+      status: 503
+
+  # Request the same item again. It should be cached
+  - all: { headers: { fields: [[ uuid, 2 ]]}}
+    client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url:  /default_negative_caching_list/
+      headers:
+        fields:
+        - [ Host, example.com ]
+
+      # Add a delay so ATS has time to finish any caching IO for the previous 
transaction.
+      delay: 100ms
+
+    # By negative caching, the 503 will be cached and this will not go through.
+    <<: *200_response
+
+    # Expect the server's 200 response.
+    proxy-response:
+      status: 503
+
+  #
+  # Test 2: Verify that a 503 response is not cached with custom 
`negative_caching_list` config
+  #
+  - all: { headers: { fields: [[ uuid, 3 ]]}}
+    client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url: /custom_negative_caching_list/
+      headers:
+        fields:
+        - [ Host, example.com ]
+
+    <<: *503_response
+
+    proxy-response:
+      status: 503
+
+  # Request the same item again. It should not be cached
+  - all: { headers: { fields: [[ uuid, 4 ]]}}
+    client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url:  /custom_negative_caching_list/
+      headers:
+        fields:
+        - [ Host, example.com ]
+
+      # Add a delay so ATS has time to finish any caching IO for the previous 
transaction.
+      delay: 100ms
+
+    # By custom `negative_caching_list` config, the 503 is not cached
+    <<: *404_response
+
+    # Expect the server's 404 response.
+    proxy-response:
+      status: 404
+
+  # Request the same item again. It should be cached by negative caching
+  - all: { headers: { fields: [[ uuid, 5 ]]}}
+    client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url:  /custom_negative_caching_list/
+      headers:
+        fields:
+        - [ Host, example.com ]
+
+      # Add a delay so ATS has time to finish any caching IO for the previous 
transaction.
+      delay: 100ms
+
+    # By customization, the 404 will be cached and this will not go through.
+    <<: *200_response
+
+    # Expect the server's 404 response.
+    proxy-response:
+      status: 404

Review Comment:
   `# Expect the cached 404 response.`



##########
tests/gold_tests/pluginTest/conf_remap/replay/conf_remap.replay.yaml:
##########
@@ -0,0 +1,153 @@
+#  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.
+
+#
+# This replay file assumes a negative caching configuration in which 400
+# responses, and only 400 responses, are cached. This is done via
+# `proxy.config.http.negative_caching_list`.
+#
+
+meta:
+  version: "1.0"
+
+  blocks:
+  - 200_response: &200_response
+      server-response:
+        status: 200
+        reason: OK
+        headers:
+          fields:
+          - [ Content-Length, 16 ]
+          - [ Cache-Control, max-age=10 ]
+
+  - 404_response: &404_response
+      server-response:
+        status: 404
+        reason: "Not Found"
+        headers:
+          fields:
+          - [ Content-Length, 0 ]
+
+  - 503_response: &503_response
+      server-response:
+        status: 503
+        reason: "Service Unavailable"
+        headers:
+          fields:
+          - [ Content-Length, 0 ]
+
+sessions:
+- transactions:
+
+  #
+  # Test 1: Verify that a 503 response is cached with default 
`negative_caching_list` config
+  #
+  - all: { headers: { fields: [[ uuid, 1 ]]}}
+    client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url: /default_negative_caching_list/
+      headers:
+        fields:
+        - [ Host, example.com ]
+
+    <<: *503_response
+
+    proxy-response:
+      status: 503
+
+  # Request the same item again. It should be cached
+  - all: { headers: { fields: [[ uuid, 2 ]]}}
+    client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url:  /default_negative_caching_list/
+      headers:
+        fields:
+        - [ Host, example.com ]
+
+      # Add a delay so ATS has time to finish any caching IO for the previous 
transaction.
+      delay: 100ms
+
+    # By negative caching, the 503 will be cached and this will not go through.
+    <<: *200_response
+
+    # Expect the server's 200 response.
+    proxy-response:
+      status: 503

Review Comment:
   Comment update: `# Expect the cached 503 response`



-- 
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: github-unsubscr...@trafficserver.apache.org

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

Reply via email to