Description
Trying to update libjuju from 3.5.0.0 to 3.5.2.0 breaks tests setting the storage parameter during deploy. Example CI run can be seen here. Deploying a locally build charm with:
await ops_test.model.deploy(
charm,
application_name=FIRST_APPLICATION,
num_units=3,
series=CHARM_SERIES,
storage={"pgdata": {"pool": "lxd-btrfs", "size": 2048}},
config={"profile": "testing"},
)
Will result in:
File "/home/runner/work/postgresql-operator/postgresql-operator/tests/integration/ha_tests/test_restore_cluster.py", line 40, in test_build_and_deploy
await ops_test.model.deploy(
File "/home/runner/work/postgresql-operator/postgresql-operator/.tox/integration/lib/python3.10/site-packages/juju/model.py", line 1841, in deploy
return await self._deploy(
File "/home/runner/work/postgresql-operator/postgresql-operator/.tox/integration/lib/python3.10/site-packages/juju/model.py", line 2154, in _deploy
storage=***k: parse_storage_constraint(v) for k, v in (storage or dict()).items()***,
File "/home/runner/work/postgresql-operator/postgresql-operator/.tox/integration/lib/python3.10/site-packages/juju/model.py", line 2154, in <dictcomp>
storage=***k: parse_storage_constraint(v) for k, v in (storage or dict()).items()***,
File "/home/runner/work/postgresql-operator/postgresql-operator/.tox/integration/lib/python3.10/site-packages/juju/constraints.py", line 131, in parse_storage_constraint
for m in STORAGE.finditer(constraint):
TypeError: expected string or bytes-like object
Trying to deploy something like:
await model.deploy("postgresql", storage={"pgdata": "lxd-btrfs,1,2G"}, config={"profile": "testing"})
Fails different validation:
TypeError: juju.client._definitions.Constraints() argument after ** must be a mapping, not str
I think the issue is caused by the additional validation added in model.py L2119
Urgency
Annoying bug in our test suite
Python-libjuju version
3.5.2.0
Juju version
3.4.4
Reproduce / Test
>>> import asyncio
>>> from juju.model import Model
>>> model = Model()
>>> await model.connect_current()
>>> await model.deploy("postgresql", storage={"pgdata": {"pool": "lxd-btrfs", "size": 2048}}, config={"profile": "testing"})
Description
Trying to update libjuju from 3.5.0.0 to 3.5.2.0 breaks tests setting the storage parameter during deploy. Example CI run can be seen here. Deploying a locally build charm with:
Will result in:
Trying to deploy something like:
Fails different validation:
I think the issue is caused by the additional validation added in model.py L2119
Urgency
Annoying bug in our test suite
Python-libjuju version
3.5.2.0
Juju version
3.4.4
Reproduce / Test