Skip to content

Commit 2d1b353

Browse files
authored
chore: relax wsproxy version checking (#9796)
1 parent dcad8fd commit 2d1b353

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

enterprise/coderd/workspaceproxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,9 @@ func (api *API) workspaceProxyRegister(rw http.ResponseWriter, r *http.Request)
572572
}
573573

574574
// Version check should be forced in non-dev builds and when running in
575-
// tests.
575+
// tests. Only Major + minor versions are checked.
576576
shouldForceVersion := !buildinfo.IsDev() || flag.Lookup("test.v") != nil
577-
if shouldForceVersion && req.Version != buildinfo.Version() {
577+
if shouldForceVersion && !buildinfo.VersionsMatch(req.Version, buildinfo.Version()) {
578578
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
579579
Message: "Version mismatch.",
580580
Detail: fmt.Sprintf("Proxy version %q does not match primary server version %q", req.Version, buildinfo.Version()),

enterprise/coderd/workspaceproxy_test.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -409,37 +409,6 @@ func TestProxyRegisterDeregister(t *testing.T) {
409409
require.Error(t, err)
410410
})
411411

412-
t.Run("BlockMismatchingVersion", func(t *testing.T) {
413-
t.Parallel()
414-
415-
client, _ := setup(t)
416-
417-
ctx := testutil.Context(t, testutil.WaitLong)
418-
createRes, err := client.CreateWorkspaceProxy(ctx, codersdk.CreateWorkspaceProxyRequest{
419-
Name: "hi",
420-
})
421-
require.NoError(t, err)
422-
423-
proxyClient := wsproxysdk.New(client.URL)
424-
proxyClient.SetSessionToken(createRes.ProxyToken)
425-
426-
_, err = proxyClient.RegisterWorkspaceProxy(ctx, wsproxysdk.RegisterWorkspaceProxyRequest{
427-
AccessURL: "https://proxy.coder.test",
428-
WildcardHostname: "*.proxy.coder.test",
429-
DerpEnabled: true,
430-
ReplicaID: uuid.New(),
431-
ReplicaHostname: "mars",
432-
ReplicaError: "",
433-
ReplicaRelayAddress: "http://127.0.0.1:8080",
434-
Version: "v0.0.0",
435-
})
436-
require.Error(t, err)
437-
var sdkErr *codersdk.Error
438-
require.ErrorAs(t, err, &sdkErr)
439-
require.Equal(t, http.StatusBadRequest, sdkErr.StatusCode())
440-
require.Contains(t, sdkErr.Response.Message, "Version mismatch")
441-
})
442-
443412
t.Run("ReregisterUpdateReplica", func(t *testing.T) {
444413
t.Parallel()
445414

0 commit comments

Comments
 (0)