@@ -186,6 +186,49 @@ func TestDERP(t *testing.T) {
186
186
}
187
187
}
188
188
})
189
+
190
+ t .Run ("OK/STUNOnly" , func (t * testing.T ) {
191
+ t .Parallel ()
192
+
193
+ var (
194
+ ctx = context .Background ()
195
+ report = healthcheck.DERPReport {}
196
+ opts = & healthcheck.DERPReportOptions {
197
+ DERPMap : & tailcfg.DERPMap {Regions : map [int ]* tailcfg.DERPRegion {
198
+ 1 : {
199
+ EmbeddedRelay : true ,
200
+ RegionID : 999 ,
201
+ Nodes : []* tailcfg.DERPNode {{
202
+ Name : "999stun0" ,
203
+ RegionID : 999 ,
204
+ HostName : "stun.l.google.com" ,
205
+ STUNPort : 19302 ,
206
+ STUNOnly : true ,
207
+ InsecureForTests : true ,
208
+ ForceHTTP : true ,
209
+ }},
210
+ },
211
+ }},
212
+ }
213
+ )
214
+
215
+ err := report .Run (ctx , opts )
216
+ require .NoError (t , err )
217
+
218
+ assert .True (t , report .Healthy )
219
+ for _ , region := range report .Regions {
220
+ assert .True (t , region .Healthy )
221
+ for _ , node := range region .NodeReports {
222
+ assert .True (t , node .Healthy )
223
+ assert .False (t , node .CanExchangeMessages )
224
+ assert .Len (t , node .ClientLogs , 0 )
225
+
226
+ assert .True (t , node .STUN .Enabled )
227
+ assert .True (t , node .STUN .CanSTUN )
228
+ assert .NoError (t , node .STUN .Error )
229
+ }
230
+ }
231
+ })
189
232
}
190
233
191
234
func tsDERPMap (ctx context.Context , t testing.TB ) * tailcfg.DERPMap {
0 commit comments