Skip to content

Commit 809b662

Browse files
committed
test(kv): align advanced KV test with zerompk Value encoding
The test was building documents with json_to_msgpack (JsonValue format) but the KV engine stores and reads using value_to_msgpack (Value::Object format). Switch to constructing Value::Object directly and encode the secondary-index update value with zerompk as well.
1 parent 09c0966 commit 809b662

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

nodedb/tests/executor_tests/test_kv_advanced.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,18 @@ fn ttl_expiry_produces_expired_key_info() {
299299
fn kv_field_get_and_set() {
300300
let (mut core, mut tx, mut rx, _dir) = make_core();
301301

302-
// Store a MessagePack-encoded document.
303-
let doc = nodedb_types::json_to_msgpack(&serde_json::json!({
304-
"name": "alice",
305-
"age": 30,
306-
"region": "us-east"
307-
}))
308-
.unwrap();
302+
// Store a zerompk-encoded Value::Object (canonical KV format).
303+
let mut map = std::collections::HashMap::new();
304+
map.insert(
305+
"name".to_string(),
306+
nodedb_types::Value::String("alice".into()),
307+
);
308+
map.insert("age".to_string(), nodedb_types::Value::Integer(30));
309+
map.insert(
310+
"region".to_string(),
311+
nodedb_types::Value::String("us-east".into()),
312+
);
313+
let doc = nodedb_types::value_to_msgpack(&nodedb_types::Value::Object(map)).unwrap();
309314

310315
send_ok(
311316
&mut core,
@@ -344,7 +349,7 @@ fn kv_field_get_and_set() {
344349
key: b"u1".to_vec(),
345350
updates: vec![(
346351
"region".into(),
347-
serde_json::to_vec(&serde_json::json!("eu-west")).unwrap(),
352+
zerompk::to_msgpack_vec(&nodedb_types::Value::String("eu-west".into())).unwrap(),
348353
)],
349354
}),
350355
);

0 commit comments

Comments
 (0)