Skip to content

fix: respect --disable-direct-connections on coder speedtest #13377

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: respect --disable-direct-connections on coder speedtest
  • Loading branch information
spikecurtis committed May 29, 2024
commit f82e76fcfda6c3eeed257da02a5289b52fde31e5
11 changes: 8 additions & 3 deletions cli/speedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func (r *RootCmd) speedtest() *serpent.Command {
ctx, cancel := context.WithCancel(inv.Context())
defer cancel()

if direct && r.disableDirect {
return xerrors.Errorf("--direct (-d) is incompatible with --%s", varDisableDirect)
}

_, workspaceAgent, err := getWorkspaceAndAgent(ctx, inv, client, false, inv.Args[0])
if err != nil {
return err
Expand All @@ -57,12 +61,13 @@ func (r *RootCmd) speedtest() *serpent.Command {
logger = logger.Leveled(slog.LevelDebug)
}

if r.disableDirect {
_, _ = fmt.Fprintln(inv.Stderr, "Direct connections disabled.")
}
opts := &workspacesdk.DialAgentOptions{
Logger: logger,
}
if r.disableDirect {
_, _ = fmt.Fprintln(inv.Stderr, "Direct connections disabled.")
opts.BlockEndpoints = true
}
if pcapFile != "" {
s := capture.New()
opts.CaptureHook = s.LogPacket
Expand Down
Loading