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

#
# Try a get request on /path/404_300_second_timeout and verify it is still in
# the cache. This is used to verify that the object was not aged out of the
# cache.
#

meta:
  version: "1.0"

sessions:
- transactions:

  #
  # Test 1: Verify that the 404 response is is still valid.
  #
  - all: { headers: { fields: [[ uuid, 23 ]]}}
    client-request:
      method: "GET"
      version: "1.1"
      scheme: "http"
      url: /path/404_300_second_timeout
      headers:
        fields:
        - [ Host, example.com ]

      # Add a delay so ATS has time to finish any caching IO for the previous
      # transaction.
      delay: 100ms

    # This should not go to the server. Verify we get the cached 404 response
    # instead of this new 403 response.
    server-response:
      status: 403
      reason: "Forbidden"
      headers:
        fields:
        - [ Content-Length, 8 ]

    # Expect the cached 404 response.
    proxy-response:
      status: 404
