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

Function TestOnlyNodeUpdates

tailnet/convert_test.go:107–138  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

105}
106
107func TestOnlyNodeUpdates(t *testing.T) {
108 t.Parallel()
109 node := &tailnet.Node{ID: tailcfg.NodeID(1)}
110 p, err := tailnet.NodeToProto(node)
111 require.NoError(t, err)
112 resp := &proto.CoordinateResponse{
113 PeerUpdates: []*proto.CoordinateResponse_PeerUpdate{
114 {
115 Id: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
116 Kind: proto.CoordinateResponse_PeerUpdate_NODE,
117 Node: p,
118 },
119 {
120 Id: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2},
121 Kind: proto.CoordinateResponse_PeerUpdate_DISCONNECTED,
122 Reason: "disconnected",
123 },
124 {
125 Id: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3},
126 Kind: proto.CoordinateResponse_PeerUpdate_LOST,
127 Reason: "disconnected",
128 },
129 {
130 Id: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4},
131 },
132 },
133 }
134 nodes, err := tailnet.OnlyNodeUpdates(resp)
135 require.NoError(t, err)
136 require.Len(t, nodes, 1)
137 require.Equal(t, tailcfg.NodeID(1), nodes[0].ID)
138}
139
140func TestSingleNodeUpdate(t *testing.T) {
141 t.Parallel()

Callers

nothing calls this directly

Calls 4

NodeToProtoFunction · 0.92
OnlyNodeUpdatesFunction · 0.92
LenMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected