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
@@ -147,7 +147,7 @@ func (r *RootCmd) ping() *serpent.Command {
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
derpMap := conn.DERPMap()
|
||||
derpMap := conn.TailnetConn().DERPMap()
|
||||
|
||||
diagCtx, diagCancel := context.WithTimeout(inv.Context(), 30*time.Second)
|
||||
defer diagCancel()
|
||||
@@ -156,7 +156,7 @@ func (r *RootCmd) ping() *serpent.Command {
|
||||
// Silent ping to determine whether we should show diags
|
||||
_, didP2p, _, _ := conn.Ping(ctx)
|
||||
|
||||
ni := conn.GetNetInfo()
|
||||
ni := conn.TailnetConn().GetNetInfo()
|
||||
connDiags := cliui.ConnDiags{
|
||||
DisableDirect: r.disableDirect,
|
||||
LocalNetInfo: ni,
|
||||
|
||||
Reference in New Issue
Block a user