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)
| 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. |
| 15 | func 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 | |
| 31 | func TestBootstrapCreatesLayout(t *testing.T) { |
| 32 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected