ensureDockerImageBuilt makes sure the Docker image is built only once across all tests
(t *testing.T)
| 111 | |
| 112 | // ensureDockerImageBuilt makes sure the Docker image is built only once across all tests |
| 113 | func ensureDockerImageBuilt(t *testing.T) { |
| 114 | buildOnce.Do(func() { |
| 115 | t.Log("Building Docker image for e2e tests...") |
| 116 | cmd := exec.Command("docker", "build", "-t", "github/e2e-github-mcp-server", ".") |
| 117 | cmd.Dir = ".." // Run this in the context of the root, where the Dockerfile is located. |
| 118 | output, err := cmd.CombinedOutput() |
| 119 | buildError = err |
| 120 | if err != nil { |
| 121 | t.Logf("Docker build output: %s", string(output)) |
| 122 | } |
| 123 | }) |
| 124 | |
| 125 | // Check if the build was successful |
| 126 | require.NoError(t, buildError, "expected to build Docker image successfully") |
| 127 | } |
| 128 | |
| 129 | // clientOpts holds configuration options for the MCP client setup |
| 130 | type clientOpts struct { |