Skip to content

test(docker): verify the built Docker image with testcontainers#852

Open
u1f992 wants to merge 1 commit into
fix/browser-writable-homefrom
test/docker-image
Open

test(docker): verify the built Docker image with testcontainers#852
u1f992 wants to merge 1 commit into
fix/browser-writable-homefrom
test/docker-image

Conversation

@u1f992

@u1f992 u1f992 commented Jun 30, 2026

Copy link
Copy Markdown
Member

#793 の一部です。 #846 の上に積んでいます。コンテナイメージにテストを追加し、Actionsにも組み込むことで問題のあるリリースを防ごうとするものです。

時間がかかるため通常のテストには組み込んでおらず、環境変数VIVLIOSTYLE_CLI_IMAGEをセットしたうえでpnpm run test:dockerで実行できます。

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Docker イメージ(VIVLIOSTYLE_CLI_IMAGE)を対象に、Testcontainers + Vitest で “ビルド済みイメージの契約テスト” を実行できるようにし、GitHub Actions のイメージビルド後に検証を追加する PR です。Vivliostyle CLI の Docker リリース品質(動作・フォント・PDF生成・拡張性など)を CI で検知する狙いに沿った変更になっています。

Changes:

  • Docker イメージ検証用の Vitest 設定と pnpm test:docker スクリプトを追加
  • Testcontainers によるコンテナ起動・コマンド実行・GUI プレビュー描画検証・ゴールデン比較を行うテストを追加
  • Actions のイメージビルドジョブに「pull → test:docker 実行」を追加し、fixture / 生成物(スクリーンショット)に合わせて ignore を調整

Reviewed changes

Copilot reviewed 7 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vite.docker.config.ts Docker 検証テストのみを走らせる Vitest 設定を追加
tests/docker/image.test.ts Testcontainers を使った Docker イメージの契約テスト一式を追加
tests/docker/fixtures/render-matches-golden/Noto_Sans_JP/OFL.txt ゴールデン検証用フォント fixture のライセンスを追加
tests/docker/fixtures/render-matches-golden/needs-liberation.html ゴールデンレンダリング比較用の HTML fixture を追加
tests/docker/fixtures/build/manuscript.md vivliostyle build の最小 fixture を追加
package.json test:docker スクリプトと testcontainers(devDependency)を追加
pnpm-lock.yaml testcontainers 追加に伴う lock 更新
.gitignore fixture PDF の例外許可と docker テストのスクリーンショット出力の ignore を追加
.github/workflows/test.yml ビルドしたイメージを pull して pnpm test:docker を実行するステップを追加
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/docker-image.test.ts Outdated
Comment thread tests/docker-image.test.ts

This comment was marked as outdated.

@u1f992 u1f992 marked this pull request as ready for review July 3, 2026 02:20
@u1f992 u1f992 requested a review from spring-raining as a code owner July 3, 2026 02:20
@u1f992 u1f992 force-pushed the test/docker-image branch from e461252 to e83b53d Compare July 3, 2026 03:14
@u1f992

This comment was marked as outdated.

u1f992 added a commit that referenced this pull request Jul 3, 2026
The container verification this PR carried as build/image-contract.sh is
superseded by the testcontainers-based suite (tests/docker-image.test.ts,
PR #852). Remove the script and its fixtures, and point the derive-purge
oracle at that suite: oracle.sh now runs `pnpm test:docker` against the
candidate image and extracts failed test names from the Vitest summary.

The fonts-liberation rationale that lived in the removed script's
render-fidelity check is inlined into the Dockerfile comment.
@u1f992

u1f992 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

42f5f3b vivliostyle/vivliostyle.js#2035 #859 を踏まえて、コンテナが特定のフォントを持つかは特にテストする必要がなくなります。

@u1f992 u1f992 force-pushed the test/docker-image branch from 42f5f3b to 75a101f Compare July 6, 2026 13:04
A vitest + testcontainers suite under tests/docker, run via `pnpm test:docker`
and kept out of the default `pnpm test`, verifying an already-built Vivliostyle
CLI image named by VIVLIOSTYLE_CLI_IMAGE: container config/identity, the CLI and
npm/pnpm, fonts, headless builds + GUI preview across browsers, press-ready,
and apt-based extension. Network-dependent checks run unconditionally and fail
(not skip) on outage, so a transient problem cannot let a broken image pass.

ci(docker): run the image tests against the built image

build-and-push-image builds the image and pushes it to the local registry; pull
it into the daemon and run `pnpm test:docker` against it
(VIVLIOSTYLE_CLI_IMAGE=localhost:5000/vivliostyle/cli:latest) so the suite gates
CI instead of only being runnable locally.

test(docker): switch the extensibility probe to rename and drop the perl-base repair

test(docker): add build and preview tests for a uid:gid missing from /etc/passwd

test(docker): drop the bundled-font assertions
@u1f992 u1f992 force-pushed the test/docker-image branch from 75a101f to 492cccc Compare July 6, 2026 13:24
@u1f992 u1f992 changed the base branch from main to fix/browser-writable-home July 6, 2026 13:25
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