(t *testing.T)
| 279 | } |
| 280 | |
| 281 | func 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 | |
| 319 | func TestNodeUpdater_setStatus_outdated(t *testing.T) { |
| 320 | t.Parallel() |
nothing calls this directly
no test coverage detected