@@ -11,10 +11,11 @@ import (
11
11
)
12
12
13
13
type testChecker struct {
14
- DERPReport derphealth.Report
15
- AccessURLReport healthcheck.AccessURLReport
16
- WebsocketReport healthcheck.WebsocketReport
17
- DatabaseReport healthcheck.DatabaseReport
14
+ DERPReport derphealth.Report
15
+ AccessURLReport healthcheck.AccessURLReport
16
+ WebsocketReport healthcheck.WebsocketReport
17
+ DatabaseReport healthcheck.DatabaseReport
18
+ WorkspaceProxyReport healthcheck.WorkspaceProxyReport
18
19
}
19
20
20
21
func (c * testChecker ) DERP (context.Context , * derphealth.ReportOptions ) derphealth.Report {
@@ -33,6 +34,10 @@ func (c *testChecker) Database(context.Context, *healthcheck.DatabaseReportOptio
33
34
return c .DatabaseReport
34
35
}
35
36
37
+ func (c * testChecker ) WorkspaceProxy (context.Context , * healthcheck.WorkspaceProxyReportOptions ) healthcheck.WorkspaceProxyReport {
38
+ return c .WorkspaceProxyReport
39
+ }
40
+
36
41
func TestHealthcheck (t * testing.T ) {
37
42
t .Parallel ()
38
43
@@ -56,6 +61,9 @@ func TestHealthcheck(t *testing.T) {
56
61
DatabaseReport : healthcheck.DatabaseReport {
57
62
Healthy : true ,
58
63
},
64
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
65
+ Healthy : true ,
66
+ },
59
67
},
60
68
healthy : true ,
61
69
failingSections : []string {},
@@ -74,6 +82,9 @@ func TestHealthcheck(t *testing.T) {
74
82
DatabaseReport : healthcheck.DatabaseReport {
75
83
Healthy : true ,
76
84
},
85
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
86
+ Healthy : true ,
87
+ },
77
88
},
78
89
healthy : false ,
79
90
failingSections : []string {healthcheck .SectionDERP },
@@ -93,6 +104,9 @@ func TestHealthcheck(t *testing.T) {
93
104
DatabaseReport : healthcheck.DatabaseReport {
94
105
Healthy : true ,
95
106
},
107
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
108
+ Healthy : true ,
109
+ },
96
110
},
97
111
healthy : true ,
98
112
failingSections : []string {},
@@ -111,6 +125,9 @@ func TestHealthcheck(t *testing.T) {
111
125
DatabaseReport : healthcheck.DatabaseReport {
112
126
Healthy : true ,
113
127
},
128
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
129
+ Healthy : true ,
130
+ },
114
131
},
115
132
healthy : false ,
116
133
failingSections : []string {healthcheck .SectionAccessURL },
@@ -129,6 +146,9 @@ func TestHealthcheck(t *testing.T) {
129
146
DatabaseReport : healthcheck.DatabaseReport {
130
147
Healthy : true ,
131
148
},
149
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
150
+ Healthy : true ,
151
+ },
132
152
},
133
153
healthy : false ,
134
154
failingSections : []string {healthcheck .SectionWebsocket },
@@ -147,9 +167,33 @@ func TestHealthcheck(t *testing.T) {
147
167
DatabaseReport : healthcheck.DatabaseReport {
148
168
Healthy : false ,
149
169
},
170
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
171
+ Healthy : true ,
172
+ },
150
173
},
151
174
healthy : false ,
152
175
failingSections : []string {healthcheck .SectionDatabase },
176
+ }, {
177
+ name : "ProxyFail" ,
178
+ checker : & testChecker {
179
+ DERPReport : derphealth.Report {
180
+ Healthy : true ,
181
+ },
182
+ AccessURLReport : healthcheck.AccessURLReport {
183
+ Healthy : true ,
184
+ },
185
+ WebsocketReport : healthcheck.WebsocketReport {
186
+ Healthy : true ,
187
+ },
188
+ DatabaseReport : healthcheck.DatabaseReport {
189
+ Healthy : true ,
190
+ },
191
+ WorkspaceProxyReport : healthcheck.WorkspaceProxyReport {
192
+ Healthy : false ,
193
+ },
194
+ },
195
+ healthy : false ,
196
+ failingSections : []string {healthcheck .SectionWorkspaceProxy },
153
197
}, {
154
198
name : "AllFail" ,
155
199
checker : & testChecker {},
@@ -159,6 +203,7 @@ func TestHealthcheck(t *testing.T) {
159
203
healthcheck .SectionAccessURL ,
160
204
healthcheck .SectionWebsocket ,
161
205
healthcheck .SectionDatabase ,
206
+ healthcheck .SectionWorkspaceProxy ,
162
207
},
163
208
}} {
164
209
c := c
@@ -175,6 +220,8 @@ func TestHealthcheck(t *testing.T) {
175
220
assert .Equal (t , c .checker .DERPReport .Warnings , report .DERP .Warnings )
176
221
assert .Equal (t , c .checker .AccessURLReport .Healthy , report .AccessURL .Healthy )
177
222
assert .Equal (t , c .checker .WebsocketReport .Healthy , report .Websocket .Healthy )
223
+ assert .Equal (t , c .checker .WorkspaceProxyReport .Healthy , report .WorkspaceProxy .Healthy )
224
+ assert .Equal (t , c .checker .WorkspaceProxyReport .Warnings , report .WorkspaceProxy .Warnings )
178
225
assert .NotZero (t , report .Time )
179
226
assert .NotZero (t , report .CoderVersion )
180
227
})
0 commit comments