Repository navigation
go: hand tests their new session through the environment - #80
Merged
Merged
Conversation
grouville
self-requested a review
October 27, 2026 06:20
grouville
approved these changes
Oct 27, 2026
Tests have run in a session of their own since #75, so that a module address resolves against the user's workspace. But a new session leaves DAGGER_SESSION_PORT and DAGGER_SESSION_TOKEN unset, and a Dagger Go module's own package panics on load without them. Every test of a Dagger Go module failed, gobuild's among them. Run the tests under the engine-mounted CLI's api with-session instead. It opens the same kind of new session and hands it to the tests through those two variables, which every SDK's client connects through. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/test-session-env
branch
from
October 27, 2026 06:26
ba12d4d to
0289177
Compare
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
Since #75 (which gives tests a session of their own so that a module address resolves against the user's workspace), every test of a Dagger Go module fails on load:
A new-session exec leaves
DAGGER_SESSION_PORTandDAGGER_SESSION_TOKENunset, and the code the Go SDK generates for a Dagger module reads them ininit. gobuild is such a module, sosingle-module-checkandskips-non-modules-checkfail on main and on every PR. #75's own CI ran before gobuild had tests.single-module-checkshows green on main only because Go's test cache, kept in a cache volume that persists between runs, replayed an earlier pass (ok dagger/gobuild (cached)). Go doesn't treat environment variables read during package init as test inputs.Fix
Run the tests under the engine-mounted CLI's
dagger api with-session. Tests still get a new session of their own, but it now comes through the two variables every SDK client connects through._EXPERIMENTAL_DAGGER_CLI_BINis no longer needed. The nesting fixture reads its session from the environment again.Known limit
A Go test that runs the
daggerCLI as a subprocess can't join that session yet: the CLI refuses with "connecting a Dagger CLI to the session served bydagger runis not supported yet". Tests that use an SDK client are unaffected. Letting a CLI join will be a separate change in dagger/dagger.Verification
On a Dagger Cloud engine (v1.0.0-beta.20):
single-module-checkandskips-non-modules-checkpass, with gobuild's tests actually run, not replayed from cache.dagger checkpasses.