Skip to content

feat(support): fetch agent network info over tailnet #12577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 15, 2024
Prev Previous commit
Next Next commit
remove unused field
  • Loading branch information
johnstcn committed Mar 14, 2024
commit 8022a437e14e802facc787d5879652c480958c87
3 changes: 1 addition & 2 deletions cli/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ func writeBundle(src *support.Bundle, dest *zip.Writer) error {
"deployment/config.json": src.Deployment.Config,
"deployment/experiments.json": src.Deployment.Experiments,
"deployment/health.json": src.Deployment.HealthReport,
"network/netcheck_local.json": src.Network.NetcheckLocal,
"network/netcheck_remote.json": src.Network.NetcheckRemote,
"network/netcheck.json": src.Network.Netcheck,
"workspace/workspace.json": src.Workspace.Workspace,
"agent/agent.json": src.Agent.Agent,
"agent/listening_ports.json": src.Agent.ListeningPorts,
Expand Down
8 changes: 4 additions & 4 deletions cli/support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ func assertBundleContents(t *testing.T, path string) {
case "network/tailnet_debug.html":
bs := readBytesFromZip(t, f)
require.NotEmpty(t, bs, "tailnet debug should not be empty")
case "network/netcheck_local.json", "network/netcheck_remote.json":
// TODO: setup fake agent?
bs := readBytesFromZip(t, f)
require.NotEmpty(t, bs, "netcheck should not be empty")
case "network/netcheck.json":
var v codersdk.WorkspaceAgentConnectionInfo
decodeJSONFromZip(t, f, &v)
require.NotEmpty(t, v, "connection info should not be empty")
case "workspace/workspace.json":
var v codersdk.Workspace
decodeJSONFromZip(t, f, &v)
Expand Down
5 changes: 2 additions & 3 deletions support/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ type Deployment struct {
type Network struct {
CoordinatorDebug string `json:"coordinator_debug"`
TailnetDebug string `json:"tailnet_debug"`
NetcheckLocal *codersdk.WorkspaceAgentConnectionInfo `json:"netcheck_local"`
NetcheckRemote *codersdk.WorkspaceAgentConnectionInfo `json:"netcheck_remote"`
Netcheck *codersdk.WorkspaceAgentConnectionInfo `json:"netcheck"`
}

type Workspace struct {
Expand Down Expand Up @@ -175,7 +174,7 @@ func NetworkInfo(ctx context.Context, client *codersdk.Client, log slog.Logger,
if err != nil {
return xerrors.Errorf("fetch agent conn info: %w", err)
}
n.NetcheckLocal = &connInfo
n.Netcheck = &connInfo
return nil
})

Expand Down
2 changes: 1 addition & 1 deletion support/support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestRun(t *testing.T) {
require.NotEmpty(t, bun.Deployment.Experiments)
require.NotEmpty(t, bun.Network.CoordinatorDebug)
require.NotEmpty(t, bun.Network.TailnetDebug)
require.NotNil(t, bun.Network.NetcheckLocal)
require.NotNil(t, bun.Network.Netcheck)
require.NotNil(t, bun.Workspace.Workspace)
assertSanitizedWorkspace(t, bun.Workspace.Workspace)
require.NotEmpty(t, bun.Workspace.BuildLogs)
Expand Down