Skip to content

Commit

Permalink
Fail tests early when "storage" not enabled (#1563)
Browse files Browse the repository at this point in the history
* Clarify the need to run tests with "storage" feature enabled

Signed-off-by: Tadeusz „tadzik” Sośnierz <[email protected]>

* 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 <[email protected]>

* Feature gate tests

* Revert README changes

---------

Signed-off-by: Tadeusz „tadzik” Sośnierz <[email protected]>
Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
tadzik and thibault-martinez authored Nov 22, 2023
1 parent b23d0e2 commit 7cc9bc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions bindings/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ impl WalletOptions {
self
}

#[cfg(feature = "storage")]
pub fn with_storage_path(mut self, storage_path: impl Into<Option<String>>) -> Self {
self.storage_path = storage_path.into();
self
Expand Down
3 changes: 3 additions & 0 deletions bindings/core/tests/combined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 7cc9bc7

Please sign in to comment.