Skip to content

Commit

Permalink
Fix profile building in tests, considering vdrtools is default feature (
Browse files Browse the repository at this point in the history
#960)

* Fix profile building in tests, considering vdrtools is default feature

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Test code adjustments

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Simplify dev_build_featured_profile

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Revert CI change

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

---------

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
  • Loading branch information
Patrik-Stas authored Aug 30, 2023
1 parent ce61866 commit f8aaadc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion aries_vcx/src/common/primitives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub mod integration_tests {
#[tokio::test]
#[ignore]
async fn test_pool_rev_reg_def_fails_for_cred_def_created_without_revocation() {
// todo: does not need agency setup
SetupProfile::run(|setup| async move {
// Cred def is created with support_revocation=false,
// revoc_reg_def will fail in libindy because cred_Def doesn't have revocation keys
Expand All @@ -44,6 +43,9 @@ pub mod integration_tests {
)
.await;

#[cfg(feature = "modular_libs")]
assert_eq!(rc.unwrap_err().kind(), AriesVcxErrorKind::InvalidState);
#[cfg(not(feature = "modular_libs"))]
assert_eq!(rc.unwrap_err().kind(), AriesVcxErrorKind::InvalidInput);
})
.await;
Expand Down
11 changes: 10 additions & 1 deletion aries_vcx/src/utils/devsetup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ pub async fn dev_setup_issuer_wallet_and_agency_client() -> (String, WalletHandl
}

pub async fn dev_setup_wallet_indy(key_seed: &str) -> (String, WalletHandle) {
info!("dev_setup_wallet_indy >>");
let config_wallet = WalletConfig {
wallet_name: format!("wallet_{}", uuid::Uuid::new_v4().to_string()),
wallet_key: settings::DEFAULT_WALLET_KEY.into(),
Expand All @@ -193,6 +194,7 @@ pub async fn dev_setup_wallet_indy(key_seed: &str) -> (String, WalletHandle) {

#[cfg(feature = "vdrtools")]
pub async fn dev_build_profile_vdrtools(genesis_file_path: String, wallet: Arc<IndySdkWallet>) -> Arc<dyn Profile> {
info!("dev_build_profile_vdrtools >>");
let vcx_pool_config = VcxPoolConfig {
genesis_file_path: genesis_file_path.clone(),
indy_vdr_config: None,
Expand All @@ -215,6 +217,7 @@ pub async fn dev_build_profile_vdrtools(genesis_file_path: String, wallet: Arc<I

#[cfg(feature = "modular_libs")]
pub fn dev_build_profile_modular(genesis_file_path: String, wallet: Arc<IndySdkWallet>) -> Arc<dyn Profile> {
info!("dev_build_profile_modular >>");
let vcx_pool_config = VcxPoolConfig {
genesis_file_path: genesis_file_path.clone(),
indy_vdr_config: None,
Expand All @@ -228,6 +231,7 @@ pub async fn dev_build_profile_vdr_proxy_ledger(wallet: Arc<IndySdkWallet>) -> A
use crate::core::profile::vdr_proxy_profile::VdrProxyProfile;
use aries_vcx_core::VdrProxyClient;
use std::env;
info!("dev_build_profile_vdr_proxy_ledger >>");

let client_url = env::var("VDR_PROXY_CLIENT_URL").unwrap_or_else(|_| "http://127.0.0.1:3030".to_string());
let client = VdrProxyClient::new(&client_url).unwrap();
Expand All @@ -237,7 +241,7 @@ pub async fn dev_build_profile_vdr_proxy_ledger(wallet: Arc<IndySdkWallet>) -> A

pub async fn dev_build_featured_profile(genesis_file_path: String, wallet: Arc<IndySdkWallet>) -> Arc<dyn Profile> {
// In case of migration test setup, we are starting with vdrtools, then we migrate
#[cfg(any(feature = "vdrtools", feature = "migration"))]
#[cfg(feature = "migration")]
return {
info!("SetupProfile >> using indy profile");
dev_build_profile_vdrtools(genesis_file_path, wallet).await
Expand All @@ -252,6 +256,11 @@ pub async fn dev_build_featured_profile(genesis_file_path: String, wallet: Arc<I
info!("SetupProfile >> using vdr proxy profile");
dev_build_profile_vdr_proxy_ledger(wallet).await
};
#[cfg(feature = "vdrtools")]
return {
info!("SetupProfile >> using indy profile");
dev_build_profile_vdrtools(genesis_file_path, wallet).await
};
}

impl SetupProfile {
Expand Down

0 comments on commit f8aaadc

Please sign in to comment.