Add Juju context to _OSTestingModelBackend

ops 2.16.0 expects _JujuContext to the
TestingModelBackend class. So update the
derived class initiation accordingly.

Change-Id: If5b709762e336c64ab511a450a1a1cc8bdd4e662
This commit is contained in:
Hemanth Nakkina 2024-08-29 12:21:46 +05:30
parent 7f87cc9a6c
commit 41fc880836
No known key found for this signature in database
GPG Key ID: 2E4970F7B143168E

View File

@ -51,6 +51,9 @@ from ops import (
framework,
model,
)
from ops.jujucontext import (
_JujuContext,
)
from ops.testing import (
Harness,
_TestingModelBackend,
@ -800,7 +803,10 @@ def get_harness(
actions=charm_actions,
)
harness._backend = _OSTestingModelBackend(
harness._unit_name, harness._meta, harness._get_config(charm_config)
harness._unit_name,
harness._meta,
harness._get_config(charm_config),
_JujuContext.from_dict(os.environ),
)
harness._model = model.Model(harness._meta, harness._backend) # type: ignore
harness._framework = framework.Framework(