MCPcopy Index your code
hub / github.com/coder/coder / TestNodeUpdater_setStatus_error

Function TestNodeUpdater_setStatus_error

tailnet/node_internal_test.go:281–317  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

279}
280
281func TestNodeUpdater_setStatus_error(t *testing.T) {
282 t.Parallel()
283 ctx := testutil.Context(t, testutil.WaitShort)
284 logger := testutil.Logger(t)
285 id := tailcfg.NodeID(1)
286 nodeKey := key.NewNode().Public()
287 discoKey := key.NewDisco().Public()
288 nodeCh := make(chan *Node)
289 uut := newNodeUpdater(
290 logger,
291 func(n *Node) {
292 nodeCh <- n
293 },
294 id, nodeKey, discoKey,
295 )
296 defer uut.close()
297
298 // Then: we don't configure
299 requireNeverConfigures(ctx, t, &uut.phased)
300
301 // Given: preferred DERP is 1, so we would send an update on change && empty endpoints
302 uut.L.Lock()
303 uut.preferredDERP = 1
304 uut.L.Unlock()
305
306 // When: we set a status with endpoints {[fe80::1]:5678}, with an error
307 uut.setStatus(&wgengine.Status{LocalAddrs: []tailcfg.Endpoint{
308 {Addr: netip.MustParseAddrPort("[fe80::1]:5678")},
309 }}, xerrors.New("test"))
310
311 done := make(chan struct{})
312 go func() {
313 defer close(done)
314 uut.close()
315 }()
316 _ = testutil.TryReceive(ctx, t, done)
317}
318
319func TestNodeUpdater_setStatus_outdated(t *testing.T) {
320 t.Parallel()

Callers

nothing calls this directly

Calls 10

ContextFunction · 0.92
LoggerFunction · 0.92
TryReceiveFunction · 0.92
newNodeUpdaterFunction · 0.85
requireNeverConfiguresFunction · 0.85
setStatusMethod · 0.80
closeMethod · 0.65
NewMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected