Skip to content

Move spec tests into the LLB graph#898

Open
cpuguy83 wants to merge 3 commits intoproject-dalec:mainfrom
cpuguy83:be_lazy
Open

Move spec tests into the LLB graph#898
cpuguy83 wants to merge 3 commits intoproject-dalec:mainfrom
cpuguy83:be_lazy

Conversation

@cpuguy83
Copy link
Copy Markdown
Collaborator

@cpuguy83 cpuguy83 commented Dec 12, 2025

This moves Dalec spec/package tests into the normal LLB graph instead of running test containers manually through the BuildKit API after the main solve.

The main implementation details and rationale are in tests: run package tests in LLB graph.

This also includes small supporting fixes to protect shared test spec mutation and to build docs examples through the existing bake target.

@cpuguy83 cpuguy83 force-pushed the be_lazy branch 2 times, most recently from b3b9d7f to 68c2f6b Compare December 12, 2025 01:01
@cpuguy83 cpuguy83 self-assigned this Dec 12, 2025
@cpuguy83 cpuguy83 force-pushed the be_lazy branch 27 times, most recently from ce19276 to 99d2499 Compare December 17, 2025 19:56
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83 cpuguy83 changed the title Don't unlazy the build Move spec tests into the LLB graph Apr 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR moves Dalec spec/package tests into the normal BuildKit LLB graph so test execution happens as part of the solve, rather than running separate test containers after the main build.

Changes:

  • Introduces a new internal/testrunner implementation that runs test steps and file/stdio checks inside the LLB graph.
  • Refactors Linux distro target handlers (package/container/sysext) to wire tests into the produced LLB and ensure test execution is part of the solve.
  • Updates test harness/CI to stream solve status differently and to build docs examples via the existing buildx bake examples target.

Reviewed changes

Copilot reviewed 48 out of 49 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
internal/testrunner/runner.go Adds the core LLB-based validation runner + utilities for composing validations.
internal/testrunner/step.go Implements step execution and stdout/stderr capture files used by LLB checks.
internal/testrunner/tests.go Orchestrates per-test execution and merges validations into the graph.
tests.go Refactors source-mapping for tests/checks to return llb.ConstraintsOpt for LLB integration.
frontend/test_runner.go Switches frontend test execution to the new LLB-based testrunner flow.
targets/linux/distro_handler.go Changes target handlers to solve graphs that include tests (and final-state dependency chaining).
targets/linux/rpm/distro/pkg.go / targets/linux/deb/distro/pkg.go Updates distro-specific test dependency installation + test runner hookup.
test/testenv/buildx.go / test/testenv/build.go Refactors solve option setup and solve-status streaming helpers.
cmd/frontend/main.go Moves subcommand handling to the plugin-based command registry.
.github/workflows/ci.yml Uses docker buildx bake examples for docs examples build in CI.

Comment thread tests.go
Comment thread tests.go
Comment thread tests.go
Comment thread cmd/frontend/main.go
Comment thread frontend/build.go
Comment thread internal/testrunner/runner.go
Comment thread internal/testrunner/runner.go
Move spec/package test execution out of the frontend's manual container-run path and into the normal LLB graph.

The previous test runner solved the package build, then used the BuildKit API to run test containers and inspect filesystem state from outside the graph. That made the build less lazy, introduced extra solve behavior, and broke clients such as `docker buildx dap build` that expect the frontend solve to remain debuggable as a normal graph.

This change represents test execution as BuildKit operations instead. The frontend binary is mounted into test containers and invoked through internal subcommands for filesystem checks. Each assertion is emitted as a separate exec op so failures can retain useful source mapping.

Running tests this way keeps the test work attached to the build graph, lets BuildKit schedule and cache it normally, and avoids forcing package outputs to be materialized just so the frontend can run tests manually.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
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.

3 participants