@@ -22,27 +22,20 @@ import (
22
22
"github.com/coder/coder/coderd/httpapi"
23
23
"github.com/stretchr/testify/require"
24
24
25
- "github.com/coder/coder/coderd/coderdtest"
26
-
27
- "github.com/coder/coder/coderd/rbac"
28
25
"github.com/prometheus/client_golang/prometheus"
29
26
30
27
"cdr.dev/slog"
31
28
"cdr.dev/slog/sloggers/slogtest"
32
- "github.com/coder/coder/coderd/database"
33
- "github.com/coder/coder/coderd/database/dbauthz"
34
- "github.com/coder/coder/coderd/database/dbtestutil"
35
29
)
36
30
37
31
type ProxyOptions struct {
38
32
Name string
39
33
40
- Database database.Store
41
- Pubsub database.Pubsub
42
- Authorizer rbac.Authorizer
43
34
TLSCertificates []tls.Certificate
44
- ProxyURL * url.URL
45
35
AppHostname string
36
+
37
+ // ProxyURL is optional
38
+ ProxyURL * url.URL
46
39
}
47
40
48
41
// NewWorkspaceProxy will configure a wsproxy.Server with the given options.
@@ -57,17 +50,6 @@ func NewWorkspaceProxy(t *testing.T, coderd *coderd.API, owner *codersdk.Client,
57
50
options = & ProxyOptions {}
58
51
}
59
52
60
- if options .Authorizer == nil {
61
- options .Authorizer = & coderdtest.RecordingAuthorizer {
62
- Wrapped : rbac .NewCachingAuthorizer (prometheus .NewRegistry ()),
63
- }
64
- }
65
-
66
- if options .Database == nil {
67
- options .Database , options .Pubsub = dbtestutil .NewDB (t )
68
- options .Database = dbauthz .New (options .Database , options .Authorizer , slogtest .Make (t , nil ).Leveled (slog .LevelDebug ))
69
- }
70
-
71
53
// HTTP Server
72
54
var mutex sync.RWMutex
73
55
var handler http.Handler
@@ -132,11 +114,12 @@ func NewWorkspaceProxy(t *testing.T, coderd *coderd.API, owner *codersdk.Client,
132
114
URL : accessURL .String (),
133
115
WildcardHostname : options .AppHostname ,
134
116
})
117
+ require .NoError (t , err , "failed to create workspace proxy" )
135
118
136
119
wssrv , err := wsproxy .New (& wsproxy.Options {
137
120
Logger : slogtest .Make (t , nil ).Leveled (slog .LevelDebug ),
138
121
PrimaryAccessURL : coderd .AccessURL ,
139
- AccessURL : options . ProxyURL ,
122
+ AccessURL : accessURL ,
140
123
AppHostname : options .AppHostname ,
141
124
AppHostnameRegex : appHostnameRegex ,
142
125
RealIPConfig : coderd .RealIPConfig ,
0 commit comments