@@ -12,10 +12,11 @@ import (
12
12
)
13
13
14
14
type testChecker struct {
15
- DERPReport derphealth.Report
16
- AccessURLReport healthcheck.AccessURLReport
17
- WebsocketReport healthcheck.WebsocketReport
18
- DatabaseReport healthcheck.DatabaseReport
15
+ DERPReport derphealth.Report
16
+ AccessURLReport healthcheck.AccessURLReport
17
+ WebsocketReport healthcheck.WebsocketReport
18
+ DatabaseReport healthcheck.DatabaseReport
19
+ WorkspaceProxyReport healthcheck.WorkspaceProxyReport
19
20
}
20
21
21
22
func (c * testChecker ) DERP (context.Context , * derphealth.ReportOptions ) derphealth.Report {
@@ -34,6 +35,10 @@ func (c *testChecker) Database(context.Context, *healthcheck.DatabaseReportOptio
34
35
return c .DatabaseReport
35
36
}
36
37
38
+ func (c * testChecker ) WorkspaceProxy (context.Context , * healthcheck.WorkspaceProxyReportOptions ) healthcheck.WorkspaceProxyReport {
39
+ return c .WorkspaceProxyReport
40
+ }
41
+
37
42
func TestHealthcheck (t * testing.T ) {
38
43
t .Parallel ()
39
44
@@ -62,6 +67,10 @@ func TestHealthcheck(t *testing.T) {
62
67
Healthy : true ,
63
68
Severity : health .SeverityOK ,
64
69
},
70
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
71
+ Healthy : true ,
72
+ Severity : health .SeverityOK ,
73
+ },
65
74
},
66
75
healthy : true ,
67
76
severity : health .SeverityOK ,
@@ -85,6 +94,10 @@ func TestHealthcheck(t *testing.T) {
85
94
Healthy : true ,
86
95
Severity : health .SeverityOK ,
87
96
},
97
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
98
+ Healthy : true ,
99
+ Severity : health .SeverityOK ,
100
+ },
88
101
},
89
102
healthy : false ,
90
103
severity : health .SeverityError ,
@@ -109,6 +122,10 @@ func TestHealthcheck(t *testing.T) {
109
122
Healthy : true ,
110
123
Severity : health .SeverityOK ,
111
124
},
125
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
126
+ Healthy : true ,
127
+ Severity : health .SeverityOK ,
128
+ },
112
129
},
113
130
healthy : true ,
114
131
severity : health .SeverityWarning ,
@@ -132,6 +149,10 @@ func TestHealthcheck(t *testing.T) {
132
149
Healthy : true ,
133
150
Severity : health .SeverityOK ,
134
151
},
152
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
153
+ Healthy : true ,
154
+ Severity : health .SeverityOK ,
155
+ },
135
156
},
136
157
healthy : false ,
137
158
severity : health .SeverityWarning ,
@@ -155,6 +176,10 @@ func TestHealthcheck(t *testing.T) {
155
176
Healthy : true ,
156
177
Severity : health .SeverityOK ,
157
178
},
179
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
180
+ Healthy : true ,
181
+ Severity : health .SeverityOK ,
182
+ },
158
183
},
159
184
healthy : false ,
160
185
severity : health .SeverityError ,
@@ -178,12 +203,44 @@ func TestHealthcheck(t *testing.T) {
178
203
Healthy : false ,
179
204
Severity : health .SeverityError ,
180
205
},
206
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
207
+ Healthy : true ,
208
+ Severity : health .SeverityOK ,
209
+ },
181
210
},
182
211
healthy : false ,
183
212
severity : health .SeverityError ,
184
213
failingSections : []string {healthcheck .SectionDatabase },
185
214
}, {
186
- name : "AllFail" ,
215
+ name : "ProxyFail" ,
216
+ checker : & testChecker {
217
+ DERPReport : derphealth.Report {
218
+ Healthy : true ,
219
+ Severity : health .SeverityOK ,
220
+ },
221
+ AccessURLReport : healthcheck.AccessURLReport {
222
+ Healthy : true ,
223
+ Severity : health .SeverityOK ,
224
+ },
225
+ WebsocketReport : healthcheck.WebsocketReport {
226
+ Healthy : true ,
227
+ Severity : health .SeverityOK ,
228
+ },
229
+ DatabaseReport : healthcheck.DatabaseReport {
230
+ Healthy : true ,
231
+ Severity : health .SeverityOK ,
232
+ },
233
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
234
+ Healthy : false ,
235
+ Severity : health .SeverityError ,
236
+ },
237
+ },
238
+ severity : health .SeverityError ,
239
+ healthy : false ,
240
+ failingSections : []string {healthcheck .SectionWorkspaceProxy },
241
+ }, {
242
+ name : "AllFail" ,
243
+ healthy : false ,
187
244
checker : & testChecker {
188
245
DERPReport : derphealth.Report {
189
246
Healthy : false ,
@@ -201,14 +258,18 @@ func TestHealthcheck(t *testing.T) {
201
258
Healthy : false ,
202
259
Severity : health .SeverityError ,
203
260
},
261
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
262
+ Healthy : false ,
263
+ Severity : health .SeverityError ,
264
+ },
204
265
},
205
- healthy : false ,
206
266
severity : health .SeverityError ,
207
267
failingSections : []string {
208
268
healthcheck .SectionDERP ,
209
269
healthcheck .SectionAccessURL ,
210
270
healthcheck .SectionWebsocket ,
211
271
healthcheck .SectionDatabase ,
272
+ healthcheck .SectionWorkspaceProxy ,
212
273
},
213
274
}} {
214
275
c := c
@@ -228,6 +289,8 @@ func TestHealthcheck(t *testing.T) {
228
289
assert .Equal (t , c .checker .AccessURLReport .Healthy , report .AccessURL .Healthy )
229
290
assert .Equal (t , c .checker .AccessURLReport .Severity , report .AccessURL .Severity )
230
291
assert .Equal (t , c .checker .WebsocketReport .Healthy , report .Websocket .Healthy )
292
+ assert .Equal (t , c .checker .WorkspaceProxyReport .Healthy , report .WorkspaceProxy .Healthy )
293
+ assert .Equal (t , c .checker .WorkspaceProxyReport .Warnings , report .WorkspaceProxy .Warnings )
231
294
assert .Equal (t , c .checker .WebsocketReport .Severity , report .Websocket .Severity )
232
295
assert .Equal (t , c .checker .DatabaseReport .Healthy , report .Database .Healthy )
233
296
assert .Equal (t , c .checker .DatabaseReport .Severity , report .Database .Severity )
0 commit comments