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: | 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(); diff --git a/rust/agama-lib/src/profile.rs b/rust/agama-lib/src/profile.rs index d681758a8c..f2b589aa90 100644 --- a/rust/agama-lib/src/profile.rs +++ b/rust/agama-lib/src/profile.rs @@ -92,20 +92,23 @@ 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)); +/// 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 { validator: jsonschema::Validator,