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

Function write_request_roundtrip

nodedb/src/control/promql/remote_proto.rs:160–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

158
159 #[test]
160 fn write_request_roundtrip() {
161 let req = WriteRequest {
162 timeseries: vec![TimeSeries {
163 labels: vec![
164 Label {
165 name: "__name__".into(),
166 value: "up".into(),
167 },
168 Label {
169 name: "job".into(),
170 value: "api".into(),
171 },
172 ],
173 samples: vec![Sample {
174 value: 1.0,
175 timestamp: 1000,
176 }],
177 exemplars: vec![],
178 }],
179 };
180
181 let mut buf = Vec::new();
182 req.encode(&mut buf).unwrap();
183 let decoded = WriteRequest::decode(&buf[..]).unwrap();
184 assert_eq!(decoded.timeseries.len(), 1);
185 assert_eq!(decoded.timeseries[0].metric_name(), "up");
186 }
187
188 #[test]
189 fn to_ilp_lines() {

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.50
encodeMethod · 0.45

Tested by

no test coverage detected