Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jan 22, 2025
1 parent 28b8614 commit 261a14e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,11 @@ import {
} from './assertions.js';
import { routes } from './routes.js';
import { CacheOverride } from 'fastly:cache-override';
import { Backend } from 'fastly:backend';

// generate a unique URL everytime so that we never work on a populated cache
const getTestUrl = (path = `/${Math.random().toString().slice(2)}`) =>
'https://httpbin.org/anything' + path;

let _httpBinBackend;
const httpBinBackend = () =>
_httpBinBackend ||
(_httpBinBackend = new Backend({
name: `httpbin-${Math.random().toString().slice(2)}`,
target: 'httpbin.org',
}));

// afterSend error handling
{
routes.set('/http-cache/hook-errors', async () => {
Expand Down Expand Up @@ -60,14 +51,13 @@ const httpBinBackend = () =>
await assertRejects(
() =>
fetch(url, {
backend: httpBinBackend(),
cacheOverride: new CacheOverride({
afterSend(res) {
res.status = 'invalid'; // Should throw type error
},
}),
}),
TypeError,
RangeError,
);

await assertRejects(
Expand Down
7 changes: 7 additions & 0 deletions integration-tests/js-compute/fixtures/module-mode/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"features": ["http-cache"]
},
"GET /http-cache/before-send": {
"skip": true,
"environments": ["compute"],
"features": ["http-cache"]
},
Expand Down Expand Up @@ -210,26 +211,32 @@
"features": ["http-cache"]
},
"GET /http-cache/body-transform": {
"skip": true,
"environments": ["compute"],
"features": ["http-cache"]
},
"GET /http-cache/body-transform-error": {
"skip": true,
"environments": ["compute"],
"features": ["http-cache"]
},
"GET /http-cache/body-transform-invalid-chunk": {
"skip": true,
"environments": ["compute"],
"features": ["http-cache"]
},
"GET /http-cache/body-transform-write-after-close": {
"skip": true,
"environments": ["compute"],
"features": ["http-cache"]
},
"GET /http-cache/body-transform-cancel": {
"skip": true,
"environments": ["compute"],
"features": ["http-cache"]
},
"GET /http-cache/body-transform-backpressure": {
"skip": true,
"environments": ["compute"],
"features": ["http-cache"]
},
Expand Down
9 changes: 6 additions & 3 deletions integration-tests/js-compute/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ for (const chunk of chunks(Object.entries(tests), 100)) {
}

// basic test filtering
if (filter.length > 0 && filter.every((f) => !title.includes(f))) {
if (
test.skip ||
(filter.length > 0 && filter.every((f) => !title.includes(f)))
) {
return {
title,
test,
Expand Down Expand Up @@ -269,7 +272,7 @@ for (const chunk of chunks(Object.entries(tests), 100)) {
}
if (local) {
if (test.environments.includes('viceroy')) {
return (!test.flake ? (_, __, fn) => fn() : retry)(
return (bail || !test.flake ? (_, __, fn) => fn() : retry)(
5,
expBackoff('10s', '1s'),
async () => {
Expand Down Expand Up @@ -310,7 +313,7 @@ for (const chunk of chunks(Object.entries(tests), 100)) {
} else {
if (test.environments.includes('compute')) {
return retry(
test.flake ? 10 : 4,
test.flake ? 10 : bail ? 1 : 4,
expBackoff(test.flake ? '60s' : '30s', test.flake ? '10s' : '1s'),
async () => {
let path = test.downstream_request.pathname;
Expand Down

0 comments on commit 261a14e

Please sign in to comment.