tests: add integration tests for dap build#3566
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive integration tests for the dap build command, which implements a Debug Adapter Protocol (DAP) server for debugging Dockerfile builds. The PR refactors the DAP test utilities into a reusable package and creates tests that exercise various debugging features including breakpoints, stepping, and stack inspection.
Key changes:
- Extracted DAP test utilities (
Clientand connection logging) into a dedicatedutil/daptestpackage for reusability across integration tests - Created comprehensive integration tests covering DAP debugging scenarios: basic build, stop-on-entry, breakpoints, step-in/next/out operations
- Refactored common types into
dap/commonpackage to avoid circular dependencies between production and test code
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| util/daptest/conn.go | New logging connection wrapper for DAP messages in tests with output buffering for event handling |
| util/daptest/client.go | Moved and enhanced DAP test client from dap package, supporting multiple event handlers per event type |
| tests/dap_build.go | New integration tests for dap build command covering all major debugging operations |
| tests/integration_test.go | Registered new dap build tests in the integration test suite |
| dap/common/types.go | Extracted common Conn interface to break circular dependencies |
| dap/conn.go | Updated to use type alias referencing common.Conn |
| dap/client.go | Emptied file (code moved to util/daptest) |
| dap/adapter_test.go | Updated to use utilities from util/daptest package |
| dap/adapter.go | Minor comment formatting improvement (capitalization) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c78b2b1 to
49d5faa
Compare
b43f52c to
4b52104
Compare
4b52104 to
7191c16
Compare
7191c16 to
fe3d6b0
Compare
tonistiigi
left a comment
There was a problem hiding this comment.
Looks like the new tests are not running in CI atm
| require.NoError(t, done(false)) | ||
| } | ||
|
|
||
| func testDapBuildExec(t *testing.T, sb integration.Sandbox) { |
There was a problem hiding this comment.
We don't need to merge in the stubs
| return e | ||
| } | ||
|
|
||
| type ExpectedStackFrame struct { |
There was a problem hiding this comment.
nit: I guess this doesn't need to be public
There was a problem hiding this comment.
Renamed to stackFrameMatcher and renamed some of the methods since Expected is kind of an awkward name.
fe3d6b0 to
4393f73
Compare
|
@tonistiigi the tests only run on the experimental matrix builds because they don't presently work on the non-experimental branch because dap only works with experimental enabled. |
4393f73 to
65b61df
Compare
This adds integration tests for the `dap build` command to test various behavior associated with the command. We start the build and the integration test acts as a dap client to send requests and check that the output is what we expect. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
65b61df to
fdfba30
Compare
|
Including additional unit tests for checking the variable functionality. |
This adds integration tests for the
dap buildcommand to test variousbehavior associated with the command. We start the build and the
integration test acts as a dap client to send requests and check that
the output is what we expect.