Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion acapy_agent/wallet/anoncreds_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ async def retry_converting_records(
async def fail_upgrade():
async with profile.session() as session:
storage = session.inject(BaseStorage)
UpgradeInProgressSingleton().remove_wallet(profile.name)
await storage.delete_record(upgrading_record)

try:
Expand All @@ -597,7 +598,8 @@ async def fail_upgrade():
else:
LOGGER.error(
f"Failed to upgrade wallet: {profile.name} after 5 retries. "
"Try fixing any connection issues and re-running the update"
"Try fixing any connection issues or repairing the wallet and re-running "
"the update"
)
await fail_upgrade()

Expand Down
5 changes: 5 additions & 0 deletions acapy_agent/wallet/tests/test_anoncreds_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from ...tests import mock
from ...utils.testing import create_test_profile
from .. import anoncreds_upgrade
from ..singletons import UpgradeInProgressSingleton


class TestAnonCredsUpgrade(IsolatedAsyncioTestCase):
Expand Down Expand Up @@ -361,13 +362,17 @@
Exception("Error"),
]
)
# Add wallet to upgrade in progress singleton
UpgradeInProgressSingleton().set_wallet(self.profile.name)
await anoncreds_upgrade.upgrade_wallet_to_anoncreds_if_requested(
self.profile
)
assert mock_rollback.called
assert not mock_commit.called
# Verify wallet has been removed from singleton
assert self.profile.name not in UpgradeInProgressSingleton().wallets
# Upgrading record should not be deleted
with self.assertRaises(Exception):

Check warning on line 375 in acapy_agent/wallet/tests/test_anoncreds_upgrade.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Specify a more specific exception type here.

See more on https://sonarcloud.io/project/issues?id=openwallet-foundation_acapy&issues=AZ8kbjdJoYG4JGBnr1fX&open=AZ8kbjdJoYG4JGBnr1fX&pullRequest=4163
await storage.find_record(
type_filter=RECORD_TYPE_ACAPY_UPGRADING, tag_query={}
)
Expand Down Expand Up @@ -396,7 +401,7 @@
assert mock_rollback.called
assert not mock_commit.called
# Upgrading record should not be deleted
with self.assertRaises(Exception):

Check warning on line 404 in acapy_agent/wallet/tests/test_anoncreds_upgrade.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Specify a more specific exception type here.

See more on https://sonarcloud.io/project/issues?id=openwallet-foundation_acapy&issues=AZ8kbjdJoYG4JGBnr1fY&open=AZ8kbjdJoYG4JGBnr1fY&pullRequest=4163
await storage.find_record(
type_filter=RECORD_TYPE_ACAPY_UPGRADING, tag_query={}
)
Expand Down
Loading