Skip to content

Commit 28f4c58

Browse files
yannhamclaude
andcommitted
test: merge publish and update otel process context tests
Replace the separate `publish_then_read_context` and `update_process_context` tests with a single `publish_then_update_process_context` test that checks all header fields (signature, version, payload size, timestamp, payload content) after the initial publish of `payload_v1`, then again after the update to `payload_v2`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 97120e3 commit 28f4c58

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

libdd-library-config/src/otel_process_ctx.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,13 @@ pub mod linux {
467467

468468
#[test]
469469
#[cfg_attr(miri, ignore)]
470-
fn publish_then_read_context() {
471-
let payload = "example process context payload";
470+
fn publish_then_update_process_context() {
471+
let payload_v1 = "example process context payload";
472+
let payload_v2 = "another example process context payload of different size";
472473

473-
super::publish(payload.as_bytes().to_vec())
474+
super::publish(payload_v1.as_bytes().to_vec())
474475
.expect("couldn't publish the process context");
476+
475477
let header = read_process_context().expect("couldn't read back the process context");
476478
// Safety: the published context must have put valid bytes of size payload_size in the
477479
// context if the signature check succeded.
@@ -485,27 +487,16 @@ pub mod linux {
485487
"wrong context version"
486488
);
487489
assert!(
488-
header.payload_size == payload.len() as u32,
490+
header.payload_size == payload_v1.len() as u32,
489491
"wrong payload size"
490492
);
491493
assert!(header.published_at_ns > 0, "published_at_ns is zero");
492-
assert!(read_payload == payload.as_bytes(), "payload mismatch");
494+
assert!(read_payload == payload_v1.as_bytes(), "payload mismatch");
493495

494-
super::unpublish().expect("couldn't unpublish the context");
495-
}
496-
497-
#[test]
498-
#[cfg_attr(miri, ignore)]
499-
fn update_process_context() {
500-
let payload_v1 = "example process context payload";
501-
let payload_v2 = "another example process context payload of different size";
502-
503-
super::publish(payload_v1.as_bytes().to_vec())
504-
.expect("couldn't publish the process context");
505496
super::publish(payload_v2.as_bytes().to_vec())
506497
.expect("couldn't update the process context");
507498

508-
let header = read_process_context().expect("couldn't read back the process contex");
499+
let header = read_process_context().expect("couldn't read back the process context");
509500
// Safety: the published context must have put valid bytes of size payload_size in the
510501
// context if the signature check succeded.
511502
let read_payload = unsafe {

0 commit comments

Comments
 (0)