diff --git a/ddtelemetry/src/worker/http_client.rs b/ddtelemetry/src/worker/http_client.rs index 0e353294a..6d6b99fbe 100644 --- a/ddtelemetry/src/worker/http_client.rs +++ b/ddtelemetry/src/worker/http_client.rs @@ -5,7 +5,7 @@ use ddcommon::HttpRequestBuilder; use http::{Request, Response}; use hyper::Body; use std::{ - fs::File, + fs::OpenOptions, future::Future, io::Write, pin::Pin, @@ -46,7 +46,11 @@ pub fn from_config(c: &Config) -> Box { .expect("file urls should always have been encoded in authority"); return Box::new(MockClient { file: Arc::new(Mutex::new(Box::new( - File::create(file_path).expect("Couldn't open mock client file"), + OpenOptions::new() + .create(true) + .append(true) + .open(file_path.as_path()) + .expect("Couldn't open mock client file"), ))), }); } @@ -78,12 +82,12 @@ impl HttpClient for MockClient { fn request(&self, mut req: Request) -> ResponseFuture { let s = self.clone(); Box::pin(async move { - let body = hyper::body::to_bytes(req.body_mut()).await?; + let mut body = hyper::body::to_bytes(req.body_mut()).await?.to_vec(); + body.push(b'\n'); { let mut writer = s.file.lock().expect("mutex poisoned"); writer.write_all(body.as_ref()).unwrap(); - writer.write_all(b"\n").unwrap(); } Ok(Response::builder() diff --git a/tools/docker/Dockerfile.build b/tools/docker/Dockerfile.build index 955ff42a1..1d2168792 100644 --- a/tools/docker/Dockerfile.build +++ b/tools/docker/Dockerfile.build @@ -60,7 +60,7 @@ ENV PATH="/root/.cargo/bin:$PATH" ARG CARGO_BUILD_INCREMENTAL ARG CARGO_NET_RETRY ENV CARGO_NET_RETRY="${CARGO_NET_RETRY}" -RUN cargo install cbindgen && cargo install bindgen-cli --locked && rm -rf /root/.cargo/registry /root/.cargo/git +RUN cargo install cbindgen --version "^0.26" && cargo install bindgen-cli --locked && rm -rf /root/.cargo/registry /root/.cargo/git FROM alpine_aws_cli as alpine_builder COPY --from=alpine_cbindgen /root/.cargo/bin/cbindgen /usr/local/bin/cbindgen