INNER CODE UNIT · Rust

rewrite_adds_extra_hosts

Augani/dory · dory-core/ffi/src/lib.rs:332

    fn rewrite_adds_extra_hosts() {
        let r = rewrite_create_body(br#"{"Image":"alpine"}"#.to_vec(), true);
        assert!(r.ok);
        let v: serde_json::Value = serde_json::from_slice(&r.body).unwrap();
        assert!(v["HostConfig"]["ExtraHosts"].as_array().unwrap().len() >= 2);
    }

    /// The real seam-2 path: bind a listener (as Swift would), hand its raw fd to `start_dataplane`,
    /// and confirm a docker create through that socket reaches the backend with the body rewritten —
    /// all bytes staying inside Rust.
    #[tokio::test]
    async fn start_dataplane_serves_a_handed_over_fd() {
        use std::os::unix::io::IntoRawFd;
        use std::sync::Mutex;
        use tokio::io::{AsyncReadExt, AsyncWriteExt};
        use tokio::net::{UnixListener, UnixStream};

        let base = std::env::temp_dir();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…