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

Function stitch

tailnet/conn_test.go:474–492  ·  view source on GitHub ↗

stitch sends node updates from src Conn as peer updates to dst Conn. Sort of like the Coordinator would, but without actually needing a Coordinator.

(t *testing.T, dst, src *tailnet.Conn)

Source from the content-addressed store, hash-verified

472// stitch sends node updates from src Conn as peer updates to dst Conn. Sort of
473// like the Coordinator would, but without actually needing a Coordinator.
474func stitch(t *testing.T, dst, src *tailnet.Conn) {
475 srcID := uuid.New()
476 src.SetNodeCallback(func(node *tailnet.Node) {
477 pn, err := tailnet.NodeToProto(node)
478 if !assert.NoError(t, err) {
479 return
480 }
481 err = dst.UpdatePeers([]*proto.CoordinateResponse_PeerUpdate{{
482 Id: srcID[:],
483 Node: pn,
484 Kind: proto.CoordinateResponse_PeerUpdate_NODE,
485 }})
486 assert.NoError(t, err)
487 })
488 // ensures we don't send callbacks after the test ends and connections are closed.
489 t.Cleanup(func() {
490 src.SetNodeCallback(nil)
491 })
492}
493
494func TestTailscaleServicePrefix(t *testing.T) {
495 t.Parallel()

Callers 3

TestTailnetFunction · 0.85
TestConn_UpdateDERPFunction · 0.85
TestConn_BlockEndpointsFunction · 0.85

Calls 5

NodeToProtoFunction · 0.92
NewMethod · 0.65
SetNodeCallbackMethod · 0.65
UpdatePeersMethod · 0.65
CleanupMethod · 0.65

Tested by

no test coverage detected