MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / roundtrip_join_response

Function roundtrip_join_response

nodedb-cluster/src/rpc_codec/cluster_mgmt.rs:205–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203
204 #[test]
205 fn roundtrip_join_response() {
206 let resp = JoinResponse {
207 success: true,
208 error: String::new(),
209 cluster_id: 12345,
210 nodes: vec![JoinNodeInfo {
211 node_id: 1,
212 addr: "10.0.0.1:9400".into(),
213 state: 1,
214 raft_groups: vec![0, 1],
215 wire_version: crate::topology::CLUSTER_WIRE_FORMAT_VERSION,
216 spiffe_id: None,
217 spki_pin: None,
218 }],
219 vshard_to_group: (0..1024u64).map(|i| i % 4).collect(),
220 groups: vec![JoinGroupInfo {
221 group_id: 0,
222 leader: 1,
223 members: vec![1],
224 learners: vec![],
225 }],
226 };
227 match roundtrip(RaftRpc::JoinResponse(resp)) {
228 RaftRpc::JoinResponse(d) => {
229 assert!(d.success);
230 assert_eq!(d.nodes.len(), 1);
231 assert_eq!(d.vshard_to_group.len(), 1024);
232 }
233 other => panic!("expected JoinResponse, got {other:?}"),
234 }
235 }
236}

Callers

nothing calls this directly

Calls 3

JoinResponseClass · 0.85
collectMethod · 0.80
roundtripFunction · 0.70

Tested by

no test coverage detected