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

Function TestNodeUpdater_setStatus_same

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

Source from the content-addressed store, hash-verified

239}
240
241func 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
281func TestNodeUpdater_setStatus_error(t *testing.T) {
282 t.Parallel()

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected