This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 6b34b1614b2075197b8bb831d99a3b2f7cd98486 Author: Brian Neradt <[email protected]> AuthorDate: Mon Feb 1 17:20:04 2021 -0600 Proxy Verifier: Making use of delay directives for caching tests. (#7468) The non-Proxy Verifier tests handle transactions more slowly than Proxy Verifier since they spin up a new AuTest curl process for each one. Proxy Verifier, on the other hand, runs all the transactions in a replay file in one process. It has been observed that certain tests that rely upon caching between transactions can get false negatives because a subsequent transaction occurs before the IO for caching completes. This can also result in false positives too where the inverse happens: the ATS process may be incorrectly trying to cache something it shouldn't, but the test misses it because the subsequent transaction happens too quickly. This makes use of Proxy Verifier's delay directive to slow down certain transactions to give enough time for any IO to complete. --- .../cache/replay/cache-control-max-age.replay.yaml | 28 ++++++++++++++++++++++ ...negative-caching-300-second-timeout.replay.yaml | 4 ++++ .../replay/negative-caching-customized.replay.yaml | 12 ++++++++++ .../replay/negative-caching-default.replay.yaml | 16 +++++++++++++ .../replay/negative-caching-disabled.replay.yaml | 17 +++++++++++++ .../replay/negative-caching-no-timeout.replay.yaml | 4 ++++ .../replay/negative-caching-timeout.replay.yaml | 4 ++++ 7 files changed, 85 insertions(+) diff --git a/tests/gold_tests/cache/replay/cache-control-max-age.replay.yaml b/tests/gold_tests/cache/replay/cache-control-max-age.replay.yaml index ba6305d..8e88e71 100644 --- a/tests/gold_tests/cache/replay/cache-control-max-age.replay.yaml +++ b/tests/gold_tests/cache/replay/cache-control-max-age.replay.yaml @@ -34,6 +34,10 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + - request_for_zero_max_age: &request_for_zero_max_age client-request: method: "GET" @@ -44,6 +48,10 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + - request_for_negative_max_age: &request_for_negative_max_age client-request: method: "GET" @@ -54,6 +62,10 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + - request_for_non_number_max_age: &request_for_non_number_max_age client-request: method: "GET" @@ -64,6 +76,10 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + - 200_ok_response: &200_ok_response server-response: status: 200 @@ -249,6 +265,10 @@ sessions: - [ Host, example.com ] - [ Cache-Control, max-age=300 ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # This should be replied to out of the cache, therefore this 400 response # should not make it to the client. server-response: @@ -296,6 +316,10 @@ sessions: - [ Host, example.com ] - [ Cache-Control, max-age=0 ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # This should go through to the server because the 0 max-age # directive in the request should make ATS consider it stale. server-response: @@ -345,6 +369,10 @@ sessions: - [ Host, example.com ] - [ Cache-Control, max-age=-300 ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # This should go through to the server because the negative max-age # directive in the request should make ATS consider it stale. server-response: diff --git a/tests/gold_tests/cache/replay/negative-caching-300-second-timeout.replay.yaml b/tests/gold_tests/cache/replay/negative-caching-300-second-timeout.replay.yaml index 999b8cd..536c7a6 100644 --- a/tests/gold_tests/cache/replay/negative-caching-300-second-timeout.replay.yaml +++ b/tests/gold_tests/cache/replay/negative-caching-300-second-timeout.replay.yaml @@ -36,6 +36,10 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + sessions: - transactions: diff --git a/tests/gold_tests/cache/replay/negative-caching-customized.replay.yaml b/tests/gold_tests/cache/replay/negative-caching-customized.replay.yaml index 6d51bd3..3b12d46 100644 --- a/tests/gold_tests/cache/replay/negative-caching-customized.replay.yaml +++ b/tests/gold_tests/cache/replay/negative-caching-customized.replay.yaml @@ -72,6 +72,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # Since 404 responses are customized to not be cached, this will go # through. <<: *200_response @@ -115,6 +119,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # By customization, the 400 will be cached and this will not go through. <<: *200_response @@ -151,6 +159,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # This should not go to the server since the 200 response is cached. server-response: status: 400 diff --git a/tests/gold_tests/cache/replay/negative-caching-default.replay.yaml b/tests/gold_tests/cache/replay/negative-caching-default.replay.yaml index f06f30c..0ab66f5 100644 --- a/tests/gold_tests/cache/replay/negative-caching-default.replay.yaml +++ b/tests/gold_tests/cache/replay/negative-caching-default.replay.yaml @@ -69,6 +69,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # 404 responses should be cached when negative caching is enabled, so this # should not get to the server. But if it does, return a 200 so the test # knows that something went wrong. @@ -113,6 +117,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # 400 responses should not be cached. Verify this goes to the server # by returning and expecting a 200 response. <<: *200_response @@ -149,6 +157,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # This should not go to the server, but if it does return a 400 so we catch # it. server-response: @@ -197,6 +209,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # 405 responses should not be cached. Verify this goes to the server # by returning and expecting a 200 response. <<: *200_response diff --git a/tests/gold_tests/cache/replay/negative-caching-disabled.replay.yaml b/tests/gold_tests/cache/replay/negative-caching-disabled.replay.yaml index 1ef338a..d09362a 100644 --- a/tests/gold_tests/cache/replay/negative-caching-disabled.replay.yaml +++ b/tests/gold_tests/cache/replay/negative-caching-disabled.replay.yaml @@ -32,6 +32,10 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + - request_for_path_404: &request_for_path_404 client-request: method: "GET" @@ -42,6 +46,10 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + - request_for_no_cache_control_response: &request_for_no_cache_control_response client-request: method: "GET" @@ -52,6 +60,11 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + + - request_for_404_with_cc: &request_for_404_with_cc client-request: method: "GET" @@ -62,6 +75,10 @@ meta: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + sessions: - transactions: diff --git a/tests/gold_tests/cache/replay/negative-caching-no-timeout.replay.yaml b/tests/gold_tests/cache/replay/negative-caching-no-timeout.replay.yaml index 6f15278..634b141 100644 --- a/tests/gold_tests/cache/replay/negative-caching-no-timeout.replay.yaml +++ b/tests/gold_tests/cache/replay/negative-caching-no-timeout.replay.yaml @@ -39,6 +39,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # This should not go to the server. Verify we get the cached 404 response # instead of this new 403 response. server-response: diff --git a/tests/gold_tests/cache/replay/negative-caching-timeout.replay.yaml b/tests/gold_tests/cache/replay/negative-caching-timeout.replay.yaml index 02cf1e9..1c1e01e 100644 --- a/tests/gold_tests/cache/replay/negative-caching-timeout.replay.yaml +++ b/tests/gold_tests/cache/replay/negative-caching-timeout.replay.yaml @@ -74,6 +74,10 @@ sessions: fields: - [ Host, example.com ] + # Add a delay so ATS has time to finish any caching IO for the previous + # transaction. + delay: 50ms + # 403 responses should be cached when negative caching is enabled, so this # should not get to the server. But if it does, return a 404 so the test # knows that something went wrong.
