diff --git a/packages/gateway-conformance/src/conformance.spec.ts b/packages/gateway-conformance/src/conformance.spec.ts index 4ca6abff..2ca23343 100644 --- a/packages/gateway-conformance/src/conformance.spec.ts +++ b/packages/gateway-conformance/src/conformance.spec.ts @@ -7,7 +7,7 @@ import { expect } from 'aegir/chai' import { execa } from 'execa' import { Agent, setGlobalDispatcher } from 'undici' -const logger = prefixLogger('conformance-tests') +const logger = prefixLogger('gateway-conformance') interface TestConfig { name: string @@ -334,16 +334,21 @@ describe('@helia/verified-fetch - gateway conformance', function () { after(async () => { const log = logger.forComponent('after') - try { - await execa('rm', [binaryPath]) - log('gateway-conformance binary successfully uninstalled.') - } catch (error) { - log.error(`Error removing "${binaryPath}"`, error) + + if (process.env.GATEWAY_CONFORMANCE_BINARY == null) { + try { + await execa('rm', [binaryPath]) + log('gateway-conformance binary successfully uninstalled.') + } catch (error) { + log.error(`Error removing "${binaryPath}"`, error) + } + } else { + log('Not removing custom gateway-conformance binary at %s', binaryPath) } }) tests.forEach(({ name, spec, skip, run, timeout, successRate: minSuccessRate }) => { - const log = logger.forComponent(name) + const log = logger.forComponent(`output:${name}`) const expectedSuccessRate = process.env.SUCCESS_RATE != null ? Number.parseFloat(process.env.SUCCESS_RATE) : minSuccessRate it(`${name} has a success rate of at least ${expectedSuccessRate}%`, async function () { @@ -376,7 +381,7 @@ describe('@helia/verified-fetch - gateway conformance', function () { */ it('has expected total failures and successes', async function () { this.timeout(200000) - const log = logger.forComponent('all') + const log = logger.forComponent('output:all') const { stderr, stdout } = await execa(binaryPath, getConformanceTestArgs('all', [], []), { reject: false, cancelSignal: AbortSignal.timeout(200000) }) diff --git a/packages/gateway-conformance/src/fixtures/basic-server.ts b/packages/gateway-conformance/src/fixtures/basic-server.ts index 2f0816b8..fe1e21ce 100644 --- a/packages/gateway-conformance/src/fixtures/basic-server.ts +++ b/packages/gateway-conformance/src/fixtures/basic-server.ts @@ -98,8 +98,8 @@ async function callVerifiedFetch (req: IncomingMessage, res: Response, { serverP // @see https://github.com/ipfs/gateway-conformance/issues/185#issuecomment-2123708150 let fixingGwcAnnoyance = false - if (req.headers.host != null && (req.headers.host === 'localhost' || req.headers.Host === 'localhost')) { - log.trace('set fixingGwcAnnoyance to true for %s', req.url) + if (req.headers.host != null && req.headers.host === 'localhost') { + log.trace('set fixingGwcAnnoyance to true for %s', new URL(req.url, `http://${req.headers.host}`).href) fixingGwcAnnoyance = true req.headers.host = `localhost:${serverPort}` }