From d79186cac3fede1255586baa62ce54a07cc549f9 Mon Sep 17 00:00:00 2001 From: Anton Whalley Date: Wed, 6 Mar 2024 21:33:58 +0000 Subject: [PATCH 1/2] fix: Updated clippy and fix big_data exe Signed-off-by: Anton Whalley --- mock/big_data/crictl | 0 src/lib.rs | 38 +++++++++++++++++--------------------- 2 files changed, 17 insertions(+), 21 deletions(-) mode change 100644 => 100755 mock/big_data/crictl diff --git a/mock/big_data/crictl b/mock/big_data/crictl old mode 100644 new mode 100755 diff --git a/src/lib.rs b/src/lib.rs index 15f647d..c638c1a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -236,11 +236,9 @@ impl Cli { } } } - return Err(format!("no images matched in crictl img {:?}", log_args)); - } - None => { - return Err(format!("no images found in crictl img {:?}", log_args)); + Err(format!("no images matched in crictl img {:?}", log_args)) } + None => Err(format!("no images found in crictl img {:?}", log_args)), } } @@ -327,12 +325,10 @@ impl Cli { fn slice_to_value(slice: &[u8], args: Vec<&str>) -> Result { match serde_json::from_slice(slice) { Ok(v) => Ok(v), - Err(e) => { - return Err(format!( - "failed to create output from slice for {:?} {}", - args, e - )); - } + Err(e) => Err(format!( + "failed to create output from slice for {:?} {}", + args, e + )), } } @@ -383,12 +379,10 @@ fn run_command_text(args: Vec<&str>, bin_path: &str) -> Result { // } let mut ok_str = String::new(); match waiter.stdout.as_slice().read_to_string(&mut ok_str) { - Err(e) => { - return Err(format!( - "stdout error - failed to execute crictl {:?} {}", - args, e - )); - } + Err(e) => Err(format!( + "stdout error - failed to execute crictl {:?} {}", + args, e + )), Ok(_) => Ok(ok_str), } } @@ -599,7 +593,9 @@ mod tests { fn test_inspect_container() { for cli in get_clis() { let val = cli - .inspect_container("765312810c818bca4836c3598e21471bfd96be8ca84ca952290a9900b7c055a7") + .inspect_container( + "765312810c818bca4836c3598e21471bfd96be8ca84ca952290a9900b7c055a7", + ) .unwrap(); assert_eq!(val["info"]["pid"].as_i64().unwrap(), 254405) } @@ -617,8 +613,8 @@ mod tests { #[test] fn test_inspect_container_only_errors_cli() { let cli = get_only_errors_cli(); - let val = - cli.inspect_container("765312810c818bca4836c3598e21471bfd96be8ca84ca952290a9900b7c055a7"); + let val = cli + .inspect_container("765312810c818bca4836c3598e21471bfd96be8ca84ca952290a9900b7c055a7"); let expected = Err(String::from("failed to create output from slice for [\"inspect\", \"765312810c818bca4836c3598e21471bfd96be8ca84ca952290a9900b7c055a7\"] EOF while parsing a value at line 2 column 0")); assert_eq!(expected, val); } @@ -626,8 +622,8 @@ mod tests { #[test] fn test_inspect_container_bad_json_cli() { let cli = get_bad_json_cli(); - let val = - cli.inspect_container("765312810c818bca4836c3598e21471bfd96be8ca84ca952290a9900b7c055a7"); + let val = cli + .inspect_container("765312810c818bca4836c3598e21471bfd96be8ca84ca952290a9900b7c055a7"); let expected = Err(String::from("failed to create output from slice for [\"inspect\", \"765312810c818bca4836c3598e21471bfd96be8ca84ca952290a9900b7c055a7\"] EOF while parsing a value at line 2 column 0")); assert_eq!(expected, val); } From d282c63db95860788a7cf65b2a6d50f7df9089be Mon Sep 17 00:00:00 2001 From: Anton Whalley Date: Wed, 6 Mar 2024 21:44:41 +0000 Subject: [PATCH 2/2] fix: remove coverage and bump version Signed-off-by: Anton Whalley --- .github/workflows/ci.yaml | 17 ----------------- Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 728e981..eec05a2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,20 +52,3 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} args: -- -D warnings - - coverage: - name: Code coverage - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Run cargo-tarpaulin - uses: actions-rs/tarpaulin@v0.1 - with: - args: '--ignore-tests --avoid-cfg-tarpaulin' \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index ad3ac66..7018379 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libcrio" -version = "2.0.0" +version = "2.1.0" edition = "2021" authors = ["Anton Whalley "] description = "A wrapper around the crictl cli to return serde_json objects"