(t *testing.T)
| 105 | } |
| 106 | |
| 107 | func 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 | |
| 140 | func TestSingleNodeUpdate(t *testing.T) { |
| 141 | t.Parallel() |
nothing calls this directly
no test coverage detected