Skip to content

Commit

Permalink
chore: update cache tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina authored and github-actions[bot] committed Feb 17, 2025
1 parent 608d5f6 commit 097e05a
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 79 deletions.
18 changes: 6 additions & 12 deletions test/fixtures/cache-tests/results/apache.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"cdn-date-update-exceed": true,
"cdn-expires-update-exceed": [
"Assertion",
"Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:20:15 GMT\""
"Response 2 header Expires is \"null\", not \"Wed, 29 Jan 2025 03:37:47 GMT\""
],
"cdn-fresh-cc-nostore": [
"Assertion",
Expand Down Expand Up @@ -340,10 +340,7 @@
"headers-store-Cache-Control": true,
"headers-store-Clear-Site-Data": true,
"headers-store-Connection": true,
"headers-store-Content-Encoding": [
"AbortError",
"This operation was aborted"
],
"headers-store-Content-Encoding": true,
"headers-store-Content-Foo": true,
"headers-store-Content-Length": true,
"headers-store-Content-Location": true,
Expand Down Expand Up @@ -496,11 +493,11 @@
"other-cookie": true,
"other-date-update": [
"Assertion",
"Response 2 header Date is \"Tue, 21 Jan 2025 00:20:09 GMT\", not \"Tue, 21 Jan 2025 00:20:06 GMT\""
"Response 2 header Date is \"Wed, 29 Jan 2025 03:37:41 GMT\", not \"Wed, 29 Jan 2025 03:37:38 GMT\""
],
"other-date-update-expires": [
"Assertion",
"Response 2 header Date is \"Tue, 21 Jan 2025 00:20:09 GMT\", not \"Tue, 21 Jan 2025 00:20:06 GMT\""
"Response 2 header Date is \"Wed, 29 Jan 2025 03:37:41 GMT\", not \"Wed, 29 Jan 2025 03:37:38 GMT\""
],
"other-date-update-expires-update": true,
"other-fresh-content-disposition-attachment": true,
Expand Down Expand Up @@ -565,17 +562,14 @@
"fetch failed"
],
"stale-close-s-maxage=2": [
"AbortError",
"This operation was aborted"
],
"stale-sie-503": [
"TypeError",
"fetch failed"
],
"stale-sie-close": [
"stale-sie-503": [
"TypeError",
"fetch failed"
],
"stale-sie-close": true,
"stale-warning-become": [
"TypeError",
"fetch failed"
Expand Down
41 changes: 19 additions & 22 deletions test/fixtures/cache-tests/results/nginx.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
"Response 2 comes from cache"
],
"ccreq-ma1": [
"AbortError",
"This operation was aborted"
"Assertion",
"Response 2 comes from cache"
],
"ccreq-magreaterage": [
"Assertion",
Expand All @@ -147,13 +147,10 @@
"Assertion",
"Response 2 does not come from cache"
],
"ccreq-max-stale-age": [
"AbortError",
"This operation was aborted"
],
"ccreq-max-stale-age": true,
"ccreq-min-fresh": [
"AbortError",
"This operation was aborted"
"Assertion",
"Response 2 comes from cache"
],
"ccreq-min-fresh-age": [
"Assertion",
Expand Down Expand Up @@ -184,7 +181,7 @@
"cdn-date-update-exceed": true,
"cdn-expires-update-exceed": [
"Assertion",
"Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:19:03 GMT\""
"Response 2 header Expires is \"null\", not \"Wed, 29 Jan 2025 03:36:49 GMT\""
],
"cdn-fresh-cc-nostore": [
"Assertion",
Expand Down Expand Up @@ -251,7 +248,10 @@
"Response 2 Age header not present."
],
"cdn-remove-header": true,
"conditional-304-etag": true,
"conditional-304-etag": [
"AbortError",
"This operation was aborted"
],
"conditional-etag-forward": [
"Assertion",
"Request 1 header If-None-Match is \"undefined\", not \"\"abcdef\"\""
Expand All @@ -273,10 +273,7 @@
"Assertion",
"Request 2 header If-None-Match is \"abcdef\", not \"\"abcdef\"\""
],
"conditional-etag-strong-respond": [
"AbortError",
"This operation was aborted"
],
"conditional-etag-strong-respond": true,
"conditional-etag-strong-respond-multiple-first": true,
"conditional-etag-strong-respond-multiple-last": true,
"conditional-etag-strong-respond-multiple-second": true,
Expand Down Expand Up @@ -649,11 +646,11 @@
"other-cookie": true,
"other-date-update": [
"Assertion",
"Response 2 header Date is \"Tue, 21 Jan 2025 00:18:57 GMT\", not \"Tue, 21 Jan 2025 00:18:54 GMT\""
"Response 2 header Date is \"Wed, 29 Jan 2025 03:36:43 GMT\", not \"Wed, 29 Jan 2025 03:36:40 GMT\""
],
"other-date-update-expires": [
"Assertion",
"Response 2 header Date is \"Tue, 21 Jan 2025 00:18:57 GMT\", not \"Tue, 21 Jan 2025 00:18:54 GMT\""
"Response 2 header Date is \"Wed, 29 Jan 2025 03:36:43 GMT\", not \"Wed, 29 Jan 2025 03:36:40 GMT\""
],
"other-date-update-expires-update": true,
"other-fresh-content-disposition-attachment": true,
Expand Down Expand Up @@ -811,8 +808,8 @@
"vary-no-match": true,
"vary-normalise-combine": true,
"vary-normalise-lang-case": [
"Assertion",
"Response 2 does not come from cache"
"AbortError",
"This operation was aborted"
],
"vary-normalise-lang-order": [
"Assertion",
Expand Down Expand Up @@ -841,12 +838,12 @@
],
"vary-syntax-star": true,
"vary-syntax-star-foo": [
"AbortError",
"This operation was aborted"
"Assertion",
"Response 2 comes from cache"
],
"vary-syntax-star-star": [
"AbortError",
"This operation was aborted"
"Assertion",
"Response 2 comes from cache"
],
"vary-syntax-star-star-lines": true
}
32 changes: 13 additions & 19 deletions test/fixtures/cache-tests/results/squid.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@
"ccreq-ma1": true,
"ccreq-magreaterage": true,
"ccreq-max-stale": true,
"ccreq-max-stale-age": true,
"ccreq-max-stale-age": [
"Setup",
"Response 1 status is 409, not 200"
],
"ccreq-min-fresh": true,
"ccreq-min-fresh-age": true,
"ccreq-no-cache": true,
Expand All @@ -91,7 +94,7 @@
"cdn-date-update-exceed": true,
"cdn-expires-update-exceed": [
"Assertion",
"Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:17:30 GMT\""
"Response 2 header Expires is \"null\", not \"Mon, 03 Feb 2025 05:33:42 GMT\""
],
"cdn-fresh-cc-nostore": [
"Assertion",
Expand Down Expand Up @@ -440,7 +443,10 @@
"invalidate-DELETE-failed": true,
"invalidate-DELETE-location": true,
"invalidate-M-SEARCH": true,
"invalidate-M-SEARCH-cl": true,
"invalidate-M-SEARCH-cl": [
"TypeError",
"fetch failed"
],
"invalidate-M-SEARCH-failed": [
"Assertion",
"Response 3 does not come from cache"
Expand Down Expand Up @@ -528,22 +534,10 @@
"query-args-same": true,
"stale-503": true,
"stale-close": true,
"stale-close-must-revalidate": [
"Assertion",
"Response 2 comes from cache"
],
"stale-close-no-cache": [
"Assertion",
"Response 2 comes from cache"
],
"stale-close-proxy-revalidate": [
"Assertion",
"Response 2 comes from cache"
],
"stale-close-s-maxage=2": [
"Assertion",
"Response 2 comes from cache"
],
"stale-close-must-revalidate": true,
"stale-close-no-cache": true,
"stale-close-proxy-revalidate": true,
"stale-close-s-maxage=2": true,
"stale-sie-503": true,
"stale-sie-close": true,
"stale-warning-become": [
Expand Down
26 changes: 7 additions & 19 deletions test/fixtures/cache-tests/results/trafficserver.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"cdn-date-update-exceed": true,
"cdn-expires-update-exceed": [
"Assertion",
"Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:21:39 GMT\""
"Response 2 header Expires is \"null\", not \"Mon, 03 Feb 2025 05:35:20 GMT\""
],
"cdn-fresh-cc-nostore": [
"Assertion",
Expand Down Expand Up @@ -469,8 +469,8 @@
"Response 2 status is 403, not 500"
],
"invalidate-DELETE-location": [
"Assertion",
"Response 3 comes from cache"
"Setup",
"Response 2 status is 403, not 200"
],
"invalidate-M-SEARCH": [
"Assertion",
Expand Down Expand Up @@ -570,22 +570,10 @@
"query-args-same": true,
"stale-503": true,
"stale-close": true,
"stale-close-must-revalidate": [
"Assertion",
"Response 2 comes from cache"
],
"stale-close-no-cache": [
"Assertion",
"Response 2 comes from cache"
],
"stale-close-proxy-revalidate": [
"Assertion",
"Response 2 comes from cache"
],
"stale-close-s-maxage=2": [
"Assertion",
"Response 2 comes from cache"
],
"stale-close-must-revalidate": true,
"stale-close-no-cache": true,
"stale-close-proxy-revalidate": true,
"stale-close-s-maxage=2": true,
"stale-sie-503": true,
"stale-sie-close": true,
"stale-warning-become": true,
Expand Down
8 changes: 5 additions & 3 deletions test/fixtures/cache-tests/test-engine/client/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ function checkResponse (test, requests, idx, response) {

// check response status
if ('expected_status' in reqConfig) {
assert(setupCheck(reqConfig, 'expected_status'),
response.status === reqConfig.expected_status,
`Response ${reqNum} status is ${response.status}, not ${reqConfig.expected_status}`)
if (reqConfig.expected_status !== null) {
assert(setupCheck(reqConfig, 'expected_status'),
response.status === reqConfig.expected_status,
`Response ${reqNum} status is ${response.status}, not ${reqConfig.expected_status}`)
}
} else if ('response_status' in reqConfig) {
assert(true, // response status is always setup
response.status === reqConfig.response_status[0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,14 @@
},
"expected_status": {
"description": "Expected response status received by the client",
"$ref": "#/definitions/status-code"
"anyOf": [
{
"$ref": "#/definitions/status-code"
},
{
"type": "null"
}
]
},
"expected_request_headers": {
"description": "Request headers to check for on the server",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/cache-tests/tests/cc-request.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export default {
{
response_headers: [
['Cache-Control', 'max-age=3600'],
['ETag', utils.httpContent('abc')]
['ETag', `"${utils.httpContent('abc')}"`]
],
setup: true
},
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/cache-tests/tests/invalidation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function checkLocationInvalidation (method) {
location({
setup: true
}), lclResponse({
request_method: 'POST',
request_method: method,
request_body: 'abc',
setup: true
}), location({
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/cache-tests/tests/stale.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ function makeStaleCheckCC (cc, sharedOnly, value) {
},
{
disconnect: true,
expected_type: 'not_cached'
expected_status: null,
check_body: false,
expected_response_headers_missing: ['server-request-count']
}
]
}
Expand Down

0 comments on commit 097e05a

Please # to comment.