Skip to content

Commit

Permalink
parent 49e71c8
Browse files Browse the repository at this point in the history
author Shaanjot Gill <[email protected]> 1694204418 +0530
committer Shaanjot Gill <[email protected]> 1695747717 +0530

parent 49e71c8
author Shaanjot Gill <[email protected]> 1694204418 +0530
committer Shaanjot Gill <[email protected]> 1695747613 +0530

parent 49e71c8
author Shaanjot Gill <[email protected]> 1694204418 +0530
committer Shaanjot Gill <[email protected]> 1695747425 +0530

parent 49e71c8
author Shaanjot Gill <[email protected]> 1694204418 +0530
committer Shaanjot Gill <[email protected]> 1695746776 +0530

tagged upgrade impl, fixed fix_ledger_entry function and added tests

Signed-off-by: Shaanjot Gill <[email protected]>
  • Loading branch information
shaangill025 committed Sep 26, 2023
1 parent 49e71c8 commit 9b16660
Show file tree
Hide file tree
Showing 8 changed files with 543 additions and 144 deletions.
19 changes: 19 additions & 0 deletions UpgradingACA-Py.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@ is high (such as a "resave connections" upgrade to a deployment with many, many
connections), you may want to do a test upgrade offline first, to see if there
is likely to be a service disruption during the upgrade. Plan accordingly!

## Tagged upgrades
Upgrades are defined in the [Upgrade Definition YML file], in addition to specifying upgrade actions by version they can also be specified by named tags. Unlike version based upgrades where all applicable version based actions will be performed based upon sorted order of versions, with named tags only actions corresponding to provided tags will be performed. Note: `--force-upgrade` is required when running name tags based upgrade [i.e. provding `--named-tag`]

Tags are specfied in YML file as below:
```
fix_issue_rev_reg:
fix_issue_rev_reg_records: true
```

Example
```
./scripts/run_docker upgrade --force-upgrade --named-tag fix_issue_rev_reg
In case, running multiple tags [say test1 & test2]:
./scripts/run_docker upgrade --force-upgrade --named-tag test1 --named-tag test2
```



## Exceptions

There are a couple of upgrade exception conditions to consider, as outlined
Expand Down
4 changes: 3 additions & 1 deletion aries_cloudagent/commands/default_version_upgrade_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ v0.7.1:
v0.7.0:
update_existing_records: false
v0.6.0:
update_existing_records: false
update_existing_records: false
fix_issue_rev_reg:
fix_issue_rev_reg_records: true
42 changes: 41 additions & 1 deletion aries_cloudagent/commands/tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,44 @@ async def test_upgrade_callable(self):
}
)

async def test_upgrade_callable_named_tag(self):
version_storage_record = await self.storage.find_record(
type_filter="acapy_version", tag_query={}
)
await self.storage.delete_record(version_storage_record)
with async_mock.patch.object(
test_module,
"wallet_config",
async_mock.CoroutineMock(
return_value=(
self.profile,
async_mock.CoroutineMock(did="public DID", verkey="verkey"),
)
),
), async_mock.patch.object(
test_module.yaml,
"safe_load",
async_mock.MagicMock(
return_value={
"v0.7.2": {
"resave_records": {
"base_record_path": [
"aries_cloudagent.connections.models.conn_record.ConnRecord"
]
},
"update_existing_records": True,
},
"fix_issue_rev_reg": {"fix_issue_rev_reg_records": True},
}
),
):
await test_module.upgrade(
settings={
"upgrade.named_tags": ["fix_issue_rev_reg"],
"upgrade.force_upgrade": True,
}
)

async def test_upgrade_x_same_version(self):
version_storage_record = await self.storage.find_record(
type_filter="acapy_version", tag_query={}
Expand Down Expand Up @@ -169,7 +207,9 @@ async def test_upgrade_missing_from_version(self):
"upgrade.config_path": "./aries_cloudagent/commands/default_version_upgrade_config.yml",
}
)
assert "No upgrade from version found in wallet or" in str(ctx.exception)
assert "Error during upgrade: No upgrade from version or tags found" in str(
ctx.exception
)

async def test_upgrade_x_callable_not_set(self):
version_storage_record = await self.storage.find_record(
Expand Down
Loading

0 comments on commit 9b16660

Please sign in to comment.