MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestBootstrapWritesSandboxHintHeader

Function TestBootstrapWritesSandboxHintHeader

internal/config/config_test.go:15–29  ·  view source on GitHub ↗

TestBootstrapWritesSandboxHintHeader pins the comment header writeYAML re-prepends on every write. yaml.Marshal drops comments, so this is the only place the host.docker.internal hint survives, the #1 first-run footgun for devcontainer/WSL2 users. Guards against a switch to plain yaml.Marshal.

(t *testing.T)

Source from the content-addressed store, hash-verified

13// place the host.docker.internal hint survives, the #1 first-run footgun for
14// devcontainer/WSL2 users. Guards against a switch to plain yaml.Marshal.
15func TestBootstrapWritesSandboxHintHeader(t *testing.T) {
16 dir := t.TempDir()
17 if _, created, err := Bootstrap(dir); err != nil || !created {
18 t.Fatalf("Bootstrap should create config on first run: created=%v err=%v", created, err)
19 }
20 raw, err := os.ReadFile(filepath.Join(dir, DirName, "config.yaml"))
21 if err != nil {
22 t.Fatal(err)
23 }
24 for _, want := range []string{"codehamr configuration", "host.docker.internal"} {
25 if !strings.Contains(string(raw), want) {
26 t.Fatalf("config.yaml header missing %q:\n%s", want, raw)
27 }
28 }
29}
30
31func TestBootstrapCreatesLayout(t *testing.T) {
32 dir := t.TempDir()

Callers

nothing calls this directly

Calls 1

BootstrapFunction · 0.85

Tested by

no test coverage detected