From 7cc9bc713944dfae7074fd4f0ae851c8e5800d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadeusz=20So=C5=9Bnierz?= Date: Wed, 22 Nov 2023 11:09:30 +0100 Subject: [PATCH] Fail tests early when "storage" not enabled (#1563) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Clarify the need to run tests with "storage" feature enabled Signed-off-by: Tadeusz „tadzik” Sośnierz * Put WalletOptions::with_storage_path behind the feature flag This allows us to fail early if the storage feature is not enabled, rather than having code which appears to work but doesn't. Signed-off-by: Tadeusz „tadzik” Sośnierz * Feature gate tests * Revert README changes --------- Signed-off-by: Tadeusz „tadzik” Sośnierz Co-authored-by: Thibault Martinez --- bindings/core/src/lib.rs | 1 + bindings/core/tests/combined.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/bindings/core/src/lib.rs b/bindings/core/src/lib.rs index f4fbfce8bb..d7dc366cfa 100644 --- a/bindings/core/src/lib.rs +++ b/bindings/core/src/lib.rs @@ -80,6 +80,7 @@ impl WalletOptions { self } + #[cfg(feature = "storage")] pub fn with_storage_path(mut self, storage_path: impl Into>) -> Self { self.storage_path = storage_path.into(); self diff --git a/bindings/core/tests/combined.rs b/bindings/core/tests/combined.rs index ffe7fe20d3..68ae893166 100644 --- a/bindings/core/tests/combined.rs +++ b/bindings/core/tests/combined.rs @@ -22,6 +22,7 @@ use iota_sdk_bindings_core::{ }; use pretty_assertions::assert_eq; +#[cfg(feature = "storage")] #[tokio::test] async fn create_wallet() -> Result<()> { let storage_path = "test-storage/create_wallet"; @@ -59,6 +60,7 @@ async fn create_wallet() -> Result<()> { Ok(()) } +#[cfg(feature = "storage")] #[tokio::test] async fn client_from_wallet() -> Result<()> { let storage_path = "test-storage/client_from_wallet"; @@ -100,6 +102,7 @@ async fn client_from_wallet() -> Result<()> { } // TODO reenable +// #[cfg(feature = "storage")] // #[tokio::test] // async fn build_and_sign_block() -> Result<()> { // let storage_path = "test-storage/build_and_sign_block";