Skip to content

Expand proxy cache/import edge-case coverage in proxy.test.js#2

Merged
keith-hall merged 5 commits into
cache_ttlfrom
copilot/cache-ttl-reintroduce-tests
Jun 7, 2026
Merged

Expand proxy cache/import edge-case coverage in proxy.test.js#2
keith-hall merged 5 commits into
cache_ttlfrom
copilot/cache-ttl-reintroduce-tests

Conversation

Copilot AI commented Jun 7, 2026

Copy link
Copy Markdown

This PR adds the next set of high-value tests to improve coverage around cache metadata compatibility and import argument parsing edge cases. The focus is on behaviors that were previously unverified but impact cache correctness and operator workflows.

  • Cache hit: legacy metadata backfill path

    • Adds coverage for cached entries missing proxy-kutti-orig-request.
    • Verifies cacheHit serves the cached response and asynchronously backfills request metadata (including cache-date and sanitized state).
  • Import CLI parsing: flag ordering and incomplete override

    • Adds coverage for --content-type appearing before positional args.
    • Adds coverage for --content-type without a value, ensuring import falls back to inferred MIME type from filename extension instead of writing an invalid override.
  • Test stability improvement for async metadata writes

    • Replaces fixed-delay waiting with predicate polling to avoid timing-sensitive flakes while asserting metadata backfill.
await importIntoCache(['--content-type', 'application/custom-tgz', importUrl, srcFile]);
const { cachedFile } = computeCacheDetails('https', 'GET', importUrl);
const metaData = JSON.parse(fs.readFileSync(`${cachedFile}.meta`, 'utf8'));
assert.strictEqual(metaData.headers['content-type'], 'application/custom-tgz');

@keith-hall keith-hall merged commit 58d5861 into cache_ttl Jun 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants