From 127c94f544fadac4ccbf0e40761301f20309074f Mon Sep 17 00:00:00 2001 From: Charles Sibbald Date: Mon, 20 Feb 2023 22:27:27 +0200 Subject: [PATCH] adding resize --- justfile | 10 ++++++++++ src/builder.rs | 17 +++++++++++++++++ tests/docker_tests.rs | 5 +---- 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..2d33501 --- /dev/null +++ b/justfile @@ -0,0 +1,10 @@ +#Build convenience + +lint: + cargo clippy --all-targets --all-features -- -D clippy::all + cargo fmt --all -- --check + +test: + docker pull ubuntu:latest + cargo test --all-features --all-targets + cargo test --doc diff --git a/src/builder.rs b/src/builder.rs index a6ea591..93d7db9 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -298,4 +298,21 @@ macro_rules! impl_api_ep { } }} }; + ( + Reize $it:ident: $base:ident -> $resp:ident $ep:expr, $ret:expr $(, $extra:expr)* + ) => { + paste::item! { + api_doc! { $base => Resize + | + #[doc = concat!("Resizes TTY of container ", stringify!($base), ".")] + pub fn resize(&self, opts: &[< $base ResizeOpts >]) -> Result<$ret> { + self.docker + .post_json( + &containers_api::url::construct_ep($ep, opts.serialize()), + crate::conn:Payload::empty(), + crate::conn::Headers::none(), + ).await + }} + } + }; } diff --git a/tests/docker_tests.rs b/tests/docker_tests.rs index a421ebf..0df4568 100644 --- a/tests/docker_tests.rs +++ b/tests/docker_tests.rs @@ -9,10 +9,7 @@ async fn docker_info() { let info_result = docker.info().await; assert!(info_result.is_ok()); let info_data = info_result.unwrap(); - assert_eq!( - info_data.name.unwrap(), - gethostname::gethostname().into_string().unwrap() - ); + assert_eq!(info_data.os_type.unwrap(), "linux".to_string()); } #[tokio::test]