From a586320822428625ed3fd18b59069d7cbde6c6de Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Mon, 19 May 2025 17:54:23 +0200 Subject: [PATCH 1/4] run with tarpaulin also doctests --- .github/workflows/ci-rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-rust.yml b/.github/workflows/ci-rust.yml index 268fa0ce9c..f82c7675f5 100644 --- a/.github/workflows/ci-rust.yml +++ b/.github/workflows/ci-rust.yml @@ -109,7 +109,7 @@ jobs: cargo-binstall --no-confirm cargo-tarpaulin - name: Run the tests - run: cargo tarpaulin --out xml -- --nocapture + run: cargo tarpaulin --all --doc --out xml -- --nocapture - name: Generate and validate the OpenAPI specification run: | From b53b6a3d4ece63b9add0591bb713efcaae8a5053 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Mon, 19 May 2025 18:31:28 +0200 Subject: [PATCH 2/4] fix doc test --- rust/agama-lib/src/monitor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/agama-lib/src/monitor.rs b/rust/agama-lib/src/monitor.rs index 4866ceea7a..df4e99e94f 100644 --- a/rust/agama-lib/src/monitor.rs +++ b/rust/agama-lib/src/monitor.rs @@ -37,7 +37,7 @@ //! async fn print_status(http_url: url::Url, ws_url: url::Url, token: AuthToken) -> anyhow::Result<()> { //! let http_client = BaseHTTPClient::new(http_url)? //! .authenticated(&token)?; -//! let ws_client = WebSocketClient::connect(&ws_url, token.clone(), false) +//! let ws_client = WebSocketClient::connect(&ws_url, &token, false) //! .await?; //! let monitor = Monitor::connect(http_client, ws_client).await.unwrap(); //! let mut updates = monitor.subscribe(); From 1f6e281a170bec9539fe96dd5b42d6dc2085d700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Tue, 20 May 2025 10:23:54 +0100 Subject: [PATCH 3/4] fix build --- rust/agama-lib/src/profile.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rust/agama-lib/src/profile.rs b/rust/agama-lib/src/profile.rs index d681758a8c..1b63b9afc6 100644 --- a/rust/agama-lib/src/profile.rs +++ b/rust/agama-lib/src/profile.rs @@ -92,20 +92,21 @@ impl std::fmt::Display for ValidationOutcome { /// ``` /// # use agama_lib::profile::{ProfileValidator, ValidationOutcome}; /// # use std::path::Path; -/// let validator = ProfileValidator::new( -/// Path::new("share/profile.schema.json") -/// ).expect("the default validator"); +/// let path = Path::new(env!("CARGO_MANIFEST_DIR")) +/// .join("share/profile.schema.json"); +/// let validator = ProfileValidator::new(&path) +/// .expect("the default validator"); /// /// // you can validate a &str /// let wrong_profile = r#" /// { "product": { "name": "Tumbleweed" } } /// "#; /// let result = validator.validate_str(&wrong_profile).unwrap(); -/// assert!(matches!(ValidationOutcome::NotValid, result)); +/// assert!(matches!(result, ValidationOutcome::NotValid(_))); /// /// // or a file /// validator.validate_file(Path::new("share/examples/profile.json")); -/// assert!(matches!(ValidationOutcome::Valid, result)); +/// assert!(matches!(result, ValidationOutcome::Valid)); /// ``` pub struct ProfileValidator { validator: jsonschema::Validator, From 3d20588aaf15fba8d02517ac6d8885509045ea24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Tue, 20 May 2025 11:06:43 +0100 Subject: [PATCH 4/4] fix(rust): fix profile doctests --- rust/agama-lib/src/profile.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/agama-lib/src/profile.rs b/rust/agama-lib/src/profile.rs index 1b63b9afc6..f2b589aa90 100644 --- a/rust/agama-lib/src/profile.rs +++ b/rust/agama-lib/src/profile.rs @@ -105,7 +105,9 @@ impl std::fmt::Display for ValidationOutcome { /// assert!(matches!(result, ValidationOutcome::NotValid(_))); /// /// // or a file -/// validator.validate_file(Path::new("share/examples/profile.json")); +/// let path = Path::new(env!("CARGO_MANIFEST_DIR")) +/// .join("share/examples/profile_tw.json"); +/// let result = validator.validate_file(&path).unwrap(); /// assert!(matches!(result, ValidationOutcome::Valid)); /// ``` pub struct ProfileValidator {