Files
devvm/internal/msg/proxyconfined_test.go
w3cjandClaude Opus 5.5 aed6424c09 fix(proxy): a stale proxy.confined no longer hides proxy_old
run/proxy.confined said how the child was confined, but not which broker
said it. After a downgrade, an older devvm starts the VM's proxy as one
process and never writes the file, so the newer devvm's file stayed and
devvm doctor took the older devvm's unconfined proxy for a confined one.

The broker now writes a second line naming itself, its pid and its start
as the system tells it (proxy.BrokerID, through IO.Started), and
ReadConfined takes the file only when it names the running broker, which
doctor finds by the pid file and platform.ProcessStart (kern.proc.pid's
p_starttime on macOS, /proc's starttime on Linux). A file that names
another broker, or none, is one that hasn't said, so another binary's
proxy gets proxy_old, and when doctor can't read the running broker's
start it says it can't tell (proxy_confinement_unknown). The e2e broker
check reads the file's first line and checks the second names
run/proxy.pid's broker.

Tests: TestUnconfinedStaleMarker, TestReadConfined, TestProcessStart.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 23:07:04 -07:00

16 lines
508 B
Go

package msg
import (
"strings"
"testing"
)
// devvm doctor's message for a proxy whose start it can't read, which netpolicy's tests check by
// name: it renders whole, its values in place, and links to its page.
func TestProxyConfinementUnknown(t *testing.T) {
m := ProxyConfinementUnknown("devvm-a-0123456789abcd", "no such process")
if text := m.Text(); strings.Contains(text, "{{") || !strings.Contains(text, "no such process") || m.DocURL() == "" {
t.Errorf("%q, link %q", text, m.DocURL())
}
}