refactor: convert workspacesdk.AgentConn to an interface (#19392)

Fixes https://github.com/coder/internal/issues/907

We convert `workspacesdk.AgentConn` to an interface and generate a mock
for it. This allows writing `coderd` tests that rely on the agent's HTTP
api to not have to set up an entire tailnet networking stack.
This commit is contained in:
Danielle Maywood
2025-08-20 10:00:44 +01:00
committed by GitHub
parent 23c494f36b
commit 5e84d257b7
18 changed files with 667 additions and 143 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ type AgentProvider interface {
ReverseProxy(targetURL, dashboardURL *url.URL, agentID uuid.UUID, app appurl.ApplicationURL, wildcardHost string) *httputil.ReverseProxy
// AgentConn returns a new connection to the specified agent.
AgentConn(ctx context.Context, agentID uuid.UUID) (_ *workspacesdk.AgentConn, release func(), _ error)
AgentConn(ctx context.Context, agentID uuid.UUID) (_ workspacesdk.AgentConn, release func(), _ error)
ServeHTTPDebug(w http.ResponseWriter, r *http.Request)