coder / coder/internal

aibridge: goproxy.GoproxyCa global variable complicates parallel test execution

Open
#1,219 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Problem

The goproxy library stores the CA certificate for MITM proxying in a package-level global variable ([`goproxy.GoproxyCa`](https://github.com/elazarl/goproxy/blob/master/certs.go#L8)). This means all proxy instances in a process share the same CA, which complicates testing:
* Tests running in parallel can race on writing to this global
* We need `sync.Once` to ensure the CA is only set once, but we must keep error-prone operations (loading certs) outside the `sync.Once` to avoid caching errors from failure test cases

## Proposed Changes

Either:
* Fork the library and make the CA certificate a per-instance field instead of a global
* Submit a PR upstream to support per-instance CA configuration

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.