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

Function TestNodeUpdater_setDERPForcedWebsocket_same

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

Source from the content-addressed store, hash-verified

151}
152
153func TestNodeUpdater_setDERPForcedWebsocket_same(t *testing.T) {
154 t.Parallel()
155 ctx := testutil.Context(t, testutil.WaitShort)
156 logger := testutil.Logger(t)
157 id := tailcfg.NodeID(1)
158 nodeKey := key.NewNode().Public()
159 discoKey := key.NewDisco().Public()
160 nodeCh := make(chan *Node)
161 uut := newNodeUpdater(
162 logger,
163 func(n *Node) {
164 nodeCh <- n
165 },
166 id, nodeKey, discoKey,
167 )
168 defer uut.close()
169
170 // Then: we don't configure
171 requireNeverConfigures(ctx, t, &uut.phased)
172
173 // Given: preferred DERP is 1, so we would send an update on change &&
174 // reason for region 1 is set to "test"
175 uut.L.Lock()
176 uut.preferredDERP = 1
177 uut.derpForcedWebsockets[1] = "test"
178 uut.L.Unlock()
179
180 // When: we set region 1 to "test
181 uut.setDERPForcedWebsocket(1, "test")
182
183 done := make(chan struct{})
184 go func() {
185 defer close(done)
186 uut.close()
187 }()
188 _ = testutil.TryReceive(ctx, t, done)
189}
190
191func TestNodeUpdater_setStatus_different(t *testing.T) {
192 t.Parallel()

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected