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

Function TestNodeUpdater_setNetInfo_same

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

Source from the content-addressed store, hash-verified

71}
72
73func TestNodeUpdater_setNetInfo_same(t *testing.T) {
74 t.Parallel()
75 ctx := testutil.Context(t, testutil.WaitShort)
76 logger := testutil.Logger(t)
77 id := tailcfg.NodeID(1)
78 nodeKey := key.NewNode().Public()
79 discoKey := key.NewDisco().Public()
80 nodeCh := make(chan *Node)
81 uut := newNodeUpdater(
82 logger,
83 func(n *Node) {
84 nodeCh <- n
85 },
86 id, nodeKey, discoKey,
87 )
88 defer uut.close()
89
90 // Then: we don't configure
91 requireNeverConfigures(ctx, t, &uut.phased)
92
93 // Given: preferred DERP and latency already set
94 dl := map[string]float64{"1": 0.025}
95 uut.L.Lock()
96 uut.preferredDERP = 1
97 uut.derpLatency = maps.Clone(dl)
98 uut.L.Unlock()
99
100 // When: new update with same info
101 uut.setNetInfo(&tailcfg.NetInfo{
102 PreferredDERP: 1,
103 DERPLatency: dl,
104 })
105
106 done := make(chan struct{})
107 go func() {
108 defer close(done)
109 uut.close()
110 }()
111 _ = testutil.TryReceive(ctx, t, done)
112}
113
114func TestNodeUpdater_setDERPForcedWebsocket_different(t *testing.T) {
115 t.Parallel()

Callers

nothing calls this directly

Calls 10

ContextFunction · 0.92
LoggerFunction · 0.92
TryReceiveFunction · 0.92
newNodeUpdaterFunction · 0.85
requireNeverConfiguresFunction · 0.85
closeMethod · 0.65
LockMethod · 0.45
CloneMethod · 0.45
UnlockMethod · 0.45
setNetInfoMethod · 0.45

Tested by

no test coverage detected