test: add E2E coverage for Build sheet SSH agent forwarding - #121
Merged
Conversation
Checks the "Forward SSH agent" toggle (#110) and builds an image whose Dockerfile has a RUN --mount=type=ssh step that fails the build outright if SSH_AUTH_SOCK isn't a real forwarded socket inside the guest — that's the oracle, so a passing build is proof forwarding actually worked, not just that a build with the box checked didn't error. Skips (doesn't fail) specifically when LiveContainerService.buildConfigSSH's own pre-flight validation reports SSH_AUTH_SOCK isn't visible to the app process — a GUI launch doesn't reliably inherit a login shell's agent socket, so that's an environment limitation, not a feature bug. Any other failure, including the guest-side RUN step failing, still fails the test. Adds accessibilityIdentifier to the toggle (buildSshToggle) and the build sheet's failure message (buildErrorMessage) so the test can drive/read them precisely rather than by label text. Verified via scripts/e2e.sh against the real local daemon: passed (not skipped) in ~25s, confirming SSH_AUTH_SOCK is visible to the app on this machine and forwarding genuinely works end to end. Fixes #119
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.
Summary
ResourceJourneyTests.testBuildWithSSHForwardingMountsAgentSocket: checks the Build sheet's "Forward SSH agent" toggle (Add SSH forwarding support to Build sheet #110), then builds an image whose Dockerfile has aRUN --mount=type=ssh sh -c 'test -n "$SSH_AUTH_SOCK" && test -S "$SSH_AUTH_SOCK"'step. That step is the oracle — it fails the build outright unless a real forwarded socket is present inside the guest, so a passing build is genuine proof of forwarding, not just proof that a build with the box checked didn't error.LiveContainerService.buildConfigSSH's own pre-flight validation reportsSSH_AUTH_SOCKisn't visible to the app process — GUI-launched apps don't reliably inherit a login shell's agent socket, so that's an environment limitation, not a feature bug. Any other failure — including the guest-sideRUNstep actually failing — still fails the test; the skip path checks the exact validation message text, not just "any failure."accessibilityIdentifiers the test needed:buildSshToggleon the toggle,buildErrorMessageon the sheet's failure text — both previously unqueryable except by label/text matching.Test plan
xcodebuild buildsucceedsBerthlyTestssuite passes (no logic changes, but ran for regression safety)BerthlyUITestsbuild-sheet mock tests pass (testBuildContinuesInBackgroundAndSurfacesInBuildsIndicator,testBuildSheetOpensAndClosesWithoutCrashing) — confirms the two new identifiers don't disturb existing sheet behaviorscripts/e2e.sh ResourceJourneyTests/testBuildWithSSHForwardingMountsAgentSocketagainst the real local daemon — passed (not skipped) in ~25s: this machine'sSSH_AUTH_SOCKis visible to the app, and forwarding genuinely works end to endswiftlint lint --strict— 0 violationsFixes #119