package e2e import "testing" // TestCINetwork checks that CI_NETWORK reaches the container create call. // An engine network is how a CI container gets IPv6 or an isolated segment. func TestCINetwork(t *testing.T) { networkMode := func(m *mockDocker) any { host, _ := m.createBody()["HostConfig"].(map[string]any) return host["NetworkMode"] } t.Run("unset leaves the engine default", func(t *testing.T) { e, m, admin := ciEnv(t) m.queueExec(execResp{output: "hi\n"}) sha := ciSeedToml(e, ciSimpleTOML) runID := ciTrigger(e, admin, sha, nil) if got := ciWaitForRun(e, runID); got != "success" { t.Fatalf("status = %q", got) } if got := networkMode(m); got != nil { t.Errorf("NetworkMode = %v, want absent", got) } }) t.Run("set joins that network", func(t *testing.T) { e, m, admin := ciEnv(t, "CI_NETWORK", "hearthforge-ci") m.queueExec(execResp{output: "hi\n"}) sha := ciSeedToml(e, ciSimpleTOML) runID := ciTrigger(e, admin, sha, nil) if got := ciWaitForRun(e, runID); got != "success" { t.Fatalf("status = %q", got) } if got := networkMode(m); got != "hearthforge-ci" { t.Errorf("NetworkMode = %v", got) } }) }