(t *testing.T)
| 239 | } |
| 240 | |
| 241 | func TestNodeUpdater_setStatus_same(t *testing.T) { |
| 242 | t.Parallel() |
| 243 | ctx := testutil.Context(t, testutil.WaitShort) |
| 244 | logger := testutil.Logger(t) |
| 245 | id := tailcfg.NodeID(1) |
| 246 | nodeKey := key.NewNode().Public() |
| 247 | discoKey := key.NewDisco().Public() |
| 248 | nodeCh := make(chan *Node) |
| 249 | uut := newNodeUpdater( |
| 250 | logger, |
| 251 | func(n *Node) { |
| 252 | nodeCh <- n |
| 253 | }, |
| 254 | id, nodeKey, discoKey, |
| 255 | ) |
| 256 | defer uut.close() |
| 257 | |
| 258 | // Then: we don't configure |
| 259 | requireNeverConfigures(ctx, t, &uut.phased) |
| 260 | |
| 261 | // Given: preferred DERP is 1, so we would send an update on change && |
| 262 | // endpoints set to {"[fe80::1]:5678"} |
| 263 | uut.L.Lock() |
| 264 | uut.preferredDERP = 1 |
| 265 | uut.endpoints = []string{"[fe80::1]:5678"} |
| 266 | uut.L.Unlock() |
| 267 | |
| 268 | // When: we set a status with endpoints {[fe80::1]:5678} |
| 269 | uut.setStatus(&wgengine.Status{LocalAddrs: []tailcfg.Endpoint{ |
| 270 | {Addr: netip.MustParseAddrPort("[fe80::1]:5678")}, |
| 271 | }}, nil) |
| 272 | |
| 273 | done := make(chan struct{}) |
| 274 | go func() { |
| 275 | defer close(done) |
| 276 | uut.close() |
| 277 | }() |
| 278 | _ = testutil.TryReceive(ctx, t, done) |
| 279 | } |
| 280 | |
| 281 | func TestNodeUpdater_setStatus_error(t *testing.T) { |
| 282 | t.Parallel() |
nothing calls this directly
no test coverage detected