You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: trace_context_propagation.rs
    path of file: ./repos/ockam/implementations/rust/ockam/ockam_api/tests
    
    the code of the file until where you have to start completion: mod common;

use crate::common::trace_code::*;
use itertools::Itertools;
use ockam::identity::{SecureChannelListenerOptions, SecureChannelOptions};
use ockam::node;
use ockam_api::echoer::Echoer;
use ockam_core::{route, Address, AsyncTryClone, OpenTelemetryContext, Routed, Worker};
use ockam_node::Context;
use ockam_transport_core::Transport;
use ockam_transport_tcp::{TcpListenerOptions, TcpTransportExtension, TCP};
use std::time::Duration;
use tonic::async_trait;
use tracing::instrument;

/// These tests need to be integration tests
/// They need to run in isolation because
/// they set up some global spans / logs exporters that might interact with other tests

/// This test checks that the tracing context that we propagate to other systems contains
/// a proper span id when spans are created with instrumented methods
#[test]
fn test_context_propagation_across_instrumented_methods() {
    let (propagated_context, mut spans) = trace_code(|_| function());
    spans.reverse();

    // there must be 3 spans
    assert_eq!(
        spans.len(),
        3,
        "{}",
        spans.iter().map(|s| s.name.to_string()).join(", ")
    );
    let span1 = spans.get(0).unwrap();
    let span2 = spans.get(1).unwrap();
    let span3 = spans.get(2).unwrap();

    // the spans must have proper parent / child relationships
    assert_eq!(span1.name, "root");

    assert_eq!(span2.name, "function");
    assert_eq!(span2.parent_span_id, span1.span_context.span_id());

    assert_eq!(span3.name, "nested_function");
    assert_eq!(span3.parent_span_id, span2.span_context.span_id());

    // the propagated context must use the span id of the most nested span id
    let context = propagated_context.as_map();
    let traceparent = context.get("traceparent").unwrap();
    assert_eq!(
        traceparent.to_string(),
        format!(
            "00-{}-{}-01",
            span1.span_context.trace_id(),
            span3.span_context.span_id()
        )
    );
}

#[tracing::ins
    
fn test_context_propagation_across_workers_and_nodes_over_secure_channel() {
    let (received, spans) = trace_code(|ctx| send_echo_message_over_secure_channel(ctx, "hello"));
    assert_eq!(received.unwrap(), "hello".to_string());

    // There are 6 traces:
    //  - 2 for the shutdown of encryptors on both sides of the secure channel
    //  - 2 for the TCP processors, just waiting to process incoming TCP data
    //  - 1 for the initial handshake
    //  - 1 for sending an encrypted message
    let actual = display_traces(spans);
    let expected = r#"
EncryptorWorker::shutdown

EncryptorWorker::shutdown
└── TcpSendWorker::handle_message
    └── TcpRecvProcessor::process
        └── DecryptorWorker::handle_message
            └── handle_decrypt

TcpRecvProcessor::process

TcpRecvProcessor::process

root
└── send_echo_message_over_secure_channel
    ├── create tcp transport
    ├── create tcp transport
    ├── TcpSendWorker::handle_message
    |   └── TcpRecvProcessor::process
    |       └── HandshakeWorker::handle_message
    |           └── TcpSendWorker::handle_message
    |               └── TcpRecvProcessor::process
    |                   └── HandshakeWorker::handle_message
    |                       └── TcpSendWorker::handle_message
    |                           └── TcpRecvProcessor::process
    |                               └── HandshakeWorker::handle_message
    └── MessageSender::handle_message
        └── EncryptorWorker::handle_message
            └── handle_encrypt
                └── TcpSendWorker::handle_message
                    └── TcpRecvProcessor::process
                        └── DecryptorWorker::handle_message
                            └── handle_decrypt
                                └── Echoer::handle_message
                                    └── EncryptorWorker::handle_message
                                        └── handle_encrypt
                                            └── TcpSendWorker::handle_message
                                                └── TcpRecvProcessor::process
                                                    └── DecryptorWorker::handle_message
                                                        └── handle_decrypt
"#;
    pretty_assertions::assert_eq!(format!("\n{actual}"), expected);
}