|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +meta: |
| 18 | + version: "1.0" |
| 19 | + |
| 20 | +# Configuration section for autest integration |
| 21 | +autest: |
| 22 | + description: 'Verify DELETE method handling' |
| 23 | + |
| 24 | + dns: |
| 25 | + name: 'dns-delete' |
| 26 | + |
| 27 | + server: |
| 28 | + name: 'server-delete' |
| 29 | + |
| 30 | + client: |
| 31 | + name: 'client-delete' |
| 32 | + |
| 33 | + ats: |
| 34 | + name: 'ts-cache-delete' |
| 35 | + process_config: |
| 36 | + enable_cache: true |
| 37 | + |
| 38 | + records_config: |
| 39 | + proxy.config.diags.debug.enabled: 1 |
| 40 | + proxy.config.diags.debug.tags: 'http.*|cache.*' |
| 41 | + proxy.config.http.insert_age_in_response: 0 |
| 42 | + |
| 43 | + remap_config: |
| 44 | + - from: "http://example.com/" |
| 45 | + to: "http://backend.example.com:{SERVER_HTTP_PORT}/" |
| 46 | + |
| 47 | +sessions: |
| 48 | +- transactions: |
| 49 | + |
| 50 | + # Populate the cache with a response to a GET request. |
| 51 | + - client-request: |
| 52 | + method: "GET" |
| 53 | + version: "1.1" |
| 54 | + url: /some/path |
| 55 | + headers: |
| 56 | + fields: |
| 57 | + - [ Host, example.com ] |
| 58 | + - [ uuid, 1 ] |
| 59 | + |
| 60 | + server-response: |
| 61 | + status: 200 |
| 62 | + reason: OK |
| 63 | + headers: |
| 64 | + fields: |
| 65 | + - [ Content-Length, 16 ] |
| 66 | + - [ Cache-Control, max-age=300 ] |
| 67 | + - [ X-Response, first_get_response ] |
| 68 | + |
| 69 | + proxy-response: |
| 70 | + status: 200 |
| 71 | + |
| 72 | + # Verify that we reply to the request out of the cache. |
| 73 | + - client-request: |
| 74 | + method: "GET" |
| 75 | + version: "1.1" |
| 76 | + url: /some/path |
| 77 | + headers: |
| 78 | + fields: |
| 79 | + - [ Host, example.com ] |
| 80 | + - [ uuid, 2 ] |
| 81 | + |
| 82 | + # Add a delay so ATS has time to finish any caching IO for the previous transaction. |
| 83 | + delay: 100ms |
| 84 | + |
| 85 | + # The request should be served out of cache, so this 403 should not be |
| 86 | + # received. |
| 87 | + server-response: |
| 88 | + status: 403 |
| 89 | + reason: Forbidden |
| 90 | + |
| 91 | + # ATS should serve the cached 200 response. |
| 92 | + proxy-response: |
| 93 | + status: 200 |
| 94 | + headers: |
| 95 | + fields: |
| 96 | + - [ X-Response, { value: first_get_response, as: equal} ] |
| 97 | + |
| 98 | + # Verify that we do NOT purge cache if origin returns error response for DELETE request |
| 99 | + - client-request: |
| 100 | + method: "DELETE" |
| 101 | + version: "1.1" |
| 102 | + url: /some/path |
| 103 | + headers: |
| 104 | + fields: |
| 105 | + - [ Host, example.com ] |
| 106 | + - [ uuid, 3 ] |
| 107 | + |
| 108 | + # DELETE request is not allowed |
| 109 | + server-response: |
| 110 | + status: 405 |
| 111 | + reason: Method Not Allowed |
| 112 | + |
| 113 | + # ATS should forward the response from origin server |
| 114 | + proxy-response: |
| 115 | + status: 405 |
| 116 | + reason: Method Not Allowed |
| 117 | + |
| 118 | + - client-request: |
| 119 | + method: "GET" |
| 120 | + version: "1.1" |
| 121 | + url: /some/path |
| 122 | + headers: |
| 123 | + fields: |
| 124 | + - [ Host, example.com ] |
| 125 | + - [ uuid, 4 ] |
| 126 | + |
| 127 | + # The request should be served out of cache, so this 403 should not be |
| 128 | + # received. |
| 129 | + server-response: |
| 130 | + status: 403 |
| 131 | + reason: Forbidden |
| 132 | + |
| 133 | + # ATS should serve the cached 200 response. |
| 134 | + proxy-response: |
| 135 | + status: 200 |
| 136 | + headers: |
| 137 | + fields: |
| 138 | + - [ X-Response, { value: first_get_response, as: equal} ] |
| 139 | + |
| 140 | + # Verify that we "purge" cache if origin returns non-error response for DELETE request |
| 141 | + - client-request: |
| 142 | + method: "DELETE" |
| 143 | + version: "1.1" |
| 144 | + url: /some/path |
| 145 | + headers: |
| 146 | + fields: |
| 147 | + - [ Host, example.com ] |
| 148 | + - [ uuid, 5 ] |
| 149 | + |
| 150 | + # DELETE request is accepted |
| 151 | + server-response: |
| 152 | + status: 204 |
| 153 | + reason: No Content |
| 154 | + |
| 155 | + # ATS should forward the response from origin server |
| 156 | + proxy-response: |
| 157 | + status: 204 |
| 158 | + reason: No Content |
| 159 | + |
| 160 | + # Verify that we cache is purged by DELETE request and returns cache miss |
| 161 | + - client-request: |
| 162 | + method: "GET" |
| 163 | + version: "1.1" |
| 164 | + url: /some/path |
| 165 | + headers: |
| 166 | + fields: |
| 167 | + - [ Host, example.com ] |
| 168 | + - [ uuid, 6 ] |
| 169 | + |
| 170 | + # Add a delay so ATS has time to finish any caching IO for the previous transaction. |
| 171 | + delay: 100ms |
| 172 | + |
| 173 | + server-response: |
| 174 | + status: 200 |
| 175 | + reason: OK |
| 176 | + headers: |
| 177 | + fields: |
| 178 | + - [ Content-Length, 32 ] |
| 179 | + - [ Cache-Control, max-age=300 ] |
| 180 | + - [ X-Response, second_get_response ] |
| 181 | + |
| 182 | + # ATS should serve the 200 response. |
| 183 | + proxy-response: |
| 184 | + status: 200 |
| 185 | + headers: |
| 186 | + fields: |
| 187 | + - [ X-Response, { value: second_get_response, as: equal} ] |
0 commit comments