fix(eest): make the fill report self-contained so it renders from S3#278
Merged
Conversation
The pytest-html fill report (.meta/report_fill.html) linked its stylesheet relatively as <link href="assets/style.css">. When the UI serves the report from a presigned S3 URL (or embeds it in an iframe), that relative asset resolves to an unsigned S3 URL and 403s, so the report renders unstyled. Add --self-contained-html to PYTEST_ADDOPTS so pytest-html inlines the CSS into report_fill.html — the report becomes a single file with no assets/ references and renders fully styled from any URL. EEST only sets htmlpath (not self_contained_html), so the flag is honored. This is the generation-time root fix and keeps the report on its own S3 origin (no same-origin API proxy needed). Applies to newly filled fixtures; existing reports render styled after their next build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Follow-up to #277. With the report links now redirecting to the presigned S3 URL, the EEST fill report opened/embedded unstyled. The pytest-html report links its stylesheet relatively:
When the report loads from a presigned S3 URL (
…/report_fill.html?X-Amz-Signature=…), the browser resolvesassets/style.cssto an unsigned S3 URL → 403 on the private bucket → no styling. (Verified against a real report: it's pytest-html, one inline<script>, and a single external assetassets/style.css.)Fix
Add
--self-contained-htmltoPYTEST_ADDOPTSfor the fill run. pytest-html then inlines the CSS intoreport_fill.html, so the report is a single self-contained file with noassets/references and renders fully styled from any URL — including the presigned S3 URL and the iframe embed.EEST's filler plugin only sets
htmlpath(.meta/report_fill.html) and does not setself_contained_html, so the flag is honored (confirmed inexecution-specsfiller.py). The JS is already inline, so nothing else needs bundling.Why this over a server-side proxy
The alternative — streaming the report + its assets through the API so relative URLs resolve on the API origin — would serve our HTML same-origin as the API, giving up the origin isolation the presigned S3 URL provides (the report can't touch API cookies from the S3 origin). Fixing it at generation time keeps that isolation, needs no new route, and removes the sub-resource entirely instead of proxying it.
Scope
assets/link until their next build re-generates the report.go build+ golangci-lint (--new-from-rev=origin/master) clean.