From f0ffe1ff116a660c43119e6cc3e93217745fbf92 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 00:59:35 -0800 Subject: [PATCH] chore: update cache tests (#4020) Co-authored-by: mcollina <52195+mcollina@users.noreply.github.com> --- test/fixtures/cache-tests/results/apache.json | 52 ++++++++----- test/fixtures/cache-tests/results/caddy.json | 73 ++++++++----------- test/fixtures/cache-tests/results/fastly.json | 11 +-- .../fixtures/cache-tests/results/firefox.json | 10 +-- test/fixtures/cache-tests/results/index.mjs | 18 ++--- test/fixtures/cache-tests/results/nginx.json | 53 +++++++------- test/fixtures/cache-tests/results/safari.json | 32 ++++---- test/fixtures/cache-tests/results/squid.json | 2 +- .../cache-tests/results/trafficserver.json | 2 +- .../fixtures/cache-tests/results/varnish.json | 7 +- test/fixtures/cache-tests/test-engine/cli.mjs | 3 +- .../cache-tests/test-engine/client/config.mjs | 11 --- .../test-engine/client/fetching.mjs | 2 +- .../cache-tests/test-engine/client/runner.mjs | 3 +- .../cache-tests/test-engine/client/test.mjs | 10 +-- .../cache-tests/test-engine/client/utils.mjs | 4 +- .../cache-tests/tests/lib/templates.mjs | 2 +- 17 files changed, 138 insertions(+), 157 deletions(-) diff --git a/test/fixtures/cache-tests/results/apache.json b/test/fixtures/cache-tests/results/apache.json index bba8e0994df..89072ab2633 100644 --- a/test/fixtures/cache-tests/results/apache.json +++ b/test/fixtures/cache-tests/results/apache.json @@ -100,7 +100,7 @@ "cdn-date-update-exceed": true, "cdn-expires-update-exceed": [ "Assertion", - "Response 2 header Expires is \"null\", not \"Tue, 09 Jul 2024 01:05:30 GMT\"" + "Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:20:15 GMT\"" ], "cdn-fresh-cc-nostore": [ "Assertion", @@ -340,7 +340,10 @@ "headers-store-Cache-Control": true, "headers-store-Clear-Site-Data": true, "headers-store-Connection": true, - "headers-store-Content-Encoding": true, + "headers-store-Content-Encoding": [ + "AbortError", + "This operation was aborted" + ], "headers-store-Content-Foo": true, "headers-store-Content-Length": true, "headers-store-Content-Location": true, @@ -493,11 +496,11 @@ "other-cookie": true, "other-date-update": [ "Assertion", - "Response 2 header Date is \"Tue, 09 Jul 2024 01:05:24 GMT\", not \"Tue, 09 Jul 2024 01:05:21 GMT\"" + "Response 2 header Date is \"Tue, 21 Jan 2025 00:20:09 GMT\", not \"Tue, 21 Jan 2025 00:20:06 GMT\"" ], "other-date-update-expires": [ "Assertion", - "Response 2 header Date is \"Tue, 09 Jul 2024 01:05:24 GMT\", not \"Tue, 09 Jul 2024 01:05:21 GMT\"" + "Response 2 header Date is \"Tue, 21 Jan 2025 00:20:09 GMT\", not \"Tue, 21 Jan 2025 00:20:06 GMT\"" ], "other-date-update-expires-update": true, "other-fresh-content-disposition-attachment": true, @@ -545,27 +548,42 @@ "query-args-different": true, "query-args-same": true, "stale-503": true, - "stale-close": true, + "stale-close": [ + "TypeError", + "fetch failed" + ], "stale-close-must-revalidate": [ - "Assertion", - "Response 2 comes from cache" + "TypeError", + "fetch failed" ], "stale-close-no-cache": [ - "Assertion", - "Response 2 comes from cache" + "TypeError", + "fetch failed" ], "stale-close-proxy-revalidate": [ - "Assertion", - "Response 2 comes from cache" + "TypeError", + "fetch failed" ], "stale-close-s-maxage=2": [ - "Assertion", - "Response 2 comes from cache" + "AbortError", + "This operation was aborted" + ], + "stale-sie-503": [ + "TypeError", + "fetch failed" + ], + "stale-sie-close": [ + "TypeError", + "fetch failed" + ], + "stale-warning-become": [ + "TypeError", + "fetch failed" + ], + "stale-warning-stored": [ + "TypeError", + "fetch failed" ], - "stale-sie-503": true, - "stale-sie-close": true, - "stale-warning-become": true, - "stale-warning-stored": true, "stale-while-revalidate": [ "Assertion", "Response 2 does not come from cache" diff --git a/test/fixtures/cache-tests/results/caddy.json b/test/fixtures/cache-tests/results/caddy.json index e29f0dca42f..d45ef15d4a9 100644 --- a/test/fixtures/cache-tests/results/caddy.json +++ b/test/fixtures/cache-tests/results/caddy.json @@ -178,7 +178,7 @@ "cdn-date-update-exceed": true, "cdn-expires-update-exceed": [ "Assertion", - "Response 2 header Expires is \"null\", not \"Tue, 09 Jul 2024 01:03:11 GMT\"" + "Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:23:23 GMT\"" ], "cdn-fresh-cc-nostore": true, "cdn-max-age": true, @@ -205,7 +205,10 @@ "Assertion", "Response 2 comes from cache" ], - "cdn-no-store-cc-fresh": true, + "cdn-no-store-cc-fresh": [ + "Assertion", + "Response 2 comes from cache" + ], "cdn-private": true, "cdn-remove-age-exceed": [ "Assertion", @@ -287,28 +290,28 @@ "Assertion", "Response 2 does not come from cache" ], - "freshness-expires-age-fast-date": true, - "freshness-expires-age-slow-date": true, - "freshness-expires-ansi-c": [ + "freshness-expires-age-fast-date": [ "Assertion", - "Response 2 does not come from cache" + "Response 2 comes from cache" ], - "freshness-expires-far-future": [ + "freshness-expires-age-slow-date": [ + "Assertion", + "Response 2 comes from cache" + ], + "freshness-expires-ansi-c": [ "Assertion", "Response 2 does not come from cache" ], - "freshness-expires-future": [ + "freshness-expires-far-future": [ "Assertion", "Response 2 does not come from cache" ], + "freshness-expires-future": true, "freshness-expires-invalid": true, "freshness-expires-invalid-1-digit-hour": true, "freshness-expires-invalid-2-digit-year": true, "freshness-expires-invalid-aest": true, - "freshness-expires-invalid-date": [ - "Assertion", - "Response 2 does not come from cache" - ], + "freshness-expires-invalid-date": true, "freshness-expires-invalid-date-dashes": true, "freshness-expires-invalid-multiple-lines": true, "freshness-expires-invalid-multiple-spaces": true, @@ -390,25 +393,22 @@ "freshness-none": true, "freshness-s-maxage-shared": true, "head-200-freshness-update": [ - "FetchError", - "request to http://localhost:8006/test/3a29d44d-d103-492b-9046-be67546d71d7 failed, reason: Parse Error: Empty Content-Length" + "Assertion", + "Response 3 does not come from cache" ], "head-200-retain": [ - "FetchError", - "request to http://localhost:8006/test/d07b2651-4270-4ea6-ae9f-041b1b82aae8 failed, reason: Parse Error: Empty Content-Length" + "Assertion", + "Response 2 header Template-A is \"null\", not \"1\"" ], "head-200-update": [ - "FetchError", - "request to http://localhost:8006/test/eb317c8b-cea4-4b4c-b72b-71df1aa6e863 failed, reason: Parse Error: Empty Content-Length" + "Setup", + "Response 3 does not come from cache" ], "head-410-update": [ - "FetchError", - "request to http://localhost:8006/test/7f947275-bffe-4c72-a493-c64352423d8e failed, reason: Parse Error: Empty Content-Length" - ], - "head-writethrough": [ - "FetchError", - "request to http://localhost:8006/test/f9b80f6e-7980-4a44-ae58-d58ac539223c failed, reason: Parse Error: Empty Content-Length" + "Setup", + "Response 3 does not come from cache" ], + "head-writethrough": true, "headers-omit-headers-listed-in-Cache-Control-no-cache": [ "Setup", "Response 2 does not come from cache" @@ -586,10 +586,7 @@ "Response 1 age header not present." ], "other-age-gen": true, - "other-age-update-expires": [ - "Assertion", - "Response 2 does not come from cache" - ], + "other-age-update-expires": true, "other-age-update-max-age": true, "other-authorization": true, "other-authorization-must-revalidate": [ @@ -606,14 +603,8 @@ ], "other-cookie": true, "other-date-update": true, - "other-date-update-expires": [ - "Assertion", - "Response 2 does not come from cache" - ], - "other-date-update-expires-update": [ - "Assertion", - "Response 2 does not come from cache" - ], + "other-date-update-expires": true, + "other-date-update-expires-update": true, "other-fresh-content-disposition-attachment": true, "other-heuristic-content-disposition-attachment": [ "Assertion", @@ -658,10 +649,7 @@ "Response 2 status is 200, not 206" ], "pragma-request-extension": true, - "pragma-request-no-cache": [ - "Assertion", - "Response 2 does not come from cache" - ], + "pragma-request-no-cache": true, "pragma-response-extension": true, "pragma-response-no-cache": true, "pragma-response-no-cache-heuristic": [ @@ -806,10 +794,7 @@ "vary-invalidate": true, "vary-match": true, "vary-no-match": true, - "vary-normalise-combine": [ - "Assertion", - "Response 2 does not come from cache" - ], + "vary-normalise-combine": true, "vary-normalise-lang-case": [ "Assertion", "Response 2 does not come from cache" diff --git a/test/fixtures/cache-tests/results/fastly.json b/test/fixtures/cache-tests/results/fastly.json index c380900b700..bbf11332be0 100644 --- a/test/fixtures/cache-tests/results/fastly.json +++ b/test/fixtures/cache-tests/results/fastly.json @@ -172,7 +172,7 @@ "cdn-date-update-exceed": true, "cdn-expires-update-exceed": [ "Assertion", - "Response 2 header Expires is \"null\", not \"Tue, 09 Jul 2024 01:17:30 GMT\"" + "Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:41:28 GMT\"" ], "cdn-fresh-cc-nostore": [ "Assertion", @@ -637,11 +637,11 @@ "other-cookie": true, "other-date-update": [ "Assertion", - "Response 2 header Date is \"Tue, 09 Jul 2024 01:17:25 GMT\", not \"Tue, 09 Jul 2024 01:17:22 GMT\"" + "Response 2 header Date is \"Tue, 21 Jan 2025 00:41:23 GMT\", not \"Tue, 21 Jan 2025 00:41:20 GMT\"" ], "other-date-update-expires": [ "Assertion", - "Response 2 header Date is \"Tue, 09 Jul 2024 01:17:25 GMT\", not \"Tue, 09 Jul 2024 01:17:22 GMT\"" + "Response 2 header Date is \"Tue, 21 Jan 2025 00:41:23 GMT\", not \"Tue, 21 Jan 2025 00:41:20 GMT\"" ], "other-date-update-expires-update": true, "other-fresh-content-disposition-attachment": true, @@ -821,10 +821,7 @@ "vary-invalidate": true, "vary-match": true, "vary-no-match": true, - "vary-normalise-combine": [ - "Assertion", - "Response 2 does not come from cache" - ], + "vary-normalise-combine": true, "vary-normalise-lang-case": [ "Assertion", "Response 2 does not come from cache" diff --git a/test/fixtures/cache-tests/results/firefox.json b/test/fixtures/cache-tests/results/firefox.json index 6757050ea7c..2c3e5a87e67 100644 --- a/test/fixtures/cache-tests/results/firefox.json +++ b/test/fixtures/cache-tests/results/firefox.json @@ -73,10 +73,7 @@ "cc-resp-must-revalidate-fresh": true, "cc-resp-must-revalidate-stale": true, "cc-resp-no-cache": true, - "cc-resp-no-cache-case-insensitive": [ - "Assertion", - "Response 2 comes from cache" - ], + "cc-resp-no-cache-case-insensitive": true, "cc-resp-no-cache-revalidate": true, "cc-resp-no-cache-revalidate-fresh": true, "cc-resp-no-store": true, @@ -179,10 +176,7 @@ "Response 2 does not come from cache" ], "freshness-max-age-age": true, - "freshness-max-age-case-insenstive": [ - "Assertion", - "Response 2 does not come from cache" - ], + "freshness-max-age-case-insenstive": true, "freshness-max-age-date": true, "freshness-max-age-decimal-five": true, "freshness-max-age-decimal-zero": true, diff --git a/test/fixtures/cache-tests/results/index.mjs b/test/fixtures/cache-tests/results/index.mjs index e8204031ea0..3d1afde079f 100644 --- a/test/fixtures/cache-tests/results/index.mjs +++ b/test/fixtures/cache-tests/results/index.mjs @@ -4,54 +4,54 @@ export default [ file: 'chrome.json', name: 'Chrome', type: 'browser', - version: '126.0.6478.127' + version: '132.0.6834.84' }, { file: 'firefox.json', name: 'Firefox', type: 'browser', - version: '127.0.2', + version: '134.0.1', link: 'https://github.com/http-tests/cache-tests/wiki/Firefox' }, { file: 'safari.json', name: 'Safari', type: 'browser', - version: 'Version 17.5 (19618.2.12.11.6)' + version: '18.2 (20620.1.16.11.8)' }, { file: 'nginx.json', name: 'nginx', type: 'rev-proxy', - version: '1.26.0-1ubuntu2', + version: '1.26.0-3ubuntu1', link: 'https://github.com/http-tests/cache-tests/wiki/nginx' }, { file: 'squid.json', name: 'Squid', type: 'rev-proxy', - version: '6.9-1ubuntu1', + version: '6.10-1ubuntu1', link: 'https://github.com/http-tests/cache-tests/wiki/Squid' }, { file: 'trafficserver.json', name: 'ATS', type: 'rev-proxy', - version: '9.2.4+ds-2', + version: '9.2.5+ds-1', link: 'https://github.com/http-tests/cache-tests/wiki/Traffic-Server' }, { file: 'apache.json', name: 'httpd', type: 'rev-proxy', - version: '2.4.59-2ubuntu2', + version: '2.4.62-3ubuntu1', link: 'https://github.com/http-tests/cache-tests/wiki/Apache-httpd' }, { file: 'varnish.json', name: 'Varnish', type: 'rev-proxy', - version: '7.1.1-1.1ubuntu1', + version: '7.5.0-3', link: 'https://github.com/http-tests/cache-tests/wiki/Varnish' }, { @@ -65,7 +65,7 @@ export default [ file: 'fastly.json', name: 'Fastly', type: 'cdn', - version: '2024-07-09', + version: '2025-01-21', link: 'https://github.com/http-tests/cache-tests/wiki/Fastly' } ] diff --git a/test/fixtures/cache-tests/results/nginx.json b/test/fixtures/cache-tests/results/nginx.json index a1807689659..9b6614c0f1e 100644 --- a/test/fixtures/cache-tests/results/nginx.json +++ b/test/fixtures/cache-tests/results/nginx.json @@ -12,8 +12,8 @@ "Response 2 header Content-Encoding is \"arizqhypgxofwne\", not \"askcumewogyqias\"" ], "304-etag-update-response-Content-Foo": [ - "AbortError", - "The user aborted a request." + "Assertion", + "Response 2 header Content-Foo is \"awsokgcyuqmieaw\", not \"axurolifczwtqnk\"" ], "304-etag-update-response-Content-Length": true, "304-etag-update-response-Content-Location": [ @@ -33,12 +33,12 @@ "Response 2 header Content-Security-Policy is \"default-src 'self'\", not \"default-src 'self' cdn.example.com\"" ], "304-etag-update-response-Content-Type": [ - "AbortError", - "The user aborted a request." + "Assertion", + "Response 2 header Content-Type is \"text/plain\", not \"text/plain;charset=utf-8\"" ], "304-etag-update-response-ETag": [ - "AbortError", - "The user aborted a request." + "Assertion", + "Response 2 header ETag is \"\"abcdef\"\", not \"\"ghijkl\"\"" ], "304-etag-update-response-Expires": [ "Assertion", @@ -136,8 +136,8 @@ "Response 2 comes from cache" ], "ccreq-ma1": [ - "Assertion", - "Response 2 comes from cache" + "AbortError", + "This operation was aborted" ], "ccreq-magreaterage": [ "Assertion", @@ -147,10 +147,13 @@ "Assertion", "Response 2 does not come from cache" ], - "ccreq-max-stale-age": true, + "ccreq-max-stale-age": [ + "AbortError", + "This operation was aborted" + ], "ccreq-min-fresh": [ - "Assertion", - "Response 2 comes from cache" + "AbortError", + "This operation was aborted" ], "ccreq-min-fresh-age": [ "Assertion", @@ -181,7 +184,7 @@ "cdn-date-update-exceed": true, "cdn-expires-update-exceed": [ "Assertion", - "Response 2 header Expires is \"null\", not \"Tue, 09 Jul 2024 01:06:50 GMT\"" + "Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:19:03 GMT\"" ], "cdn-fresh-cc-nostore": [ "Assertion", @@ -270,7 +273,10 @@ "Assertion", "Request 2 header If-None-Match is \"abcdef\", not \"\"abcdef\"\"" ], - "conditional-etag-strong-respond": true, + "conditional-etag-strong-respond": [ + "AbortError", + "This operation was aborted" + ], "conditional-etag-strong-respond-multiple-first": true, "conditional-etag-strong-respond-multiple-last": true, "conditional-etag-strong-respond-multiple-second": true, @@ -588,8 +594,8 @@ "Response 3 comes from cache" ], "invalidate-POST": [ - "AbortError", - "The user aborted a request." + "Assertion", + "Response 3 comes from cache" ], "invalidate-POST-cl": [ "Assertion", @@ -643,11 +649,11 @@ "other-cookie": true, "other-date-update": [ "Assertion", - "Response 2 header Date is \"Tue, 09 Jul 2024 01:06:44 GMT\", not \"Tue, 09 Jul 2024 01:06:41 GMT\"" + "Response 2 header Date is \"Tue, 21 Jan 2025 00:18:57 GMT\", not \"Tue, 21 Jan 2025 00:18:54 GMT\"" ], "other-date-update-expires": [ "Assertion", - "Response 2 header Date is \"Tue, 09 Jul 2024 01:06:44 GMT\", not \"Tue, 09 Jul 2024 01:06:41 GMT\"" + "Response 2 header Date is \"Tue, 21 Jan 2025 00:18:57 GMT\", not \"Tue, 21 Jan 2025 00:18:54 GMT\"" ], "other-date-update-expires-update": true, "other-fresh-content-disposition-attachment": true, @@ -803,10 +809,7 @@ "vary-invalidate": true, "vary-match": true, "vary-no-match": true, - "vary-normalise-combine": [ - "Assertion", - "Response 2 does not come from cache" - ], + "vary-normalise-combine": true, "vary-normalise-lang-case": [ "Assertion", "Response 2 does not come from cache" @@ -838,12 +841,12 @@ ], "vary-syntax-star": true, "vary-syntax-star-foo": [ - "Assertion", - "Response 2 comes from cache" + "AbortError", + "This operation was aborted" ], "vary-syntax-star-star": [ - "Assertion", - "Response 2 comes from cache" + "AbortError", + "This operation was aborted" ], "vary-syntax-star-star-lines": true } diff --git a/test/fixtures/cache-tests/results/safari.json b/test/fixtures/cache-tests/results/safari.json index 9a0e5eda4ab..dfbedaa4cf9 100644 --- a/test/fixtures/cache-tests/results/safari.json +++ b/test/fixtures/cache-tests/results/safari.json @@ -342,54 +342,54 @@ "heuristic-delta-60": true, "heuristic-delta-600": true, "heuristic-delta-86400": true, - "invalidate-DELETE": [ + "invalidate-DELETE": true, + "invalidate-DELETE-cl": [ "Assertion", "Response 3 comes from cache" ], - "invalidate-DELETE-cl": [ + "invalidate-DELETE-failed": [ "Assertion", - "Response 3 comes from cache" + "Response 3 does not come from cache" ], - "invalidate-DELETE-failed": true, "invalidate-DELETE-location": [ "Assertion", "Response 3 comes from cache" ], - "invalidate-M-SEARCH": [ + "invalidate-M-SEARCH": true, + "invalidate-M-SEARCH-cl": [ "Assertion", "Response 3 comes from cache" ], - "invalidate-M-SEARCH-cl": [ + "invalidate-M-SEARCH-failed": [ "Assertion", - "Response 3 comes from cache" + "Response 3 does not come from cache" ], - "invalidate-M-SEARCH-failed": true, "invalidate-M-SEARCH-location": [ "Assertion", "Response 3 comes from cache" ], - "invalidate-POST": [ + "invalidate-POST": true, + "invalidate-POST-cl": [ "Assertion", "Response 3 comes from cache" ], - "invalidate-POST-cl": [ + "invalidate-POST-failed": [ "Assertion", - "Response 3 comes from cache" + "Response 3 does not come from cache" ], - "invalidate-POST-failed": true, "invalidate-POST-location": [ "Assertion", "Response 3 comes from cache" ], - "invalidate-PUT": [ + "invalidate-PUT": true, + "invalidate-PUT-cl": [ "Assertion", "Response 3 comes from cache" ], - "invalidate-PUT-cl": [ + "invalidate-PUT-failed": [ "Assertion", - "Response 3 comes from cache" + "Response 3 does not come from cache" ], - "invalidate-PUT-failed": true, "invalidate-PUT-location": [ "Assertion", "Response 3 comes from cache" diff --git a/test/fixtures/cache-tests/results/squid.json b/test/fixtures/cache-tests/results/squid.json index 56f65a1ce27..0b3b23c5d41 100644 --- a/test/fixtures/cache-tests/results/squid.json +++ b/test/fixtures/cache-tests/results/squid.json @@ -91,7 +91,7 @@ "cdn-date-update-exceed": true, "cdn-expires-update-exceed": [ "Assertion", - "Response 2 header Expires is \"null\", not \"Tue, 09 Jul 2024 00:51:04 GMT\"" + "Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:17:30 GMT\"" ], "cdn-fresh-cc-nostore": [ "Assertion", diff --git a/test/fixtures/cache-tests/results/trafficserver.json b/test/fixtures/cache-tests/results/trafficserver.json index 01a0da3d1a6..52d3c18c6e3 100644 --- a/test/fixtures/cache-tests/results/trafficserver.json +++ b/test/fixtures/cache-tests/results/trafficserver.json @@ -97,7 +97,7 @@ "cdn-date-update-exceed": true, "cdn-expires-update-exceed": [ "Assertion", - "Response 2 header Expires is \"null\", not \"Tue, 09 Jul 2024 01:02:07 GMT\"" + "Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:21:39 GMT\"" ], "cdn-fresh-cc-nostore": [ "Assertion", diff --git a/test/fixtures/cache-tests/results/varnish.json b/test/fixtures/cache-tests/results/varnish.json index 1b10d18c80b..067c395fc15 100644 --- a/test/fixtures/cache-tests/results/varnish.json +++ b/test/fixtures/cache-tests/results/varnish.json @@ -124,7 +124,7 @@ "cdn-date-update-exceed": true, "cdn-expires-update-exceed": [ "Assertion", - "Response 2 header Expires is \"null\", not \"Tue, 09 Jul 2024 01:02:40 GMT\"" + "Response 2 header Expires is \"null\", not \"Tue, 21 Jan 2025 00:22:31 GMT\"" ], "cdn-fresh-cc-nostore": [ "Assertion", @@ -749,10 +749,7 @@ "vary-invalidate": true, "vary-match": true, "vary-no-match": true, - "vary-normalise-combine": [ - "Assertion", - "Response 2 does not come from cache" - ], + "vary-normalise-combine": true, "vary-normalise-lang-case": [ "Assertion", "Response 2 does not come from cache" diff --git a/test/fixtures/cache-tests/test-engine/cli.mjs b/test/fixtures/cache-tests/test-engine/cli.mjs index 241ea37c394..2493a51a9c5 100644 --- a/test/fixtures/cache-tests/test-engine/cli.mjs +++ b/test/fixtures/cache-tests/test-engine/cli.mjs @@ -1,7 +1,6 @@ import { runTests, getResults } from './client/runner.mjs' import { determineTestResult } from './lib/results.mjs' import { GREEN, NC } from './lib/defines.mjs' -import fetch from 'node-fetch-with-proxy' import tests from '../tests/index.mjs' const baseUrl = process.env.npm_config_base || process.env.npm_package_config_base @@ -27,7 +26,7 @@ if (testId !== '') { testsToRun = tests } -await runTests(testsToRun, fetch, false, baseUrl).catch(err => { +await runTests(testsToRun, false, baseUrl).catch(err => { console.error(err) process.exit(1) }) diff --git a/test/fixtures/cache-tests/test-engine/client/config.mjs b/test/fixtures/cache-tests/test-engine/client/config.mjs index 147bdcebbf5..11aa7910992 100644 --- a/test/fixtures/cache-tests/test-engine/client/config.mjs +++ b/test/fixtures/cache-tests/test-engine/client/config.mjs @@ -1,18 +1,7 @@ -export let fetch = null export let useBrowserCache = false export let baseUrl = '' export const requestTimeout = 10 // seconds -export function setFetch (call) { - if (call !== undefined) { - if ('bind' in call) { - fetch = call.bind(fetch) - } else { - fetch = call - } - } -} - export function setUseBrowserCache (bool) { if (bool !== undefined) useBrowserCache = bool } diff --git a/test/fixtures/cache-tests/test-engine/client/fetching.mjs b/test/fixtures/cache-tests/test-engine/client/fetching.mjs index f27a7633220..e1260da1e7f 100644 --- a/test/fixtures/cache-tests/test-engine/client/fetching.mjs +++ b/test/fixtures/cache-tests/test-engine/client/fetching.mjs @@ -11,7 +11,7 @@ export function init (idx, reqConfig, prevResp) { init.headers.push(['Cache-Control', 'nothing-to-see-here']) // ditto } if ('request_method' in reqConfig) init.method = reqConfig.request_method - if ('request_headers' in reqConfig) init.headers = reqConfig.request_headers + if ('request_headers' in reqConfig) init.headers = init.headers.concat(reqConfig.request_headers) if ('magic_ims' in reqConfig && reqConfig.magic_ims === true) { for (let i = 0; i < init.headers.length; i++) { const header = init.headers[i] diff --git a/test/fixtures/cache-tests/test-engine/client/runner.mjs b/test/fixtures/cache-tests/test-engine/client/runner.mjs index dd3bb6d9278..9c7426e658c 100644 --- a/test/fixtures/cache-tests/test-engine/client/runner.mjs +++ b/test/fixtures/cache-tests/test-engine/client/runner.mjs @@ -1,8 +1,7 @@ import * as config from './config.mjs' import { makeTest, testResults } from './test.mjs' -export async function runTests (tests, myFetch, browserCache, base, chunkSize = 50) { - config.setFetch(myFetch) +export async function runTests (tests, browserCache, base, chunkSize = 25) { config.setBaseUrl(base) config.setUseBrowserCache(browserCache) diff --git a/test/fixtures/cache-tests/test-engine/client/test.mjs b/test/fixtures/cache-tests/test-engine/client/test.mjs index 078fdd4eccd..9acaeea8538 100644 --- a/test/fixtures/cache-tests/test-engine/client/test.mjs +++ b/test/fixtures/cache-tests/test-engine/client/test.mjs @@ -33,7 +33,7 @@ export async function makeTest (test) { }, config.requestTimeout * 1000) init.signal = controller.signal if (test.dump === true) clientUtils.logRequest(url, init, reqNum) - return config.fetch(url, init) + return fetch(url, init) .then(response => { responses.push(response) return checkResponse(test, requests, idx, response) @@ -61,6 +61,10 @@ export async function makeTest (test) { } } + function handleError (err) { + console.error(`ERROR: ${uuid} ${err.name} ${err.message}`) + } + return clientUtils.putTestConfig(uuid, requests) .catch(handleError) .then(runNextStep) @@ -293,7 +297,3 @@ function checkServerRequests (requests, responses, serverState) { } } } - -function handleError (err) { - console.error(`ERROR: ${err}`) -} diff --git a/test/fixtures/cache-tests/test-engine/client/utils.mjs b/test/fixtures/cache-tests/test-engine/client/utils.mjs index b1ac45cce9c..21d918d1e98 100644 --- a/test/fixtures/cache-tests/test-engine/client/utils.mjs +++ b/test/fixtures/cache-tests/test-engine/client/utils.mjs @@ -29,7 +29,7 @@ export async function putTestConfig (uuid, requests) { headers: [['content-type', 'application/json']], body: JSON.stringify(requests) } - return config.fetch(`${config.baseUrl}/config/${uuid}`, init) + return fetch(`${config.baseUrl}/config/${uuid}`, init) .then(response => { if (response.status !== 201) { let headers = '' @@ -44,7 +44,7 @@ export async function putTestConfig (uuid, requests) { } export async function getServerState (uuid) { - return config.fetch(`${config.baseUrl}/state/${uuid}`) + return fetch(`${config.baseUrl}/state/${uuid}`) .then(response => { if (response.status === 200) { return response.text() diff --git a/test/fixtures/cache-tests/tests/lib/templates.mjs b/test/fixtures/cache-tests/tests/lib/templates.mjs index 56e87e2f7e1..914b97b45c0 100644 --- a/test/fixtures/cache-tests/tests/lib/templates.mjs +++ b/test/fixtures/cache-tests/tests/lib/templates.mjs @@ -5,7 +5,7 @@ templates take an optional request object; the template will be updated with the request object in the following manner: - Object members will be assigned from the request -- Array members will be concatonated from the request +- Array members will be concatenated from the request - Other members will be updated from the request */ export function makeTemplate (template) {