feat: add coder connect exists hidden subcommand (#17418)

Adds a new hidden subcommand `coder connect exists <hostname>` that checks if the name exists via Coder Connect. This will be used in SSH config to match only if Coder Connect is unavailable for the hostname in question, so that the SSH client will directly dial the workspace over an existing Coder Connect tunnel.

Also refactors the way we inject a test DNS resolver into the lookup functions so that we can test from outside the `workspacesdk` package.
This commit is contained in:
Spike Curtis
2025-04-17 11:23:24 +04:00
committed by GitHub
parent 6f5da1e2ee
commit 3b54254177
8 changed files with 242 additions and 98 deletions

View File

@ -10,12 +10,13 @@ import (
"sync/atomic"
"testing"
"github.com/coder/serpent"
"github.com/coder/coder/v2/coderd"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/pty/ptytest"
"github.com/coder/coder/v2/testutil"
"github.com/coder/serpent"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"