diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3d99338d0d..a199336485 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -282,7 +282,7 @@ jobs: with: rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }} - name: "Run aries-vcx integration tests" - run: RUST_TEST_THREADS=1 cargo test --manifest-path="aries_vcx/Cargo.toml" -F vdrtools_wallet,credx -- --ignored; + run: cargo test --manifest-path="aries_vcx/Cargo.toml" -F vdrtools_wallet,credx -- --ignored; test-integration-aries-vcx-mysql: needs: workflow-setup @@ -295,7 +295,7 @@ jobs: with: rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }} - name: "Run aries_vcx tests: mysql_test" - run: RUST_TEST_THREADS=1 cargo test --manifest-path="aries_vcx/Cargo.toml" test_mysql -- --include-ignored; + run: cargo test --manifest-path="aries_vcx/Cargo.toml" test_mysql -- --include-ignored; test-integration-aries-vcx-vdrproxy: needs: [workflow-setup, build-docker-vdrproxy] @@ -319,7 +319,7 @@ jobs: rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }} skip-vdrproxy-setup: false - name: "Run aries_vcx tests: vdrproxy_test" - run: RUST_TEST_THREADS=1 cargo test --manifest-path="aries_vcx/Cargo.toml" -F vdr_proxy_ledger,credx -- --ignored + run: cargo test --manifest-path="aries_vcx/Cargo.toml" -F vdr_proxy_ledger,credx -- --ignored - name: "Collect docker logs on failure" if: failure() uses: ./.github/actions/upload-docker-logs @@ -354,7 +354,7 @@ jobs: rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }} - name: "Run resolver tests" run: | - RUST_TEST_THREADS=1 cargo test --examples -p did_doc -p did_parser -p did_resolver -p did_resolver_registry -p did_resolver_sov -p did_resolver_web -p did_doc_sov -p did_key -p did_peer --test "*" + cargo test --examples -p did_doc -p did_parser -p did_resolver -p did_resolver_registry -p did_resolver_sov -p did_resolver_web -p did_doc_sov -p did_key -p did_peer --test "*" test-integration-node-wrapper: needs: workflow-setup diff --git a/aries_vcx/tests/test_connection.rs b/aries_vcx/tests/test_connection.rs index 83b9c8c400..24fd3ee717 100644 --- a/aries_vcx/tests/test_connection.rs +++ b/aries_vcx/tests/test_connection.rs @@ -30,7 +30,7 @@ use crate::utils::{ create_connections_via_oob_invite, create_connections_via_pairwise_invite, create_connections_via_public_invite, }, - test_agent::{create_test_agent, create_test_agent_trustee}, + test_agent::{create_test_agent, create_test_agent_endorser, create_test_agent_trustee}, }; pub mod utils; @@ -179,19 +179,28 @@ async fn test_agency_pool_establish_connection_via_pairwise_invite() -> Result<( #[ignore] async fn test_agency_pool_establish_connection_via_out_of_band() -> Result<(), Box> { let setup = SetupPoolDirectory::init().await; - let mut institution = create_test_agent_trustee(setup.genesis_file_path.clone()).await; + let institution = create_test_agent_trustee(setup.genesis_file_path.clone()).await; + + let mut endorser = create_test_agent_endorser( + institution.ledger_write, + institution.wallet, + &setup.genesis_file_path, + &institution.institution_did, + ) + .await?; + let mut consumer = create_test_agent(setup.genesis_file_path).await; - create_service(&institution).await; + create_service(&endorser).await; - let (consumer_to_institution, institution_to_consumer) = - create_connections_via_oob_invite(&mut consumer, &mut institution).await; + let (consumer_to_endorser, endorser_to_consumer) = + create_connections_via_oob_invite(&mut consumer, &mut endorser).await; let basic_message = build_basic_message("Hello TestAgent".to_string()); if let AriesMessage::BasicMessage(message) = send_and_receive_message( &consumer, - &institution, - &institution_to_consumer, - &consumer_to_institution, + &endorser, + &endorser_to_consumer, + &consumer_to_endorser, &basic_message.clone().into(), ) .await diff --git a/aries_vcx/tests/test_pool.rs b/aries_vcx/tests/test_pool.rs index 64858e401b..aee0a59ee9 100644 --- a/aries_vcx/tests/test_pool.rs +++ b/aries_vcx/tests/test_pool.rs @@ -39,7 +39,7 @@ use test_utils::{ use crate::utils::{ create_and_publish_test_rev_reg, create_and_write_test_cred_def, create_and_write_test_schema, scenarios::attr_names_address_list, - test_agent::{create_test_agent, create_test_agent_trustee}, + test_agent::{create_test_agent, create_test_agent_endorser, create_test_agent_trustee}, }; pub mod utils; @@ -136,18 +136,31 @@ async fn test_pool_rotate_verkey() -> Result<(), Box> { #[ignore] async fn test_pool_add_get_service() -> Result<(), Box> { let setup = build_setup_profile().await; - let did = setup.institution_did.clone(); + let endorser = create_test_agent_endorser( + setup.ledger_write, + setup.wallet, + &setup.genesis_file_path, + &setup.institution_did, + ) + .await?; + let expect_service = AriesService::default(); - write_endpoint_legacy(&setup.wallet, &setup.ledger_write, &did, &expect_service).await?; + write_endpoint_legacy( + &endorser.wallet, + &endorser.ledger_write, + &endorser.institution_did, + &expect_service, + ) + .await?; thread::sleep(Duration::from_millis(50)); - let service = get_service(&setup.ledger_read, &did).await?; + let service = get_service(&endorser.ledger_read, &endorser.institution_did).await?; assert_eq!(expect_service, service); // clean up written legacy service clear_attr( - &setup.wallet, - &setup.ledger_write, - &setup.institution_did, + &endorser.wallet, + &endorser.ledger_write, + &endorser.institution_did, "service", ) .await?; @@ -196,15 +209,28 @@ async fn test_pool_write_new_endorser_did() -> Result<(), Box> { #[ignore] async fn test_pool_add_get_service_public() -> Result<(), Box> { let setup = build_setup_profile().await; - let did = setup.institution_did.clone(); + let endorser = create_test_agent_endorser( + setup.ledger_write, + setup.wallet, + &setup.genesis_file_path, + &setup.institution_did, + ) + .await?; + let create_service = EndpointDidSov::create() .set_service_endpoint("https://example.org".parse()?) .set_routing_keys(Some(vec!["did:sov:456".into()])); - write_endpoint(&setup.wallet, &setup.ledger_write, &did, &create_service).await?; + write_endpoint( + &endorser.wallet, + &endorser.ledger_write, + &endorser.institution_did, + &create_service, + ) + .await?; thread::sleep(Duration::from_millis(50)); - let service = get_service(&setup.ledger_read, &did).await?; + let service = get_service(&endorser.ledger_read, &endorser.institution_did).await?; let expect_recipient_key = - get_verkey_from_ledger(&setup.ledger_read, &setup.institution_did).await?; + get_verkey_from_ledger(&endorser.ledger_read, &endorser.institution_did).await?; let expect_service = AriesService::default() .set_service_endpoint("https://example.org".parse()?) .set_recipient_keys(vec![expect_recipient_key]) @@ -213,9 +239,9 @@ async fn test_pool_add_get_service_public() -> Result<(), Box> { // clean up written endpoint clear_attr( - &setup.wallet, - &setup.ledger_write, - &setup.institution_did, + &endorser.wallet, + &endorser.ledger_write, + &endorser.institution_did, "endpoint", ) .await?; diff --git a/aries_vcx/tests/utils/test_agent.rs b/aries_vcx/tests/utils/test_agent.rs index 1a9a66268f..dd69d8692e 100644 --- a/aries_vcx/tests/utils/test_agent.rs +++ b/aries_vcx/tests/utils/test_agent.rs @@ -1,12 +1,14 @@ #![allow(clippy::diverging_sub_expression)] -use aries_vcx::global::settings::DEFAULT_LINK_SECRET_ALIAS; +use aries_vcx::{ + common::ledger::transactions::write_endorser_did, global::settings::DEFAULT_LINK_SECRET_ALIAS, +}; use aries_vcx_core::{ anoncreds::base_anoncreds::BaseAnonCreds, ledger::base_ledger::{ AnoncredsLedgerRead, AnoncredsLedgerWrite, IndyLedgerRead, IndyLedgerWrite, }, - wallet::base_wallet::BaseWallet, + wallet::{base_wallet::BaseWallet, indy::wallet::get_verkey_from_wallet}, }; use test_utils::{ constants::TRUSTEE_SEED, @@ -81,3 +83,38 @@ pub async fn create_test_agent( > { create_test_agent_from_seed(&generate_random_seed(), genesis_file_path).await } + +pub async fn create_test_agent_endorser( + ledger_write: LW, + trustee_wallet: W, + genesis_file_path: &str, + trustee_did: &str, +) -> Result< + TestAgent< + impl IndyLedgerRead + AnoncredsLedgerRead, + impl IndyLedgerWrite + AnoncredsLedgerWrite, + impl BaseAnonCreds, + impl BaseWallet, + >, + Box, +> +where + LW: IndyLedgerWrite + AnoncredsLedgerWrite, + W: BaseWallet, +{ + let acme = create_test_agent(genesis_file_path.to_string()).await; + let acme_vk = + get_verkey_from_wallet(acme.wallet.get_wallet_handle(), &acme.institution_did).await?; + + write_endorser_did( + &trustee_wallet, + &ledger_write, + trustee_did, + &acme.institution_did, + &acme_vk, + None, + ) + .await?; + + Ok(acme) +}