mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
+2
-2
@@ -139,7 +139,7 @@ func (r *RootCmd) speedtest() *serpent.Command {
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
status := conn.Status()
|
||||
status := conn.TailnetConn().Status()
|
||||
if len(status.Peers()) != 1 {
|
||||
continue
|
||||
}
|
||||
@@ -189,7 +189,7 @@ func (r *RootCmd) speedtest() *serpent.Command {
|
||||
outputResult.Intervals[i] = interval
|
||||
}
|
||||
}
|
||||
conn.Conn.SendSpeedtestTelemetry(outputResult.Overall.ThroughputMbits)
|
||||
conn.TailnetConn().SendSpeedtestTelemetry(outputResult.Overall.ThroughputMbits)
|
||||
out, err := formatter.Format(inv.Context(), outputResult)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user