Skip to content

Commit efed4c3

Browse files
mcollinagithub-actions[bot]
authored andcommitted
chore: update cache tests
1 parent f11ae94 commit efed4c3

File tree

9 files changed

+63
-79
lines changed

9 files changed

+63
-79
lines changed

test/fixtures/cache-tests/results/apache.json

+6-12
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"cdn-date-update-exceed": true,
101101
"cdn-expires-update-exceed": [
102102
"Assertion",
103-
"Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:20:15 GMT\""
103+
"Response 2 header Expires is \"null\", not \"Wed, 29 Jan 2025 03:37:47 GMT\""
104104
],
105105
"cdn-fresh-cc-nostore": [
106106
"Assertion",
@@ -340,10 +340,7 @@
340340
"headers-store-Cache-Control": true,
341341
"headers-store-Clear-Site-Data": true,
342342
"headers-store-Connection": true,
343-
"headers-store-Content-Encoding": [
344-
"AbortError",
345-
"This operation was aborted"
346-
],
343+
"headers-store-Content-Encoding": true,
347344
"headers-store-Content-Foo": true,
348345
"headers-store-Content-Length": true,
349346
"headers-store-Content-Location": true,
@@ -496,11 +493,11 @@
496493
"other-cookie": true,
497494
"other-date-update": [
498495
"Assertion",
499-
"Response 2 header Date is \"Tue, 21 Jan 2025 00:20:09 GMT\", not \"Tue, 21 Jan 2025 00:20:06 GMT\""
496+
"Response 2 header Date is \"Wed, 29 Jan 2025 03:37:41 GMT\", not \"Wed, 29 Jan 2025 03:37:38 GMT\""
500497
],
501498
"other-date-update-expires": [
502499
"Assertion",
503-
"Response 2 header Date is \"Tue, 21 Jan 2025 00:20:09 GMT\", not \"Tue, 21 Jan 2025 00:20:06 GMT\""
500+
"Response 2 header Date is \"Wed, 29 Jan 2025 03:37:41 GMT\", not \"Wed, 29 Jan 2025 03:37:38 GMT\""
504501
],
505502
"other-date-update-expires-update": true,
506503
"other-fresh-content-disposition-attachment": true,
@@ -565,17 +562,14 @@
565562
"fetch failed"
566563
],
567564
"stale-close-s-maxage=2": [
568-
"AbortError",
569-
"This operation was aborted"
570-
],
571-
"stale-sie-503": [
572565
"TypeError",
573566
"fetch failed"
574567
],
575-
"stale-sie-close": [
568+
"stale-sie-503": [
576569
"TypeError",
577570
"fetch failed"
578571
],
572+
"stale-sie-close": true,
579573
"stale-warning-become": [
580574
"TypeError",
581575
"fetch failed"

test/fixtures/cache-tests/results/nginx.json

+19-22
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@
136136
"Response 2 comes from cache"
137137
],
138138
"ccreq-ma1": [
139-
"AbortError",
140-
"This operation was aborted"
139+
"Assertion",
140+
"Response 2 comes from cache"
141141
],
142142
"ccreq-magreaterage": [
143143
"Assertion",
@@ -147,13 +147,10 @@
147147
"Assertion",
148148
"Response 2 does not come from cache"
149149
],
150-
"ccreq-max-stale-age": [
151-
"AbortError",
152-
"This operation was aborted"
153-
],
150+
"ccreq-max-stale-age": true,
154151
"ccreq-min-fresh": [
155-
"AbortError",
156-
"This operation was aborted"
152+
"Assertion",
153+
"Response 2 comes from cache"
157154
],
158155
"ccreq-min-fresh-age": [
159156
"Assertion",
@@ -184,7 +181,7 @@
184181
"cdn-date-update-exceed": true,
185182
"cdn-expires-update-exceed": [
186183
"Assertion",
187-
"Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:19:03 GMT\""
184+
"Response 2 header Expires is \"null\", not \"Wed, 29 Jan 2025 03:36:49 GMT\""
188185
],
189186
"cdn-fresh-cc-nostore": [
190187
"Assertion",
@@ -251,7 +248,10 @@
251248
"Response 2 Age header not present."
252249
],
253250
"cdn-remove-header": true,
254-
"conditional-304-etag": true,
251+
"conditional-304-etag": [
252+
"AbortError",
253+
"This operation was aborted"
254+
],
255255
"conditional-etag-forward": [
256256
"Assertion",
257257
"Request 1 header If-None-Match is \"undefined\", not \"\"abcdef\"\""
@@ -273,10 +273,7 @@
273273
"Assertion",
274274
"Request 2 header If-None-Match is \"abcdef\", not \"\"abcdef\"\""
275275
],
276-
"conditional-etag-strong-respond": [
277-
"AbortError",
278-
"This operation was aborted"
279-
],
276+
"conditional-etag-strong-respond": true,
280277
"conditional-etag-strong-respond-multiple-first": true,
281278
"conditional-etag-strong-respond-multiple-last": true,
282279
"conditional-etag-strong-respond-multiple-second": true,
@@ -649,11 +646,11 @@
649646
"other-cookie": true,
650647
"other-date-update": [
651648
"Assertion",
652-
"Response 2 header Date is \"Tue, 21 Jan 2025 00:18:57 GMT\", not \"Tue, 21 Jan 2025 00:18:54 GMT\""
649+
"Response 2 header Date is \"Wed, 29 Jan 2025 03:36:43 GMT\", not \"Wed, 29 Jan 2025 03:36:40 GMT\""
653650
],
654651
"other-date-update-expires": [
655652
"Assertion",
656-
"Response 2 header Date is \"Tue, 21 Jan 2025 00:18:57 GMT\", not \"Tue, 21 Jan 2025 00:18:54 GMT\""
653+
"Response 2 header Date is \"Wed, 29 Jan 2025 03:36:43 GMT\", not \"Wed, 29 Jan 2025 03:36:40 GMT\""
657654
],
658655
"other-date-update-expires-update": true,
659656
"other-fresh-content-disposition-attachment": true,
@@ -811,8 +808,8 @@
811808
"vary-no-match": true,
812809
"vary-normalise-combine": true,
813810
"vary-normalise-lang-case": [
814-
"Assertion",
815-
"Response 2 does not come from cache"
811+
"AbortError",
812+
"This operation was aborted"
816813
],
817814
"vary-normalise-lang-order": [
818815
"Assertion",
@@ -841,12 +838,12 @@
841838
],
842839
"vary-syntax-star": true,
843840
"vary-syntax-star-foo": [
844-
"AbortError",
845-
"This operation was aborted"
841+
"Assertion",
842+
"Response 2 comes from cache"
846843
],
847844
"vary-syntax-star-star": [
848-
"AbortError",
849-
"This operation was aborted"
845+
"Assertion",
846+
"Response 2 comes from cache"
850847
],
851848
"vary-syntax-star-star-lines": true
852849
}

test/fixtures/cache-tests/results/squid.json

+13-19
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@
6969
"ccreq-ma1": true,
7070
"ccreq-magreaterage": true,
7171
"ccreq-max-stale": true,
72-
"ccreq-max-stale-age": true,
72+
"ccreq-max-stale-age": [
73+
"Setup",
74+
"Response 1 status is 409, not 200"
75+
],
7376
"ccreq-min-fresh": true,
7477
"ccreq-min-fresh-age": true,
7578
"ccreq-no-cache": true,
@@ -91,7 +94,7 @@
9194
"cdn-date-update-exceed": true,
9295
"cdn-expires-update-exceed": [
9396
"Assertion",
94-
"Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:17:30 GMT\""
97+
"Response 2 header Expires is \"null\", not \"Mon, 03 Feb 2025 05:33:42 GMT\""
9598
],
9699
"cdn-fresh-cc-nostore": [
97100
"Assertion",
@@ -440,7 +443,10 @@
440443
"invalidate-DELETE-failed": true,
441444
"invalidate-DELETE-location": true,
442445
"invalidate-M-SEARCH": true,
443-
"invalidate-M-SEARCH-cl": true,
446+
"invalidate-M-SEARCH-cl": [
447+
"TypeError",
448+
"fetch failed"
449+
],
444450
"invalidate-M-SEARCH-failed": [
445451
"Assertion",
446452
"Response 3 does not come from cache"
@@ -528,22 +534,10 @@
528534
"query-args-same": true,
529535
"stale-503": true,
530536
"stale-close": true,
531-
"stale-close-must-revalidate": [
532-
"Assertion",
533-
"Response 2 comes from cache"
534-
],
535-
"stale-close-no-cache": [
536-
"Assertion",
537-
"Response 2 comes from cache"
538-
],
539-
"stale-close-proxy-revalidate": [
540-
"Assertion",
541-
"Response 2 comes from cache"
542-
],
543-
"stale-close-s-maxage=2": [
544-
"Assertion",
545-
"Response 2 comes from cache"
546-
],
537+
"stale-close-must-revalidate": true,
538+
"stale-close-no-cache": true,
539+
"stale-close-proxy-revalidate": true,
540+
"stale-close-s-maxage=2": true,
547541
"stale-sie-503": true,
548542
"stale-sie-close": true,
549543
"stale-warning-become": [

test/fixtures/cache-tests/results/trafficserver.json

+7-19
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"cdn-date-update-exceed": true,
9898
"cdn-expires-update-exceed": [
9999
"Assertion",
100-
"Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:21:39 GMT\""
100+
"Response 2 header Expires is \"null\", not \"Mon, 03 Feb 2025 05:35:20 GMT\""
101101
],
102102
"cdn-fresh-cc-nostore": [
103103
"Assertion",
@@ -469,8 +469,8 @@
469469
"Response 2 status is 403, not 500"
470470
],
471471
"invalidate-DELETE-location": [
472-
"Assertion",
473-
"Response 3 comes from cache"
472+
"Setup",
473+
"Response 2 status is 403, not 200"
474474
],
475475
"invalidate-M-SEARCH": [
476476
"Assertion",
@@ -570,22 +570,10 @@
570570
"query-args-same": true,
571571
"stale-503": true,
572572
"stale-close": true,
573-
"stale-close-must-revalidate": [
574-
"Assertion",
575-
"Response 2 comes from cache"
576-
],
577-
"stale-close-no-cache": [
578-
"Assertion",
579-
"Response 2 comes from cache"
580-
],
581-
"stale-close-proxy-revalidate": [
582-
"Assertion",
583-
"Response 2 comes from cache"
584-
],
585-
"stale-close-s-maxage=2": [
586-
"Assertion",
587-
"Response 2 comes from cache"
588-
],
573+
"stale-close-must-revalidate": true,
574+
"stale-close-no-cache": true,
575+
"stale-close-proxy-revalidate": true,
576+
"stale-close-s-maxage=2": true,
589577
"stale-sie-503": true,
590578
"stale-sie-close": true,
591579
"stale-warning-become": true,

test/fixtures/cache-tests/test-engine/client/test.mjs

+5-3
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ function checkResponse (test, requests, idx, response) {
115115

116116
// check response status
117117
if ('expected_status' in reqConfig) {
118-
assert(setupCheck(reqConfig, 'expected_status'),
119-
response.status === reqConfig.expected_status,
120-
`Response ${reqNum} status is ${response.status}, not ${reqConfig.expected_status}`)
118+
if (reqConfig.expected_status !== null) {
119+
assert(setupCheck(reqConfig, 'expected_status'),
120+
response.status === reqConfig.expected_status,
121+
`Response ${reqNum} status is ${response.status}, not ${reqConfig.expected_status}`)
122+
}
121123
} else if ('response_status' in reqConfig) {
122124
assert(true, // response status is always setup
123125
response.status === reqConfig.response_status[0],

test/fixtures/cache-tests/test-engine/lib/testsuite-schema.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,14 @@
218218
},
219219
"expected_status": {
220220
"description": "Expected response status received by the client",
221-
"$ref": "#/definitions/status-code"
221+
"anyOf": [
222+
{
223+
"$ref": "#/definitions/status-code"
224+
},
225+
{
226+
"type": "null"
227+
}
228+
]
222229
},
223230
"expected_request_headers": {
224231
"description": "Request headers to check for on the server",

test/fixtures/cache-tests/tests/cc-request.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export default {
194194
{
195195
response_headers: [
196196
['Cache-Control', 'max-age=3600'],
197-
['ETag', utils.httpContent('abc')]
197+
['ETag', `"${utils.httpContent('abc')}"`]
198198
],
199199
setup: true
200200
},

test/fixtures/cache-tests/tests/invalidation.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function checkLocationInvalidation (method) {
7171
location({
7272
setup: true
7373
}), lclResponse({
74-
request_method: 'POST',
74+
request_method: method,
7575
request_body: 'abc',
7676
setup: true
7777
}), location({

test/fixtures/cache-tests/tests/stale.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ function makeStaleCheckCC (cc, sharedOnly, value) {
1818
},
1919
{
2020
disconnect: true,
21-
expected_type: 'not_cached'
21+
expected_status: null,
22+
check_body: false,
23+
expected_response_headers_missing: ['server-request-count']
2224
}
2325
]
2426
}

0 commit comments

Comments
 (0)