Skip to content

Commit

Permalink
debug flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-guggisberg committed Apr 14, 2023
1 parent 486d819 commit ed4344c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/fetch/index.http2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('HTTP/2-specific Fetch Tests', () => {
});

it.only('concurrent HTTP/2 requests to same origin', async () => {
const N = 10; // # of parallel requests
const N = 50; // # of parallel requests
const TEST_URL = `${server.origin}/bytes`;
// const TEST_URL = `${server.origin}/hello`;
// generete array of 'randomized' urls
Expand Down
8 changes: 4 additions & 4 deletions test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import { randomBytes } from 'crypto';
import { readFile } from 'fs/promises';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { promisify } from 'util';

const randomBuffer = promisify(randomBytes);
const RANDOM_BUFFER = randomBytes(32);

// Workaround for ES6 which doesn't support the NodeJS global __dirname
const __dirname = dirname(fileURLToPath(import.meta.url));
Expand Down Expand Up @@ -84,12 +83,13 @@ class Server {
case '/bytes':
await sleep(+(searchParams.get('delay') || 0));
count = +(searchParams.get('count') || 32);
count = RANDOM_BUFFER.length;
res.writeHead(200, {
'Content-Type': 'application/octet-stream',
'Content-Length': `${count}`,
});
res.write(await randomBuffer(count));
res.end();
res.end(RANDOM_BUFFER);
// res.end(randomBytes(count));
break;

default:
Expand Down

0 comments on commit ed4344c

Please sign in to comment.